Appwrite Server

Open source backend-as-a-service

appwrite.io/docs/references ↗
Version
1.5.0
OpenAPI
3.0.0
Endpoints
259
Schemas
207
92
Quality
Updated
3 days ago
Backend backend database authentication open-source
Use this API in your AI agent

Query structured spec data via REST or MCP. Get exactly what your agent needs.

Get API Key

Server URLs

https://cloud.appwrite.io/v1

Endpoints

Clear filters

Account 14 endpoints

POST /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.

operationId: Account_createNewUser

Request Body

application/json
schema AccountCreateNewUserRequest
Property Type Required
name string optional
email string required
userId string required
password string required

Responses

201

User

POST /account
POST /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.

operationId: Account_createJwt

Responses

201

JWT

POST /account/jwt
POST /account/mfa/authenticators/{type}

Add an authenticator app to be used as an MFA factor. Verify the authenticator using the verify authenticator method.

operationId: Account_addAuthenticatorApp

Parameters

Name In Required Type Description
type path required string

Type of authenticator. Must be totp

Responses

200

MFAType

POST /account/mfa/authenticators/{type}
POST /account/mfa/challenge

Begin the process of MFA verification after sign-in. Finish the flow with updateMfaChallenge method.

operationId: Account_beginMfaVerification

Request Body

application/json
schema AccountBeginMfaVerificationRequest
Property Type Required
factor string required

Responses

201

MFA Challenge

POST /account/mfa/challenge
POST /account/mfa/recovery-codes

Generate recovery codes as backup for MFA flow. It’s recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in createMfaChallenge method.

operationId: Account_generateRecoveryCodes

Responses

201

MFA Recovery Codes

POST /account/mfa/recovery-codes
POST /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.

operationId: Account_createPasswordRecovery

Request Body

application/json
schema AccountCreatePasswordRecoveryRequest
Property Type Required
url string required
email string required

Responses

201

Token

POST /account/recovery
POST /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.

operationId: Account_createAnonymousSession

Responses

201

Session

POST /account/sessions/anonymous
POST /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.

operationId: Account_createEmailPasswordSession

Request Body

application/json
schema AccountCreateEmailPasswordSessionRequest
Property Type Required
email string required
password string required

Responses

201

Session

POST /account/sessions/email
POST /account/sessions/token

Use this endpoint to create a session from token. Provide the userId and secret parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.

operationId: Account_createTokenSession

Request Body

application/json
schema AccountCreateTokenSessionRequest
Property Type Required
secret string required
userId string required

Responses

201

Session

POST /account/sessions/token
POST /account/tokens/email

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. Use the returned user ID and secret and submit a request to the POST /v1/account/sessions/token endpoint to complete the login process. The secret sent to the user’s email is valid for 15 minutes.

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

operationId: Account_createEmailToken

Request Body

application/json
schema AccountCreateEmailTokenRequest
Property Type Required
email string required
phrase boolean optional
userId string required

Responses

201

Token

POST /account/tokens/email
POST /account/tokens/magic-url

Sends the user an email with a secret key for creating a session. If the provided user ID has not been 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 POST /v1/account/sessions/token 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.

operationId: Account_createMagicUrlToken

Request Body

application/json
schema AccountCreateMagicUrlTokenRequest
Property Type Required
url string optional
email string required
phrase boolean optional
userId string required

Responses

201

Token

POST /account/tokens/magic-url
POST /account/tokens/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 POST /v1/account/sessions/token 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.

operationId: Account_createPhoneToken

Request Body

application/json
schema AccountCreatePhoneTokenRequest
Property Type Required
phone string required
userId string required

Responses

201

Token

POST /account/tokens/phone
POST /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.

operationId: Account_createEmailVerification

Request Body

application/json
schema AccountCreateEmailVerificationRequest
Property Type Required
url string required

Responses

201

Token

POST /account/verification
POST /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.

operationId: Account_createPhoneVerification

Responses

201

Token

POST /account/verification/phone

Databases 14 endpoints

POST /databases

Create a new Database.

operationId: Databases_createDatabase

Request Body

application/json
schema DatabasesCreateDatabaseRequest
Property Type Required
name string required
enabled boolean optional
databaseId string required

Responses

201

Database

POST /databases
POST /databases/{databaseId}/collections

Create a new Collection. Before using this route, you should create a new database resource using either a server integration API or directly from your database console.

operationId: Databases_createCollection

Parameters

Name In Required Type Description
databaseId path required string

Database ID.

Request Body

application/json
schema DatabasesCreateCollectionRequest
Property Type Required
name string required
enabled boolean optional
permissions array optional
collectionId string required
documentSecurity boolean optional

Responses

201

Collection

POST /databases/{databaseId}/collections
POST /databases/{databaseId}/collections/{collectionId}/attributes/boolean

Create a boolean attribute.

operationId: Databases_createBooleanAttribute

Parameters

Name In Required Type Description
databaseId path required string

Database ID.

collectionId path required string

Collection ID. You can create a new collection using the Database service server integration.

Request Body

application/json
schema DatabasesCreateBooleanAttributeRequest
Property Type Required
key string required
array boolean optional
default boolean optional
required boolean required

Responses

202

AttributeBoolean

POST /databases/{databaseId}/collections/{collectionId}/attributes/boolean
POST /databases/{databaseId}/collections/{collectionId}/attributes/datetime

Create a date time attribute according to the ISO 8601 standard.

operationId: Databases_createDatetimeAttribute

Parameters

Name In Required Type Description
databaseId path required string

Database ID.

collectionId path required string

Collection ID. You can create a new collection using the Database service server integration.

Request Body

application/json
schema DatabasesCreateDatetimeAttributeRequest
Property Type Required
key string required
array boolean optional
default string optional
required boolean required

Responses

202

AttributeDatetime

POST /databases/{databaseId}/collections/{collectionId}/attributes/datetime
POST /databases/{databaseId}/collections/{collectionId}/attributes/email

Create an email attribute.

