Skip to content
post

Create file token

Endpoint

posthttps://<REGION>.cloud.appwrite.io...s/buckets/{bucketId}/files/{fileId}

Description

Required scopes

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

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
string
Required

Body

string
Status
Content type
201
application/json

ResourceToken

Name
Type
Description
string
string
string
string
string
string
string
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 tokens = new sdk.Tokens(client);
const result = await tokens.createFileToken({
bucketId: '<BUCKET_ID>',
fileId: '<FILE_ID>',
expire: '2020-10-15T06:38:00.000+00:00', // optional
});