The Databases service allows you to create structured collections of documents, query and filter lists of documents, and manage an advanced set of read and write access permissions.
All data returned by the Databases service are represented as structured JSON documents.
The Databases service can contain multiple databases, each database can contain multiple collections. A collection is a group of similarly structured documents. The accepted structure of documents is defined by collection attributes. The collection attributes help you ensure all your user-submitted data is validated and stored according to the collection structure.
Using Appwrite permissions architecture, you can assign read or write access to each collection or document in your project for either a specific user, team, user role, or even grant it with public access (any
). You can learn more about how Appwrite handles permissions and access control.
https://<REGION>.cloud.appwrite.io/v1
Create boolean attribute
Create a boolean attribute.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
default boolean Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean Is attribute an array?
Response
202 application/json
POST /databases/{databaseId}/collections/{collectionId}/attributes/boolean
mutation {
databasesCreateBooleanAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false
) {
key
type
status
error
required
}
}
Create collection
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.
Request
databaseId string requiredDatabase ID.
collectionId string requiredUnique 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.name string requiredCollection name. Max length: 128 chars.
permissions array An array of permissions strings. By default, no user is granted with any permissions. Learn more about permissions.
documentSecurity boolean Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. Learn more about permissions.
enabled boolean 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.
Response
201 application/json
POST /databases/{databaseId}/collections
mutation {
databasesCreateCollection(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
name: "[NAME]"
) {
_id
_createdAt
_updatedAt
_permissions
databaseId
name
enabled
documentSecurity
attributes
indexes {
key
type
status
error
attributes
}
}
}
Create database
Create a new Database.
Request
databaseId string requiredUnique 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.name string requiredDatabase name. Max length: 128 chars.
enabled boolean 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.
Response
201 application/json
POST /databases
mutation {
databasesCreate(
databaseId: "[DATABASE_ID]",
name: "[NAME]"
) {
_id
name
_createdAt
_updatedAt
enabled
}
}
Create datetime attribute
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
default string Default value for the attribute in ISO 8601 format. Cannot be set when attribute is required.
array boolean Is attribute an array?
Response
202 application/json
POST /databases/{databaseId}/collections/{collectionId}/attributes/datetime
mutation {
databasesCreateDatetimeAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false
) {
key
type
status
error
required
format
}
}
Create document
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.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration. Make sure to define attributes before creating documents.
documentId string requiredDocument 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.data object requiredDocument data as JSON object.
permissions array An array of permissions strings. By default, only the current user is granted all permissions. Learn more about permissions.
Response
201 application/json
Rate limits
This endpoint is not limited when using Server SDKs with API keys. If you are using SSR with
setSession
, these rate limits will still apply. Learn more about SSR rate limits.The limit is applied for each unique limit key.
Time frameAttemptsKey1 minutes 120 requests IP + METHOD + URL + USER ID
POST /databases/{databaseId}/collections/{collectionId}/documents
mutation {
databasesCreateDocument(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
documentId: "[DOCUMENT_ID]",
data: "{}"
) {
_id
_collectionId
_databaseId
_createdAt
_updatedAt
_permissions
data
}
}
Create email attribute
Create an email attribute.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
default string Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean Is attribute an array?
Response
202 application/json
POST /databases/{databaseId}/collections/{collectionId}/attributes/email
mutation {
databasesCreateEmailAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false
) {
key
type
status
error
required
format
}
}
Create enum attribute
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
elements array requiredArray of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.
required boolean requiredIs attribute required?
default string Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean Is attribute an array?
Response
202 application/json
POST /databases/{databaseId}/collections/{collectionId}/attributes/enum
mutation {
databasesCreateEnumAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
elements: [],
required: false
) {
key
type
status
error
required
elements
format
}
}
Create float attribute
Create a float attribute. Optionally, minimum and maximum values can be provided.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
min number Minimum value to enforce on new documents
max number Maximum value to enforce on new documents
default number Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean Is attribute an array?
Response
202 application/json
POST /databases/{databaseId}/collections/{collectionId}/attributes/float
mutation {
databasesCreateFloatAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false
) {
key
type
status
error
required
}
}
Create index
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredIndex Key.
type string requiredIndex type.
attributes array requiredArray of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long.
orders array Array of index orders. Maximum of 100 orders are allowed.
Response
202 application/json
POST /databases/{databaseId}/collections/{collectionId}/indexes
mutation {
databasesCreateIndex(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
type: "key",
attributes: []
) {
key
type
status
error
attributes
}
}
Create integer attribute
Create an integer attribute. Optionally, minimum and maximum values can be provided.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
min integer Minimum value to enforce on new documents
max integer Maximum value to enforce on new documents
default integer Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean Is attribute an array?
Response
202 application/json
POST /databases/{databaseId}/collections/{collectionId}/attributes/integer
mutation {
databasesCreateIntegerAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false
) {
key
type
status
error
required
}
}
Create IP address attribute
Create IP address attribute.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
default string Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean Is attribute an array?
Response
202 application/json
POST /databases/{databaseId}/collections/{collectionId}/attributes/ip
mutation {
databasesCreateIpAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false
) {
key
type
status
error
required
format
}
}
Create relationship attribute
Create relationship attribute. Learn more about relationship attributes.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
relatedCollectionId string requiredRelated Collection ID. You can create a new collection using the Database service server integration.
type string requiredRelation type
twoWay boolean Is Two Way?
key string Attribute Key.
twoWayKey string Two Way Attribute Key.
onDelete string Constraints option
Response
202 application/json
POST /databases/{databaseId}/collections/{collectionId}/attributes/relationship
mutation {
databasesCreateRelationshipAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
relatedCollectionId: "[RELATED_COLLECTION_ID]",
type: "oneToOne"
) {
key
type
status
error
required
relatedCollection
relationType
twoWay
twoWayKey
onDelete
side
}
}
Create string attribute
Create a string attribute.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
size integer requiredAttribute size for text attributes, in number of characters.
required boolean requiredIs attribute required?
default string Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean Is attribute an array?
encrypt boolean Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried.
Response
202 application/json
POST /databases/{databaseId}/collections/{collectionId}/attributes/string
mutation {
databasesCreateStringAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
size: 1,
required: false
) {
key
type
status
error
required
size
}
}
Create URL attribute
Create a URL attribute.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
default string Default value for attribute when not provided. Cannot be set when attribute is required.
array boolean Is attribute an array?
Response
202 application/json
POST /databases/{databaseId}/collections/{collectionId}/attributes/url
mutation {
databasesCreateUrlAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false
) {
key
type
status
error
required
format
}
}
Get attribute
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
GET /databases/{databaseId}/collections/{collectionId}/attributes/{key}
query {
databasesGetAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: ""
) {
status
}
}
Get collection
Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID.
Response
200 application/json
GET /databases/{databaseId}/collections/{collectionId}
query {
databasesGetCollection(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]"
) {
_id
_createdAt
_updatedAt
_permissions
databaseId
name
enabled
documentSecurity
attributes
indexes {
key
type
status
error
attributes
}
}
}
Get database
Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.
Request
databaseId string requiredDatabase ID.
Response
200 application/json
GET /databases/{databaseId}
query {
databasesGet(
databaseId: "[DATABASE_ID]"
) {
_id
name
_createdAt
_updatedAt
enabled
}
}
Get document
Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
documentId string requiredDocument ID.
queries array Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Only method allowed is select.
Response
200 application/json
GET /databases/{databaseId}/collections/{collectionId}/documents/{documentId}
query {
databasesGetDocument(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
documentId: "[DOCUMENT_ID]"
) {
_id
_collectionId
_databaseId
_createdAt
_updatedAt
_permissions
data
}
}
Get index
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredIndex Key.
Response
200 application/json
GET /databases/{databaseId}/collections/{collectionId}/indexes/{key}
query {
databasesGetIndex(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: ""
) {
key
type
status
error
attributes
}
}
List attributes
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
queries array Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, size, required, array, status, error
Response
200 application/json
GET /databases/{databaseId}/collections/{collectionId}/attributes
query {
databasesListAttributes(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]"
) {
total
attributes
}
}
List collections
Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.
Request
databaseId string requiredDatabase ID.
queries array Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, documentSecurity
search string Search term to filter your list results. Max length: 256 chars.
Response
200 application/json
GET /databases/{databaseId}/collections
query {
databasesListCollections(
databaseId: "[DATABASE_ID]"
) {
total
collections {
_id
_createdAt
_updatedAt
_permissions
databaseId
name
enabled
documentSecurity
attributes
indexes {
key
type
status
error
attributes
}
}
}
}
List databases
Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.
Request
queries array Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name
search string Search term to filter your list results. Max length: 256 chars.
Response
200 application/json
GET /databases
query {
databasesList {
total
databases {
_id
name
_createdAt
_updatedAt
enabled
}
}
}
List documents
Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
queries array Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long.
Response
200 application/json
GET /databases/{databaseId}/collections/{collectionId}/documents
query {
databasesListDocuments(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]"
) {
total
documents {
_id
_collectionId
_databaseId
_createdAt
_updatedAt
_permissions
data
}
}
}
List indexes
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
queries array Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key, type, status, attributes, error
Response
200 application/json
GET /databases/{databaseId}/collections/{collectionId}/indexes
query {
databasesListIndexes(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]"
) {
total
indexes {
key
type
status
error
attributes
}
}
}
Update boolean attribute
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
default boolean requiredDefault value for attribute when not provided. Cannot be set when attribute is required.
Response
200
PATCH /databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}
mutation {
databasesUpdateBooleanAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false,
default: false
) {
key
type
status
error
required
}
}
Update collection
Update a collection by its unique ID.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID.
name string requiredCollection name. Max length: 128 chars.
permissions array An array of permission strings. By default, the current permissions are inherited. Learn more about permissions.
documentSecurity boolean Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. Learn more about permissions.
enabled boolean 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.
Response
200 application/json
PUT /databases/{databaseId}/collections/{collectionId}
mutation {
databasesUpdateCollection(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
name: "[NAME]"
) {
_id
_createdAt
_updatedAt
_permissions
databaseId
name
enabled
documentSecurity
attributes
indexes {
key
type
status
error
attributes
}
}
}
Update database
Update a database by its unique ID.
Request
databaseId string requiredDatabase ID.
name string requiredDatabase name. Max length: 128 chars.
enabled boolean 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.
Response
200 application/json
PUT /databases/{databaseId}
mutation {
databasesUpdate(
databaseId: "[DATABASE_ID]",
name: "[NAME]"
) {
_id
name
_createdAt
_updatedAt
enabled
}
}
Update dateTime attribute
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
default string requiredDefault value for attribute when not provided. Cannot be set when attribute is required.
Response
200
PATCH /databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}
mutation {
databasesUpdateDatetimeAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false,
default: ""
) {
key
type
status
error
required
format
}
}
Update document
Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID.
documentId string requiredDocument ID.
data object Document data as JSON object. Include only attribute and value pairs to be updated.
permissions array An array of permissions strings. By default, the current permissions are inherited. Learn more about permissions.
Response
200 application/json
Rate limits
This endpoint is not limited when using Server SDKs with API keys. If you are using SSR with
setSession
, these rate limits will still apply. Learn more about SSR rate limits.The limit is applied for each unique limit key.
Time frameAttemptsKey1 minutes 120 requests IP + METHOD + URL + USER ID
PATCH /databases/{databaseId}/collections/{collectionId}/documents/{documentId}
mutation {
databasesUpdateDocument(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
documentId: "[DOCUMENT_ID]"
) {
_id
_collectionId
_databaseId
_createdAt
_updatedAt
_permissions
data
}
}
Update email attribute
Update an email attribute. Changing the default
value will not update already existing documents.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
default string requiredDefault value for attribute when not provided. Cannot be set when attribute is required.
Response
200
PATCH /databases/{databaseId}/collections/{collectionId}/attributes/email/{key}
mutation {
databasesUpdateEmailAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false,
default: "email@example.com"
) {
key
type
status
error
required
format
}
}
Update enum attribute
Update an enum attribute. Changing the default
value will not update already existing documents.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
elements array requiredArray of elements in enumerated type. Uses length of longest element to determine size. Maximum of 100 elements are allowed, each 255 characters long.
required boolean requiredIs attribute required?
default string requiredDefault value for attribute when not provided. Cannot be set when attribute is required.
Response
200
PATCH /databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}
mutation {
databasesUpdateEnumAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
elements: [],
required: false,
default: "[DEFAULT]"
) {
key
type
status
error
required
elements
format
}
}
Update float attribute
Update a float attribute. Changing the default
value will not update already existing documents.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
min number requiredMinimum value to enforce on new documents
max number requiredMaximum value to enforce on new documents
default number requiredDefault value for attribute when not provided. Cannot be set when attribute is required.
Response
200
PATCH /databases/{databaseId}/collections/{collectionId}/attributes/float/{key}
mutation {
databasesUpdateFloatAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false,
min: 0,
max: 0,
default: 0
) {
key
type
status
error
required
}
}
Update integer attribute
Update an integer attribute. Changing the default
value will not update already existing documents.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
min integer requiredMinimum value to enforce on new documents
max integer requiredMaximum value to enforce on new documents
default integer requiredDefault value for attribute when not provided. Cannot be set when attribute is required.
Response
200
PATCH /databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}
mutation {
databasesUpdateIntegerAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false,
min: 0,
max: 0,
default: 0
) {
key
type
status
error
required
}
}
Update IP address attribute
Update an ip attribute. Changing the default
value will not update already existing documents.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
default string requiredDefault value for attribute when not provided. Cannot be set when attribute is required.
Response
200
PATCH /databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}
mutation {
databasesUpdateIpAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false,
default: ""
) {
key
type
status
error
required
format
}
}
Update relationship attribute
Update relationship attribute. Learn more about relationship attributes.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
onDelete string Constraints option
Response
200
PATCH /databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship
mutation {
databasesUpdateRelationshipAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: ""
) {
key
type
status
error
required
relatedCollection
relationType
twoWay
twoWayKey
onDelete
side
}
}
Update string attribute
Update a string attribute. Changing the default
value will not update already existing documents.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
default string requiredDefault value for attribute when not provided. Cannot be set when attribute is required.
Response
200
PATCH /databases/{databaseId}/collections/{collectionId}/attributes/string/{key}
mutation {
databasesUpdateStringAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false,
default: "[DEFAULT]"
) {
key
type
status
error
required
size
}
}
Update URL attribute
Update an url attribute. Changing the default
value will not update already existing documents.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
required boolean requiredIs attribute required?
default string requiredDefault value for attribute when not provided. Cannot be set when attribute is required.
Response
200
PATCH /databases/{databaseId}/collections/{collectionId}/attributes/url/{key}
mutation {
databasesUpdateUrlAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: "",
required: false,
default: "https://example.com"
) {
key
type
status
error
required
format
}
}
Delete attribute
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredAttribute Key.
Response
204 no content
DELETE /databases/{databaseId}/collections/{collectionId}/attributes/{key}
mutation {
databasesDeleteAttribute(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: ""
) {
status
}
}
Delete collection
Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID.
Response
204 no content
DELETE /databases/{databaseId}/collections/{collectionId}
mutation {
databasesDeleteCollection(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]"
) {
status
}
}
Delete database
Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.
Request
databaseId string requiredDatabase ID.
Response
204 no content
DELETE /databases/{databaseId}
mutation {
databasesDelete(
databaseId: "[DATABASE_ID]"
) {
status
}
}
Delete document
Delete a document by its unique ID.
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
documentId string requiredDocument ID.
Response
204 no content
Rate limits
This endpoint is not limited when using Server SDKs with API keys. If you are using SSR with
setSession
, these rate limits will still apply. Learn more about SSR rate limits.The limit is applied for each unique limit key.
Time frameAttemptsKey1 minutes 60 requests IP + METHOD + URL + USER ID
DELETE /databases/{databaseId}/collections/{collectionId}/documents/{documentId}
mutation {
databasesDeleteDocument(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
documentId: "[DOCUMENT_ID]"
) {
status
}
}
Delete index
Request
databaseId string requiredDatabase ID.
collectionId string requiredCollection ID. You can create a new collection using the Database service server integration.
key string requiredIndex Key.
Response
204 no content
DELETE /databases/{databaseId}/collections/{collectionId}/indexes/{key}
mutation {
databasesDeleteIndex(
databaseId: "[DATABASE_ID]",
collectionId: "[COLLECTION_ID]",
key: ""
) {
status
}
}