operationId: Databases_createEmailAttribute

Parameters

Name In Required Type Description
databaseId path required string

Database ID.

collectionId path required string

Collection ID. You can create a new collection using the Database service server integration.

Request Body

application/json
schema DatabasesCreateEmailAttributeRequest
Property Type Required
key string required
array boolean optional
default string optional
required boolean required

Responses

202

AttributeEmail

POST /databases/{databaseId}/collections/{collectionId}/attributes/email
POST /databases/{databaseId}/collections/{collectionId}/attributes/enum

Create an enumeration attribute. The elements param acts as a white-list of accepted values for this attribute.

operationId: Databases_createEnumAttribute

Parameters

Name In Required Type Description
databaseId path required string

Database ID.

collectionId path required string

Collection ID. You can create a new collection using the Database service server integration.

Request Body

application/json
schema DatabasesCreateEnumAttributeRequest
Property Type Required
key string required
array boolean optional
default string optional
elements array required
required boolean required

Responses

202

AttributeEnum

POST /databases/{databaseId}/collections/{collectionId}/attributes/enum
POST /databases/{databaseId}/collections/{collectionId}/attributes/float

Create a float attribute. Optionally, minimum and maximum values can be provided.

operationId: Databases_createFloatAttribute

Parameters

Name In Required Type Description
databaseId path required string

Database ID.

collectionId path required string

Collection ID. You can create a new collection using the Database service server integration.

Request Body

application/json
schema DatabasesCreateFloatAttributeRequest
Property Type Required
key string required
max number optional
min number optional
array boolean optional
default number optional
required boolean required

Responses

202

AttributeFloat

POST /databases/{databaseId}/collections/{collectionId}/attributes/float
POST /databases/{databaseId}/collections/{collectionId}/attributes/integer

Create an integer attribute. Optionally, minimum and maximum values can be provided.

operationId: Databases_createIntegerAttribute

Parameters

Name In Required Type Description
databaseId path required string

Database ID.

collectionId path required string

Collection ID. You can create a new collection using the Database service server integration.

Request Body

application/json
schema DatabasesCreateIntegerAttributeRequest
Property Type Required
key string required
max integer optional
min integer optional
array boolean optional
default integer optional
required boolean required

Responses

202

AttributeInteger

POST /databases/{databaseId}/collections/{collectionId}/attributes/integer
POST /databases/{databaseId}/collections/{collectionId}/attributes/ip

Create IP address attribute.

operationId: Databases_createIpAttribute

Parameters

Name In Required Type Description
databaseId path required string

Database ID.

collectionId path required string

Collection ID. You can create a new collection using the Database service server integration.

Request Body

application/json
schema DatabasesCreateIpAttributeRequest
Property Type Required
key string required
array boolean optional
default string optional
required boolean required

Responses

202

AttributeIP

POST /databases/{databaseId}/collections/{collectionId}/attributes/ip
POST /databases/{databaseId}/collections/{collectionId}/attributes/relationship

Create relationship attribute. Learn more about relationship attributes.

operationId: Databases_createRelationshipAttribute

Parameters

Name In Required Type Description
databaseId path required string

Database ID.

collectionId path required string

Collection ID. You can create a new collection using the Database service server integration.

Request Body

application/json
schema DatabasesCreateRelationshipAttributeRequest
Property Type Required
key string optional
type string required
twoWay boolean optional
onDelete string optional
twoWayKey string optional
relatedCollectionId string required

Responses

202

AttributeRelationship

POST /databases/{databaseId}/collections/{collectionId}/attributes/relationship
POST /databases/{databaseId}/collections/{collectionId}/attributes/string

Create a string attribute.

operationId: Databases_createStringAttribute

Parameters

Name In Required Type Description
databaseId path required string

Database ID.

collectionId path required string

Collection ID. You can create a new collection using the Database service server integration.

Request Body

application/json
schema DatabasesCreateStringAttributeRequest
Property Type Required
key string required
size integer required
array boolean optional
default string optional
encrypt boolean optional
required boolean required

Responses

202

AttributeString

POST /databases/{databaseId}/collections/{collectionId}/attributes/string
POST /databases/{databaseId}/collections/{collectionId}/attributes/url

Create a URL attribute.

operationId: Databases_createUrlAttribute

Parameters

Name In Required Type Description
databaseId path required string

Database ID.

collectionId path required string

Collection ID. You can create a new collection using the Database service server integration.

Request Body

application/json
schema DatabasesCreateUrlAttributeRequest
Property Type Required
key string required
array boolean optional
default string optional
required boolean required

Responses

202

AttributeURL

POST /databases/{databaseId}/collections/{collectionId}/attributes/url
POST /databases/{databaseId}/collections/{collectionId}/documents

Create a new Document. Before using this route, you should create a new collection resource using either a server integration API or directly from your database console.

operationId: Databases_createDocument

Parameters

Name In Required Type Description
databaseId path required string

Database ID.

collectionId path required string

Collection ID. You can create a new collection using the Database service server integration. Make sure to define attributes before creating documents.

Request Body

application/json
schema DatabasesCreateDocumentRequest
Property Type Required
data object required
documentId string required
permissions array optional

Responses

201

Document

POST /databases/{databaseId}/collections/{collectionId}/documents
POST /databases/{databaseId}/collections/{collectionId}/indexes

Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request.
Attributes can be key, fulltext, and unique.

operationId: Databases_createIndex

Parameters

Name In Required Type Description
databaseId path required string

Database ID.

collectionId path required string

Collection ID. You can create a new collection using the Database service server integration.

Request Body

application/json
schema DatabasesCreateIndexRequest
Property Type Required
key string required
type string required
orders array optional
attributes array required

Responses

202

Index

POST /databases/{databaseId}/collections/{collectionId}/indexes

Functions 5 endpoints

POST /functions

Create a new function. You can pass a list of permissions to allow different project users or team with access to execute the function using the client API.

operationId: Functions_createNewFunction

Request Body

