Skip to content

Databases

CLIENT

The Databases service allows you to create structured tables of rows, query and filter lists of rows, and manage an advanced set of read and write access permissions.

All data returned by the Databases service are represented as structured JSON rows.

The Databases service can contain multiple databases, each database can contain multiple tables. A table is a group of similarly structured rows. The accepted structure of rows is defined by table columns. The table columns help you ensure all your user-submitted data is validated and stored according to the table structure.

Using Appwrite permissions architecture, you can assign read or write access to each table or row 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.

Base URL
https://<REGION>.cloud.appwrite.io/v1

Get document

Get a document by its unique ID. This endpoint response returns a JSON object with the document data.

  • Request
    • databaseId string
      required

      Database ID.

    • collectionId string
      required

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

    • documentId string
      required

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

  • Response
Endpoint
GET /databases/{databaseId}/collections/{collectionId}/documents/{documentId}
REST
GET /v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId} HTTP/1.1
Host: cloud.appwrite.io
X-Appwrite-Response-Format: 1.6.0
X-Appwrite-Project: <YOUR_PROJECT_ID>
X-Appwrite-Session: 
X-Appwrite-JWT: <YOUR_JWT>

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
      required

      Database ID.

    • collectionId string
      required

      Collection 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
Endpoint
GET /databases/{databaseId}/collections/{collectionId}/documents
REST
GET /v1/databases/{databaseId}/collections/{collectionId}/documents HTTP/1.1
Host: cloud.appwrite.io
X-Appwrite-Response-Format: 1.6.0
X-Appwrite-Project: <YOUR_PROJECT_ID>
X-Appwrite-Session: 
X-Appwrite-JWT: <YOUR_JWT>

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
      required

      Database ID.

    • collectionId string
      required

      Collection ID.

    • documentId string
      required

      Document ID.

    • data object

      Document data as JSON object. Include only attribute and value pairs to be updated.

  • Response
  • Rate limits

    This endpoint is rate limited. You can only make a limited number of request to his endpoint within a specific time frame.

    The limit is applied for each unique limit key.

    Time frame
    Attempts
    Key
    1 minutes120 requestsIP + METHOD + URL + USER ID
Endpoint
PATCH /databases/{databaseId}/collections/{collectionId}/documents/{documentId}
REST
PATCH /v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId} HTTP/1.1
Host: cloud.appwrite.io
Content-Type: application/json
X-Appwrite-Response-Format: 1.6.0
X-Appwrite-Project: <YOUR_PROJECT_ID>
X-Appwrite-Session: 
X-Appwrite-JWT: <YOUR_JWT>

{
  "data": {},
  "permissions": ["read(\"any\")"]
}

Delete document

Delete a document by its unique ID.

  • Request
    • databaseId string
      required

      Database ID.

    • collectionId string
      required

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

    • documentId string
      required

      Document ID.

  • Response
    • 204 no content
  • Rate limits

    This endpoint is rate limited. You can only make a limited number of request to his endpoint within a specific time frame.

    The limit is applied for each unique limit key.

    Time frame
    Attempts
    Key
    1 minutes60 requestsIP + METHOD + URL + USER ID
Endpoint
DELETE /databases/{databaseId}/collections/{collectionId}/documents/{documentId}
REST
DELETE /v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId} HTTP/1.1
Host: cloud.appwrite.io
Content-Type: application/json
X-Appwrite-Response-Format: 1.6.0
X-Appwrite-Project: <YOUR_PROJECT_ID>
X-Appwrite-Session: 
X-Appwrite-JWT: <YOUR_JWT>