Docs
Skip to content
post

Create bucket

Endpoint

posthttps://<REGION>.cloud.appwrite.io/v1/storage/buckets

Description

Required scopes

buckets.write

Authentication

Initialize the Appwrite client with setProject() and a server API key (setKey()). For direct REST calls, send X-Appwrite-Project and X-Appwrite-Key.

Parameters

string
Required
string
Required
array
boolean
boolean
integer
array
enum
boolean
boolean
boolean
Status
Content type
201
application/json

Bucket

Name
Type
Description
string
string
string
arrayof string
boolean
string
boolean
integer
arrayof string
string
boolean
boolean
boolean
integer
JavaScript
const sdk = require('node-appwrite');
const client = new sdk.Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const storage = new sdk.Storage(client);
const result = await storage.createBucket({
bucketId: '<BUCKET_ID>',
name: '<NAME>',
permissions: [sdk.Permission.read(sdk.Role.any())], // optional
fileSecurity: false, // optional
enabled: false, // optional
maximumFileSize: 1, // optional
allowedFileExtensions: [], // optional
compression: sdk.Compression.None, // optional
encryption: false, // optional
antivirus: false, // optional
transformations: false // optional
});