application/json
schema FunctionsCreateNewFunctionRequest
Property Type Required
name string required
events array optional
enabled boolean optional
execute array optional
logging boolean optional
runtime string required
timeout integer optional
commands string optional
schedule string optional
entrypoint string optional
functionId string required
templateOwner string optional
installationId string optional
providerBranch string optional
templateBranch string optional
providerSilentMode boolean optional
templateRepository string optional
providerRepositoryId string optional
providerRootDirectory string optional
templateRootDirectory string optional

Responses

201

Function

POST /functions
POST /functions/{functionId}/deployments

Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you’ll need to update the function’s deployment to use your new deployment UID.

This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the Appwrite Cloud Functions tutorial.

Use the “command” param to set the entrypoint used to execute your code.

operationId: Functions_createDeploymentFunctionCode

Parameters

Name In Required Type Description
functionId path required string

Function ID.

Request Body

multipart/form-data
schema FunctionsCreateDeploymentFunctionCodeRequest
Property Type Required
code string required
activate boolean required
commands string optional
entrypoint string optional

Responses

202

Deployment

POST /functions/{functionId}/deployments
POST /functions/{functionId}/deployments/{deploymentId}/builds/{buildId}

Create a new build for an Appwrite Function deployment. This endpoint can be used to retry a failed build.

operationId: Functions_createBuild

Parameters

Name In Required Type Description
functionId path required string

Function ID.

deploymentId path required string

Deployment ID.

buildId path required string

Build unique ID.

Responses

204

No content

POST /functions/{functionId}/deployments/{deploymentId}/builds/{buildId}
POST /functions/{functionId}/executions

Trigger a function execution. The returned object will return you the current execution status. You can ping the Get Execution endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.

operationId: Functions_triggerExecution

Parameters

Name In Required Type Description
functionId path required string

Function ID.

Request Body

application/json
schema FunctionsTriggerExecutionRequest
Property Type Required
body string optional
path string optional
async boolean optional
method string optional
headers object optional

Responses

201

Execution

POST /functions/{functionId}/executions
POST /functions/{functionId}/variables

Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables.

operationId: Functions_createVariable

Parameters

Name In Required Type Description
functionId path required string

Function unique ID.

Request Body

application/json
schema FunctionsCreateVariableRequest
Property Type Required
key string required
value string required

Responses

201

Variable

POST /functions/{functionId}/variables

Graphql 2 endpoints

POST /graphql

Execute a GraphQL mutation.

operationId: Graphql_executeMutation

Responses

200

Any

POST /graphql
POST /graphql/mutation

Execute a GraphQL mutation.

operationId: Graphql_executeMutation

Responses

200

Any

POST /graphql/mutation

Messaging 15 endpoints

POST /messaging/messages/email

Create a new email message.

operationId: Messaging_createEmailMessage

Request Body

application/json
schema MessagingCreateEmailMessageRequest
Property Type Required
cc array optional
bcc array optional
html boolean optional
draft boolean optional
users array optional
topics array optional
content string required
subject string required
targets array optional
messageId string required
attachments array optional
scheduledAt string optional

Responses

201

Message

POST /messaging/messages/email
POST /messaging/messages/push

Create a new push notification.

operationId: Messaging_createPushNotification

Request Body

application/json
schema MessagingCreatePushNotificationRequest
Property Type Required
tag string optional
body string required
data object optional
icon string optional
badge string optional
color string optional
draft boolean optional
image string optional
sound string optional
title string required
users array optional
action string optional
topics array optional
targets array optional
messageId string required
scheduledAt string optional

Responses

201

Message

POST /messaging/messages/push
POST /messaging/messages/sms

Create a new SMS message.

operationId: Messaging_createSmsMessage

Request Body

application/json
schema MessagingCreateSmsMessageRequest
Property Type Required
draft boolean optional
users array optional
topics array optional
content string required
targets array optional
messageId string required
scheduledAt string optional

Responses

201

Message

POST /messaging/messages/sms
POST /messaging/providers/apns

Create a new Apple Push Notification service provider.

operationId: Messaging_createApnsProvider

Request Body

application/json
schema MessagingCreateApnsProviderRequest
Property Type Required
name string required
teamId string optional
authKey string optional
enabled boolean optional
sandbox boolean optional
bundleId string optional
authKeyId string optional
providerId string required

Responses

201

Provider

POST /messaging/providers/apns
POST /messaging/providers/fcm

Create a new Firebase Cloud Messaging provider.

operationId: Messaging_createFcmProvider

Request Body

application/json
schema MessagingCreateFcmProviderRequest
Property Type Required
name string required
enabled boolean optional
providerId string required
serviceAccountJSON object optional

Responses

201

Provider

POST /messaging/providers/fcm
POST /messaging/providers/mailgun

Create a new Mailgun provider.

operationId: Messaging_createProvider

Request Body

application/json
schema MessagingCreateProviderRequest
Property Type Required
name string required
apiKey string optional
domain string optional
enabled boolean optional
fromName string optional
fromEmail string optional
isEuRegion boolean optional
providerId string required
replyToName string optional
replyToEmail string optional

Responses

201

Provider

POST /messaging/providers/mailgun
POST /messaging/providers/msg91

Create a new MSG91 provider.

operationId: Messaging_createMsg91Provider

Request Body

application/json
schema MessagingCreateMsg91ProviderRequest
Property Type Required
from string optional
name string required
authKey string optional
enabled boolean optional
senderId string optional
providerId string required

Responses

201

Provider

POST /messaging/providers/msg91
POST /messaging/providers/sendgrid

Create a new Sendgrid provider.

operationId: Messaging_createSendgridProvider

Request Body

application/json
schema MessagingCreateSendgridProviderRequest
Property Type Required
name string required
apiKey string optional
enabled boolean optional
fromName string optional
fromEmail string optional
providerId string required
replyToName string optional
replyToEmail string optional

Responses

201

Provider

POST /messaging/providers/sendgrid
POST /messaging/providers/smtp

Create a new SMTP provider.

