Skip to content
v2.7

Tokens

File sharing links (tokens with an expiry).

File sharing links (tokens with an expiry).

Class Tokens: 5 methods (0 in @owbase/web, 5 in @owbase/node). The examples use the object form of the parameters; replace the values between < and > with your own.

List tokens

GET /tokens/buckets/{bucketId}/files/{fileId} · method page

SDK: @owbase/node only

List all the tokens created for a specific file or bucket. You can use the query params to filter your results.

Parameter Type Required Description
bucketId string yes Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.
fileId string yes File unique ID.
queries string[] no Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: expire
total boolean no When set to false, the total count returned will be 0 and will not be calculated.

Access: API key with the tokens.read scope.

@owbase/node
import { Client, Tokens } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const tokens = new Tokens(client);
const result = await tokens.list({
bucketId: '<BUCKET_ID>',
fileId: '<FILE_ID>',
queries: [], // optional
total: false, // optional
});

Create file token

POST /tokens/buckets/{bucketId}/files/{fileId} · method page

SDK: @owbase/node only

Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter.

Parameter Type Required Description
bucketId string yes Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.
fileId string yes File unique ID.
expire string no Token expiry date

Access: API key with the tokens.write scope.

@owbase/node
import { Client, Tokens } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const tokens = new Tokens(client);
const result = await tokens.createFileToken({
bucketId: '<BUCKET_ID>',
fileId: '<FILE_ID>',
expire: '2020-10-15T06:38:00.000+00:00', // optional
});

Get token

GET /tokens/{tokenId} · method page

SDK: @owbase/node only

Get a token by its unique ID.

Parameter Type Required Description
tokenId string yes Token ID.

Access: API key with the tokens.read scope.

@owbase/node
import { Client, Tokens } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const tokens = new Tokens(client);
const result = await tokens.get({
tokenId: '<TOKEN_ID>',
});

Update token

PATCH /tokens/{tokenId} · method page

SDK: @owbase/node only

Update a token by its unique ID. Use this endpoint to update a token’s expiry date.

Parameter Type Required Description
tokenId string yes Token unique ID.
expire string no File token expiry date

Access: API key with the tokens.write scope.

@owbase/node
import { Client, Tokens } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const tokens = new Tokens(client);
const result = await tokens.update({
tokenId: '<TOKEN_ID>',
expire: '2020-10-15T06:38:00.000+00:00', // optional
});

Delete token

DELETE /tokens/{tokenId} · method page

SDK: @owbase/node only

Delete a token by its unique ID.

Parameter Type Required Description
tokenId string yes Token ID.

Access: API key with the tokens.write scope.

@owbase/node
import { Client, Tokens } from '@owbase/node';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>') // Your project ID
.setKey('<YOUR_API_KEY>'); // Your secret API key
const tokens = new Tokens(client);
const result = await tokens.delete({
tokenId: '<TOKEN_ID>',
});

The descriptions on this page come from the server API specification (BSD-3-Clause license), and the examples come from the SDK generator (MIT license). The full notices are in the NOTICE file of the @owbase/web and @owbase/node packages.

Was this page helpful?