Appwrite
  1. database
Appwrite
  • account
    • Delete Account
      DELETE
    • Get Account
      GET
    • Create Account
      POST
    • Update Account Email
      PATCH
    • Create Account JWT
      POST
    • Get Account Logs
      GET
    • Update Account Name
      PATCH
    • Update Account Password
      PATCH
    • Get Account Preferences
      GET
    • Update Account Preferences
      PATCH
    • Create Password Recovery
      POST
    • Complete Password Recovery
      PUT
    • Delete All Account Sessions
      DELETE
    • Get Account Sessions
      GET
    • Create Account Session
      POST
    • Create Anonymous Session
      POST
    • Create Account Session with OAuth2
      GET
    • Delete Account Session
      DELETE
    • Get Session By ID
      GET
    • Create Email Verification
      POST
    • Complete Email Verification
      PUT
  • avatars
    • Get Browser Icon
      GET
    • Get Credit Card Icon
      GET
    • Get Favicon
      GET
    • Get Country Flag
      GET
    • Get Image from URL
      GET
    • Get User Initials
      GET
    • Get QR Code
      GET
  • database
    • List Documents
      GET
    • Create Document
      POST
    • Delete Document
      DELETE
    • Get Document
      GET
    • Update Document
      PATCH
  • functions
    • List Executions
    • Create Execution
    • Get Execution
  • locale
    • Get User Locale
    • List Continents
    • List Countries
    • List EU Countries
    • List Countries Phone Codes
    • List Currencies
    • List Languages
  • storage
    • List Files
    • Create File
    • Delete File
    • Get File
    • Update File
    • Get File for Download
    • Get File Preview
    • Get File for View
  • teams
    • List Teams
    • Create Team
    • Delete Team
    • Get Team
    • Update Team
    • Get Team Memberships
    • Create Team Membership
    • Delete Team Membership
    • Update Membership Roles
    • Update Team Membership Status
  1. database

Create Document

POST
/database/collections/{collectionId}/documents
database
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 Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://appwrite.io/v1/database/collections//documents' \
--header 'Content-Type: application/json' \
--data-raw '{
    "data": {},
    "parentDocument": "string",
    "parentProperty": "string",
    "parentPropertyType": "string",
    "read": [
        "string"
    ],
    "write": [
        "string"
    ]
}'
Response Response Example
{
    "$collection": "string",
    "$id": "string",
    "$permissions": {}
}

Request

Path Params
collectionId
string 
required
Collection unique ID. You can create a new collection with validation rules using the Database service server integration.
Body Params application/json
data
object 
required
Document data as JSON object.
parentDocument
string 
optional
Parent document unique ID. Use when you want your new document to be a child of a parent document.
parentProperty
string 
optional
Parent document property name. Use when you want your new document to be a child of a parent document.
parentPropertyType
string 
optional
Parent document property connection type. You can set this value to assign, append or prepend, default value is assign. Use when you want your new document to be a child of a parent document.
read
array[string]
optional
An array of strings with read permissions. By default only the current user is granted with read permissions. learn more about permissions and get a full list of available permissions.
write
array[string]
optional
An array of strings with write permissions. By default only the current user is granted with write permissions. learn more about permissions and get a full list of available permissions.
Examples

Responses

🟢201Document
application/json
Body
Document
$collection
string 
required
Collection ID.
$id
string 
required
Document ID.
$permissions
object 
required
Document permissions.
Additional properties
integer  | number  | string  | boolean 
optional
Modified at 2023-08-16 07:28:13
Previous
List Documents
Next
Delete Document
Built with