Skip to content
post

Create Document

Endpoint

posthttps://<REGION>.cloud.appwrite.io...ollections/{collectionId}/documents

Description

Required scopes

documents.write

Authentication

Initialize the Appwrite client with setProject() and ensure the user is signed in. The SDK sends the session header automatically after login.

Path

string
Required
string
Required

Body

string
Required
object
Required
array
array
Status
Content type
201
application/json

Document

Name
Type
Description
string
string
integer
integer
arrayof string
arrayof string
Swift
import Appwrite
func main() async throws {
let client = Client()
.setEndpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
.setProject("5df5acd0d48c2") // Your project ID
let databases = Databases(client, "[DATABASE_ID]")
let document = try await databases.createDocument(
collectionId: "[COLLECTION_ID]",
documentId: "[DOCUMENT_ID]",
data: [:]
)
print(String(describing: document)
}