Docs
Skip to content
post

Create file

Endpoint

posthttps://<REGION>.cloud.appwrite.io/v1/storage/buckets/{bucketId}/files

Description

Required scopes

files.write

Authentication

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

Rate limit

Up to 60 requests per minute for each IP address calling this endpoint.
Server API key requests bypass this rate limit.

Path

string
Required

Body

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

File

Name
Type
Description
string
string
string
string
arrayof string
string
string
string
integer
integer
integer
integer
boolean
string
JavaScript
import { Client, Storage, Permission, Role } from "appwrite";
const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const storage = new Storage(client);
const result = await storage.createFile({
bucketId: '<BUCKET_ID>',
fileId: '<FILE_ID>',
file: document.getElementById('uploader').files[0],
permissions: [Permission.read(Role.any())] // optional
});
console.log(result);