operationId: Messaging_createSmtpProvider

Request Body

application/json
schema MessagingCreateSmtpProviderRequest
Property Type Required
host string required
name string required
port integer optional
mailer string optional
autoTLS boolean optional
enabled boolean optional
fromName string optional
password string optional
username string optional
fromEmail string optional
encryption string optional
providerId string required
replyToName string optional
replyToEmail string optional

Responses

201

Provider

POST /messaging/providers/smtp
POST /messaging/providers/telesign

Create a new Telesign provider.

operationId: Messaging_createTelesignProvider

Request Body

application/json
schema MessagingCreateTelesignProviderRequest
Property Type Required
from string optional
name string required
apiKey string optional
enabled boolean optional
customerId string optional
providerId string required

Responses

201

Provider

POST /messaging/providers/telesign
POST /messaging/providers/textmagic

Create a new Textmagic provider.

operationId: Messaging_createTextmagicProvider

Request Body

application/json
schema MessagingCreateTextmagicProviderRequest
Property Type Required
from string optional
name string required
apiKey string optional
enabled boolean optional
username string optional
providerId string required

Responses

201

Provider

POST /messaging/providers/textmagic
POST /messaging/providers/twilio

Create a new Twilio provider.

operationId: Messaging_createTwilioProvider

Request Body

application/json
schema MessagingCreateTwilioProviderRequest
Property Type Required
from string optional
name string required
enabled boolean optional
authToken string optional
accountSid string optional
providerId string required

Responses

201

Provider

POST /messaging/providers/twilio
POST /messaging/providers/vonage

Create a new Vonage provider.

operationId: Messaging_createVonageProvider

Request Body

application/json
schema MessagingCreateVonageProviderRequest
Property Type Required
from string optional
name string required
apiKey string optional
enabled boolean optional
apiSecret string optional
providerId string required

Responses

201

Provider

POST /messaging/providers/vonage
POST /messaging/topics

Create a new topic.

operationId: Messaging_createTopic

Request Body

application/json
schema MessagingCreateTopicRequest
Property Type Required
name string required
topicId string required
subscribe array optional

Responses

201

Topic

POST /messaging/topics
POST /messaging/topics/{topicId}/subscribers

Create a new subscriber.

operationId: Messaging_createSubscriber

Parameters

Name In Required Type Description
topicId path required string

Topic ID. The topic ID to subscribe to.

Request Body

application/json
schema MessagingCreateSubscriberRequest
Property Type Required
targetId string required
subscriberId string required

Responses

201

Subscriber

POST /messaging/topics/{topicId}/subscribers

Storage 2 endpoints

POST /storage/buckets

Create a new storage bucket.

operationId: Storage_createNewBucket

Request Body

application/json
schema StorageCreateNewBucketRequest
Property Type Required
name string required
enabled boolean optional
bucketId string required
antivirus boolean optional
encryption boolean optional
compression string optional
permissions array optional
fileSecurity boolean optional
maximumFileSize integer optional
allowedFileExtensions array optional

Responses

201

Bucket

POST /storage/buckets
POST /storage/buckets/{bucketId}/files

Create a new file. Before using this route, you should create a new bucket resource using either a server integration API or directly from your Appwrite console.

Larger files should be uploaded using multiple requests with the content-range header to send a partial request with a maximum supported chunk of 5MB. The content-range header values should always be in bytes.

When the first request is sent, the server will return the File object, and the subsequent part request must include the file’s id in x-appwrite-id header to allow the server to know that the partial upload is for the existing file and not for a new one.

If you’re creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.

operationId: Storage_createFile

Parameters

Name In Required Type Description
bucketId path required string

Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.

Request Body

multipart/form-data
schema StorageCreateFileRequest
Property Type Required
file string required
fileId string required
permissions array optional

Responses

201

File

POST /storage/buckets/{bucketId}/files

Teams 2 endpoints

POST /teams

Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team.

operationId: Teams_createNewTeam

Request Body

application/json
schema TeamsCreateNewTeamRequest
Property Type Required
name string required
roles array optional
teamId string required

Responses

201

Team

POST /teams
POST /teams/{teamId}/memberships

Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn’t exist. If initiated from a Server SDK, the new member will be added automatically to the team.

You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters.

Use the url parameter to redirect the user from the invitation email to your app. After the user is redirected, use the Update Team Membership Status endpoint to allow the user to accept the invitation to the team.

Please note that to avoid a Redirect Attack Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console.

operationId: Teams_createMembershipRequest

Parameters

Name In Required Type Description
teamId path required string

Team ID.

Request Body

application/json
schema TeamsCreateMembershipRequestRequest
Property Type Required
url string optional
name string optional
email string optional
phone string optional
roles array required
userId string optional

Responses

201

Membership

POST /teams/{teamId}/memberships

Users 11 endpoints

POST /users

Create a new user.

operationId: Users_createNewUser

Request Body

application/json
schema UsersCreateNewUserRequest
Property Type Required
name string optional
email string optional
phone string optional
userId string required
password string optional

Responses

201

User

POST /users
POST /users/argon2

Create a new user. Password provided must be hashed with the Argon2 algorithm. Use the POST /users endpoint to create users with a plain text password.

operationId: Users_createArgon2User

Request Body

application/json
schema UsersCreateArgon2UserRequest
Property Type Required
name string optional
email string required
userId string required
password string required

Responses

201

User

POST /users/argon2
POST /users/bcrypt

Create a new user. Password provided must be hashed with the Bcrypt algorithm. Use the POST /users endpoint to create users with a plain text password.

operationId: Users_createBcryptUser

Request Body

application/json
schema UsersCreateBcryptUserRequest
Property Type Required
name string optional
email string required
userId string required
password string required

Responses

201

User

POST /users/bcrypt
POST /users/md5

Create a new user. Password provided must be hashed with the MD5 algorithm. Use the POST /users endpoint to create users with a plain text password.

operationId: Users_createMd5User

Request Body

