Create file token
Endpoint
posthttps://<REGION>.cloud.appwrite.io...s/buckets/{bucketId}/files/{fileId}
Description
Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
Required scopes
Authentication
setProject() and a server API key (setKey()). For direct REST calls, send X-Appwrite-Project and X-Appwrite-Key.Rate limit
Path
Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.
File unique ID.
Body
Token expiry date
ResourceToken
Token ID.
Token creation date in ISO 8601 format.
Resource ID.
Resource type.
Token expiration date in ISO 8601 format.
JWT encoded string.
Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours.
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});Tokens
files
tokens
Create file token
Endpoint
posthttps://<REGION>.cloud.appwrite.io...s/buckets/{bucketId}/files/{fileId}
Description
Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.
Required scopes
Authentication
setProject() and a server API key (setKey()). For direct REST calls, send X-Appwrite-Project and X-Appwrite-Key.Rate limit
Path
Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.
File unique ID.
Body
Token expiry date
ResourceToken
Token ID.
Token creation date in ISO 8601 format.
Resource ID.
Resource type.
Token expiration date in ISO 8601 format.
JWT encoded string.
Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours.
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});