application/json
schema UsersCreateMd5UserRequest
Property Type Required
name string optional
email string required
userId string required
password string required

Responses

201

User

POST /users/md5
POST /users/phpass

Create a new user. Password provided must be hashed with the PHPass algorithm. Use the POST /users endpoint to create users with a plain text password.

operationId: Users_createPhpassUser

Request Body

application/json
schema UsersCreatePhpassUserRequest
Property Type Required
name string optional
email string required
userId string required
password string required

Responses

201

User

POST /users/phpass
POST /users/scrypt

Create a new user. Password provided must be hashed with the Scrypt algorithm. Use the POST /users endpoint to create users with a plain text password.

operationId: Users_createScryptUser

Request Body

application/json
schema UsersCreateScryptUserRequest
Property Type Required
name string optional
email string required
userId string required
password string required
passwordCpu integer required
passwordSalt string required
passwordLength integer required
passwordMemory integer required
passwordParallel integer required

Responses

201

User

POST /users/scrypt
POST /users/scrypt-modified

Create a new user. Password provided must be hashed with the Scrypt Modified algorithm. Use the POST /users endpoint to create users with a plain text password.

operationId: Users_createScryptModifiedUser

Request Body

application/json
schema UsersCreateScryptModifiedUserRequest
Property Type Required
name string optional
email string required
userId string required
password string required
passwordSalt string required
passwordSignerKey string required
passwordSaltSeparator string required

Responses

201

User

POST /users/scrypt-modified
POST /users/sha

Create a new user. Password provided must be hashed with the SHA algorithm. Use the POST /users endpoint to create users with a plain text password.

operationId: Users_createShaUser

Request Body

application/json
schema UsersCreateShaUserRequest
Property Type Required
name string optional
email string required
userId string required
password string required
passwordVersion string optional

Responses

201

User

POST /users/sha
POST /users/{userId}/sessions

Creates a session for a user. Returns an immediately usable session object.

If you want to generate a token for a custom authentication flow, use the POST /users/{userId}/tokens endpoint.

operationId: Users_createSession

Parameters

Name In Required Type Description
userId path required string

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

Responses

201

Session

POST /users/{userId}/sessions
POST /users/{userId}/targets

Create a messaging target.

operationId: Users_createTargetMessaging

Parameters

Name In Required Type Description
userId path required string

User ID.

Request Body

application/json
schema UsersCreateTargetMessagingRequest
Property Type Required
name string optional
targetId string required
identifier string required
providerId string optional
providerType string required

Responses

201

Target

POST /users/{userId}/targets
POST /users/{userId}/tokens

Returns a token 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/custom endpoint to complete the login process.

operationId: Users_createTokenSession

Parameters

Name In Required Type Description
userId path required string

User ID.

Request Body

application/json
schema UsersCreateTokenSessionRequest
Property Type Required
expire integer optional
length integer optional

Responses

201

Token

POST /users/{userId}/tokens

Schemas

object AccountBeginMfaVerificationRequest
{
  "type": "object",
  "required": [
    "factor"
  ],
  "properties": {
    "factor": {
      "enum": [
        "email",
        "phone",
        "totp",
        "recoverycode"
      ],
      "type": "string",
      "x-example": "email",
      "description": "Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.",
      "x-enum-keys": [],
      "x-enum-name": "AuthenticationFactor"
    }
  }
}
object AccountCompleteEmailVerificationRequest
{
  "type": "object",
  "required": [
    "userId",
    "secret"
  ],
  "properties": {
    "secret": {
      "type": "string",
      "x-example": "<SECRET>",
      "description": "Valid verification token."
    },
    "userId": {
      "type": "string",
      "x-example": "<USER_ID>",
      "description": "User ID."
    }
  }
}
object AccountCompleteMfaChallengeRequest
{
  "type": "object",
  "required": [
    "challengeId",
    "otp"
  ],
  "properties": {
    "otp": {
      "type": "string",
      "x-example": "<OTP>",
      "description": "Valid verification token."
    },
    "challengeId": {
      "type": "string",
      "x-example": "<CHALLENGE_ID>",
      "description": "ID of the challenge."
    }
  }
}
object AccountCompletePasswordRecoveryRequest
{
  "type": "object",
  "required": [
    "userId",
    "secret",
    "password"
  ],
  "properties": {
    "secret": {
      "type": "string",
      "x-example": "<SECRET>",
      "description": "Valid reset token."
    },
    "userId": {
      "type": "string",
      "x-example": "<USER_ID>",
      "description": "User ID."
    },
    "password": {
      "type": "string",
      "x-example": null,
      "description": "New user password. Must be between 8 and 256 chars."
    }
  }
}
object AccountConfirmPhoneVerificationRequest
{
  "type": "object",
  "required": [
    "userId",
    "secret"
  ],
  "properties": {
    "secret": {
      "type": "string",
      "x-example": "<SECRET>",
      "description": "Valid verification token."
    },
    "userId": {
      "type": "string",
      "x-example": "<USER_ID>",
      "description": "User ID."
    }
  }
}
object AccountCreateEmailPasswordSessionRequest
{
  "type": "object",
  "required": [
    "email",
    "password"
  ],
  "properties": {
    "email": {
      "type": "string",
      "x-example": "email@example.com",
      "description": "User email."
    },
    "password": {
      "type": "string",
      "x-example": "password",
      "description": "User password. Must be at least 8 chars."
    }
  }
}
object AccountCreateEmailTokenRequest
{
  "type": "object",
  "required": [
    "userId",
    "email"
  ],
  "properties": {
    "email": {
      "type": "string",
      "x-example": "email@example.com",
      "description": "User email."
    },
    "phrase": {
      "type": "boolean",
      "x-example": false,
      "description": "Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow."
    },
    "userId": {
      "type": "string",
      "x-example": "<USER_ID>",
      "description": "User 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."
    }
  }
}
object AccountCreateEmailVerificationRequest
{
  "type": "object",
  "required": [
    "url"
  ],
  "properties": {
    "url": {
      "type": "string",
      "x-example": "https://example.com",
      "description": "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](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API."
    }
  }
}
object AccountCreateMagicUrlTokenRequest
{
  "type": "object",
  "required": [
    "userId",
    "email"
  ],
  "properties": {
    "url": {
      "type": "string",
      "x-example": "https://example.com",
      "description": "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](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API."
    },
    "email": {
      "type": "string",
      "x-example": "email@example.com",
      "description": "User email."
    },
    "phrase": {
      "type": "boolean",
      "x-example": false,
      "description": "Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow."
    },
    "userId": {
      "type": "string",
      "x-example": "<USER_ID>",
      "description": "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."
    }
  }
}
object AccountCreateNewUserRequest
{
  "type": "object",
  "required": [
    "userId",
    "email",
    "password"
  ],
  "properties": {
    "name": {
      "type": "string",
      "x-example": "<NAME>",
      "description": "User name. Max length: 128 chars."
    },
    "email": {
      "type": "string",
      "x-example": "email@example.com",
      "description": "User email."
    },
    "userId": {
      "type": "string",
      "x-example": "<USER_ID>",
      "description": "User 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."
    },
    "password": {
      "type": "string",
      "x-example": null,
      "description": "New user password. Must be between 8 and 256 chars."
    }
  }
}
object AccountCreatePasswordRecoveryRequest
{
  "type": "object",
  "required": [
    "email",
    "url"
  ],
  "properties": {
    "url": {
      "type": "string",
      "x-example": "https://example.com",
      "description": "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](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API."
    },
    "email": {
      "type": "string",
      "x-example": "email@example.com",
      "description": "User email."
    }
  }
}
object AccountCreatePhoneTokenRequest
{
  "type": "object",
  "required": [
    "userId",
    "phone"
  ],
  "properties": {
    "phone": {
      "type": "string",
      "x-example": "+12065550100",
      "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212."
    },
    "userId": {
      "type": "string",
      "x-example": "<USER_ID>",
      "description": "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."
    }
  }
}
object AccountCreateTokenSessionRequest
{
  "type": "object",
  "required": [
    "userId",
    "secret"
  ],
  "properties": {
    "secret": {
      "type": "string",
      "x-example": "<SECRET>",
      "description": "Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods."
    },
    "userId": {
      "type": "string",
      "x-example": "<USER_ID>",
      "description": "User 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."
    }
  }
}
object AccountDeleteAuthenticatorByIdRequest
{
  "type": "object",
  "required": [
    "otp"
  ],
  "properties": {
    "otp": {
      "type": "string",
      "x-example": "<OTP>",
      "description": "Valid verification token."
    }
  }
}
object AccountUpdateEmailAddressRequest
{
  "type": "object",
  "required": [
    "email",
    "password"
  ],
  "properties": {
    "email": {
      "type": "string",
      "x-example": "email@example.com",
      "description": "User email."
    },
    "password": {
      "type": "string",
      "x-example": "password",
      "description": "User password. Must be at least 8 chars."
    }
  }
}
object AccountUpdateMagicUrlSessionRequest
{
  "type": "object",
  "required": [
    "userId",
    "secret"
  ],
  "properties": {
    "secret": {
      "type": "string",
      "x-example": "<SECRET>",
      "description": "Valid verification token."
    },
    "userId": {
      "type": "string",
      "x-example": "<USER_ID>",
      "description": "User 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."
    }
  }
}
object AccountUpdateMfaStatusRequest
{
  "type": "object",
  "required": [
    "mfa"
  ],
  "properties": {
    "mfa": {
      "type": "boolean",
      "x-example": false,
      "description": "Enable or disable MFA."
    }
  }
}
object AccountUpdateNameOperationRequest
{
  "type": "object",
  "required": [
    "name"
  ],
  "properties": {
    "name": {
      "type": "string",
      "x-example": "<NAME>",
      "description": "User name. Max length: 128 chars."
    }
  }
}
object AccountUpdatePasswordOperationRequest
{
  "type": "object",
  "required": [
    "password"
  ],
  "properties": {
    "password": {
      "type": "string",
      "x-example": null,
      "description": "New user password. Must be at least 8 chars."
    },
    "oldPassword": {
      "type": "string",
      "x-example": "password",
      "description": "Current user password. Must be at least 8 chars."
    }
  }
}
object AccountUpdatePhoneRequest
{
  "type": "object",
  "required": [
    "phone",
    "password"
  ],
  "properties": {
    "phone": {
      "type": "string",
      "x-example": "+12065550100",
      "description": "Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212."
    },
    "password": {
      "type": "string",
      "x-example": "password",
      "description": "User password. Must be at least 8 chars."
    }
  }
}
object AccountUpdatePhoneSessionRequest
{
  "type": "object",
  "required": [
    "userId",
    "secret"
  ],
  "properties": {
    "secret": {
      "type": "string",
      "x-example": "<SECRET>",
      "description": "Valid verification token."
    },
    "userId": {
      "type": "string",
      "x-example": "<USER_ID>",
      "description": "User 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."
    }
  }
}
object AccountUpdatePreferencesRequest
{
  "type": "object",
  "required": [
    "prefs"
  ],
  "properties": {
    "prefs": {
      "type": "object",
      "x-example": "{}",
      "description": "Prefs key-value JSON object."
    }
  }
}
object AccountVerifyAuthenticatorRequest
{
  "type": "object",
  "required": [
    "otp"
  ],
  "properties": {
    "otp": {
      "type": "string",
      "x-example": "<OTP>",
      "description": "Valid verification token."
    }
  }
}
object DatabasesCreateBooleanAttributeRequest
{
  "type": "object",
  "required": [
    "key",
    "required"
  ],
  "properties": {
    "key": {
      "type": "string",
      "x-example": null,
      "description": "Attribute Key."
    },
    "array": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute an array?"
    },
    "default": {
      "type": "boolean",
      "x-example": false,
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesCreateCollectionRequest
{
  "type": "object",
  "required": [
    "collectionId",
    "name"
  ],
  "properties": {
    "name": {
      "type": "string",
      "x-example": "<NAME>",
      "description": "Collection name. Max length: 128 chars."
    },
    "enabled": {
      "type": "boolean",
      "x-example": false,
      "description": "Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled."
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "x-example": "[\"read(\"any\")\"]",
      "description": "An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions)."
    },
    "collectionId": {
      "type": "string",
      "x-example": "<COLLECTION_ID>",
      "description": "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."
    },
    "documentSecurity": {
      "type": "boolean",
      "x-example": false,
      "description": "Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions)."
    }
  }
}
object DatabasesCreateDatabaseRequest
{
  "type": "object",
  "required": [
    "databaseId",
    "name"
  ],
  "properties": {
    "name": {
      "type": "string",
      "x-example": "<NAME>",
      "description": "Database name. Max length: 128 chars."
    },
    "enabled": {
      "type": "boolean",
      "x-example": false,
      "description": "Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled."
    },
    "databaseId": {
      "type": "string",
      "x-example": "<DATABASE_ID>",
      "description": "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."
    }
  }
}
object DatabasesCreateDatetimeAttributeRequest
{
  "type": "object",
  "required": [
    "key",
    "required"
  ],
  "properties": {
    "key": {
      "type": "string",
      "x-example": null,
      "description": "Attribute Key."
    },
    "array": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute an array?"
    },
    "default": {
      "type": "string",
      "x-example": null,
      "description": "Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesCreateDocumentRequest
{
  "type": "object",
  "required": [
    "documentId",
    "data"
  ],
  "properties": {
    "data": {
      "type": "object",
      "x-example": "{}",
      "description": "Document data as JSON object."
    },
    "documentId": {
      "type": "string",
      "x-example": "<DOCUMENT_ID>",
      "description": "Document 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."
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "x-example": "[\"read(\"any\")\"]",
      "description": "An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions)."
    }
  }
}
object DatabasesCreateEmailAttributeRequest
{
  "type": "object",
  "required": [
    "key",
    "required"
  ],
  "properties": {
    "key": {
      "type": "string",
      "x-example": null,
      "description": "Attribute Key."
    },
    "array": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute an array?"
    },
    "default": {
      "type": "string",
      "x-example": "email@example.com",
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesCreateEnumAttributeRequest
{
  "type": "object",
  "required": [
    "key",
    "elements",
    "required"
  ],
  "properties": {
    "key": {
      "type": "string",
      "x-example": null,
      "description": "Attribute Key."
    },
    "array": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute an array?"
    },
    "default": {
      "type": "string",
      "x-example": "<DEFAULT>",
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "elements": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "x-example": null,
      "description": "Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesCreateFloatAttributeRequest
{
  "type": "object",
  "required": [
    "key",
    "required"
  ],
  "properties": {
    "key": {
      "type": "string",
      "x-example": null,
      "description": "Attribute Key."
    },
    "max": {
      "type": "number",
      "x-example": null,
      "description": "Maximum value to enforce on new documents"
    },
    "min": {
      "type": "number",
      "x-example": null,
      "description": "Minimum value to enforce on new documents"
    },
    "array": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute an array?"
    },
    "default": {
      "type": "number",
      "x-example": null,
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesCreateIndexRequest
{
  "type": "object",
  "required": [
    "key",
    "type",
    "attributes"
  ],
  "properties": {
    "key": {
      "type": "string",
      "x-example": null,
      "description": "Index Key."
    },
    "type": {
      "enum": [
        "key",
        "fulltext",
        "unique"
      ],
      "type": "string",
      "x-example": "key",
      "description": "Index type.",
      "x-enum-keys": [],
      "x-enum-name": "IndexType"
    },
    "orders": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "x-example": null,
      "description": "Array of index orders. Maximum of 100 orders are allowed."
    },
    "attributes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "x-example": null,
      "description": "Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long."
    }
  }
}
object DatabasesCreateIntegerAttributeRequest
{
  "type": "object",
  "required": [
    "key",
    "required"
  ],
  "properties": {
    "key": {
      "type": "string",
      "x-example": null,
      "description": "Attribute Key."
    },
    "max": {
      "type": "integer",
      "x-example": null,
      "description": "Maximum value to enforce on new documents"
    },
    "min": {
      "type": "integer",
      "x-example": null,
      "description": "Minimum value to enforce on new documents"
    },
    "array": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute an array?"
    },
    "default": {
      "type": "integer",
      "x-example": null,
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesCreateIpAttributeRequest
{
  "type": "object",
  "required": [
    "key",
    "required"
  ],
  "properties": {
    "key": {
      "type": "string",
      "x-example": null,
      "description": "Attribute Key."
    },
    "array": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute an array?"
    },
    "default": {
      "type": "string",
      "x-example": null,
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesCreateRelationshipAttributeRequest
{
  "type": "object",
  "required": [
    "relatedCollectionId",
    "type"
  ],
  "properties": {
    "key": {
      "type": "string",
      "x-example": null,
      "description": "Attribute Key."
    },
    "type": {
      "enum": [
        "oneToOne",
        "manyToOne",
        "manyToMany",
        "oneToMany"
      ],
      "type": "string",
      "x-example": "oneToOne",
      "description": "Relation type",
      "x-enum-keys": [],
      "x-enum-name": "RelationshipType"
    },
    "twoWay": {
      "type": "boolean",
      "x-example": false,
      "description": "Is Two Way?"
    },
    "onDelete": {
      "enum": [
        "cascade",
        "restrict",
        "setNull"
      ],
      "type": "string",
      "x-example": "cascade",
      "description": "Constraints option",
      "x-enum-keys": [],
      "x-enum-name": "RelationMutate"
    },
    "twoWayKey": {
      "type": "string",
      "x-example": null,
      "description": "Two Way Attribute Key."
    },
    "relatedCollectionId": {
      "type": "string",
      "x-example": "<RELATED_COLLECTION_ID>",
      "description": "Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)."
    }
  }
}
object DatabasesCreateStringAttributeRequest
{
  "type": "object",
  "required": [
    "key",
    "size",
    "required"
  ],
  "properties": {
    "key": {
      "type": "string",
      "x-example": null,
      "description": "Attribute Key."
    },
    "size": {
      "type": "integer",
      "x-example": 1,
      "description": "Attribute size for text attributes, in number of characters."
    },
    "array": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute an array?"
    },
    "default": {
      "type": "string",
      "x-example": "<DEFAULT>",
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "encrypt": {
      "type": "boolean",
      "x-example": false,
      "description": "Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesCreateUrlAttributeRequest
{
  "type": "object",
  "required": [
    "key",
    "required"
  ],
  "properties": {
    "key": {
      "type": "string",
      "x-example": null,
      "description": "Attribute Key."
    },
    "array": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute an array?"
    },
    "default": {
      "type": "string",
      "x-example": "https://example.com",
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesGetAttributeByIdResponse
{
  "oneOf": [
    {
      "$ref": "#/components/schemas/attributeBoolean"
    },
    {
      "$ref": "#/components/schemas/attributeInteger"
    },
    {
      "$ref": "#/components/schemas/attributeFloat"
    },
    {
      "$ref": "#/components/schemas/attributeEmail"
    },
    {
      "$ref": "#/components/schemas/attributeEnum"
    },
    {
      "$ref": "#/components/schemas/attributeUrl"
    },
    {
      "$ref": "#/components/schemas/attributeIp"
    },
    {
      "$ref": "#/components/schemas/attributeDatetime"
    },
    {
      "$ref": "#/components/schemas/attributeRelationship"
    },
    {
      "$ref": "#/components/schemas/attributeString"
    }
  ]
}
object DatabasesUpdateBooleanAttributeRequest
{
  "type": "object",
  "required": [
    "required",
    "default"
  ],
  "properties": {
    "default": {
      "type": "boolean",
      "x-example": false,
      "x-nullable": true,
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesUpdateByIdRequest
{
  "type": "object",
  "required": [
    "name"
  ],
  "properties": {
    "name": {
      "type": "string",
      "x-example": "<NAME>",
      "description": "Database name. Max length: 128 chars."
    },
    "enabled": {
      "type": "boolean",
      "x-example": false,
      "description": "Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled."
    }
  }
}
object DatabasesUpdateCollectionByIdRequest
{
  "type": "object",
  "required": [
    "name"
  ],
  "properties": {
    "name": {
      "type": "string",
      "x-example": "<NAME>",
      "description": "Collection name. Max length: 128 chars."
    },
    "enabled": {
      "type": "boolean",
      "x-example": false,
      "description": "Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled."
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "x-example": "[\"read(\"any\")\"]",
      "description": "An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions)."
    },
    "documentSecurity": {
      "type": "boolean",
      "x-example": false,
      "description": "Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions)."
    }
  }
}
object DatabasesUpdateDatetimeAttributeRequest
{
  "type": "object",
  "required": [
    "required",
    "default"
  ],
  "properties": {
    "default": {
      "type": "string",
      "x-example": null,
      "x-nullable": true,
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesUpdateDocumentByIdRequest
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "x-example": "{}",
      "description": "Document data as JSON object. Include only attribute and value pairs to be updated."
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "x-example": "[\"read(\"any\")\"]",
      "description": "An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions)."
    }
  }
}
object DatabasesUpdateEmailAttributeRequest
{
  "type": "object",
  "required": [
    "required",
    "default"
  ],
  "properties": {
    "default": {
      "type": "string",
      "x-example": "email@example.com",
      "x-nullable": true,
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesUpdateEnumAttributeRequest
{
  "type": "object",
  "required": [
    "elements",
    "required",
    "default"
  ],
  "properties": {
    "default": {
      "type": "string",
      "x-example": "<DEFAULT>",
      "x-nullable": true,
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "elements": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "x-example": null,
      "description": "Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesUpdateFloatAttributeRequest
{
  "type": "object",
  "required": [
    "required",
    "min",
    "max",
    "default"
  ],
  "properties": {
    "max": {
      "type": "number",
      "x-example": null,
      "description": "Maximum value to enforce on new documents"
    },
    "min": {
      "type": "number",
      "x-example": null,
      "description": "Minimum value to enforce on new documents"
    },
    "default": {
      "type": "number",
      "x-example": null,
      "x-nullable": true,
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesUpdateIntegerAttributeRequest
{
  "type": "object",
  "required": [
    "required",
    "min",
    "max",
    "default"
  ],
  "properties": {
    "max": {
      "type": "integer",
      "x-example": null,
      "description": "Maximum value to enforce on new documents"
    },
    "min": {
      "type": "integer",
      "x-example": null,
      "description": "Minimum value to enforce on new documents"
    },
    "default": {
      "type": "integer",
      "x-example": null,
      "x-nullable": true,
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesUpdateIpAttributeRequest
{
  "type": "object",
  "required": [
    "required",
    "default"
  ],
  "properties": {
    "default": {
      "type": "string",
      "x-example": null,
      "x-nullable": true,
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}
object DatabasesUpdateRelationshipAttributeRequest
{
  "type": "object",
  "properties": {
    "onDelete": {
      "enum": [
        "cascade",
        "restrict",
        "setNull"
      ],
      "type": "string",
      "x-example": "cascade",
      "description": "Constraints option",
      "x-enum-keys": [],
      "x-enum-name": "RelationMutate"
    }
  }
}
object DatabasesUpdateStringAttributeRequest
{
  "type": "object",
  "required": [
    "required",
    "default"
  ],
  "properties": {
    "default": {
      "type": "string",
      "x-example": "<DEFAULT>",
      "x-nullable": true,
      "description": "Default value for attribute when not provided. Cannot be set when attribute is required."
    },
    "required": {
      "type": "boolean",
      "x-example": false,
      "description": "Is attribute required?"
    }
  }
}