v1.27.1
OAS 3.0.0

Tusky API

Decentralized file system build on Walrus (SUI blockchain).




Authorization

Tusky authenticates your API requests using your account’s API keys. If a request doesn’t include a valid key or it includes a deleted or expired key, Tusky returns an HTTP 401 status.

Use the Tusky App to create or delete your API keys. To access your API keys, select the API Keys tab in your Account.




Pagination

Some top-level API resources have support for bulk fetches through HTTP GET API requests. For example, you can list file system entities: vaults, folders, files. These list API methods share a common structure and accept, the following parameters: limit, nextToken. Response structure is same for those paginated methods, containing two top-level attributes: items, nextToken.

Both parameters are optional. Omitted limit defaults to 100. Omitted nextToken defaults to first “page” with default API method’s sort considered.

Tusky’s paginated API methods use cursor-based pagination through the nextToken parameter. This means you can only go to the next “page” of items, not to the previous.

For example fetching files in folder would go like: GET /files?parentId=xyz

Such HTTP call is requesting first 100 (default limit) files which are contained in folder with identifier equal to xyz. Response to such request will contain JSON body with:

  • items: list of sorted (by default sort key = updatedAt) file entries, possibly empty if no files found in given folder.

  • nextToken: next page cursor, possibly empty if there are less than 100 files in xyz folder.




Error codes

Tusky uses conventional HTTP response codes to indicate the success or failure of an API request. In general:

  • codes in the 2xx range indicate success.

  • codes in the 4xx range indicate client side error - missing or invalid parameter (e.g. trying to delete vault that is not empty; trying to permanently delete folder that is not in trash).

  • codes in the 5xx range indicate an error with Tusky’s servers - these are rare, retryable and can be reported to Tusky’s support.




Request IDs

Each API request has an associated request identifier. You can find this value in the response headers, under Request-Id.

In case of any issues encountered, to speed up the resolution process, provide the request identifier when you contact us about a specific request.




TLDR

Here is how you can upload files to Tusky:

First, setup your account at https://app.tusky.io & generate API key

Then create vault:

const response = await fetch('https://api.tusky.io/vaults', {
  method: 'POST',
  headers: {
    'Api-Key': 'YOUR_API_KEY',
  },
  body: {
    name: 'Vaulty vault',
  },
});

const vault = await response.json();

Ready to upload files!

Tusky implements tus.io - a magnificent HTTP protocol for resumable file uploads. There are many SDKs out there, both officially supported by tus.io and from community. We recommend using one of those.

npm i tus-js-client
const fileStats = fs.statSync('YOUR_FILE_PATH');
const fileSize = fileStats.size;
const fileName = filePath.split('/').pop();
const fileStream = fs.createReadStream(filePath);

const upload = new tus.Upload(fileStream, {
  endpoint: endpoint,
  headers: {
    'Api-Key': 'YOUR_API_KEY',
  },
  metadata: {
    filename: fileName,
    filetype: 'text/plain', // Adjust according to your file type
    vaultId: vault.id,
  },
  onError: error => {
    console.error('Upload failed:', error.message);
  },
  onProgress: (bytesUploaded, bytesTotal) => {
    const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2);
    console.log(`Progress: ${percentage}% (${bytesUploaded}/${bytesTotal} bytes)`);
  },
  onSuccess: () => {
    console.log('Upload completed successfully!');
  },
});

upload.start();
Server: https://api.tusky.io
Client Libraries

Vaults (Collapsed)

Somewhat similar to a drive in classical file systems. You can store your files here.

Vaults are shareable sets of files and folders. You may share your vault by adding a member with defined role. Members can be viewers or contributors with assigned storage limits.

There is no storage limit on your vault. The limit exists but it's tied to your account - see Storage resource.

API supprts encrypted vaults. Those are end-to-end encrypted with your own keys - all files metadata, binaries, folders, even the vault metadata itself is encrypted. Those are great for data you want to keep private but decentralized. Use Tusky's SDK to manage your encrypted vaults.

Files

Same as in your local file systems, Tusky has files. Tusky's file is a pointer to Walrus blob, keeping replica of:

  • blobId - Walrus blob's unique indentifier. No two blobs on Walrus may have same blobId. You may retrieve file binary over any Walrus aggregator with your blobId.

  • storedEpoch - epoch is a unit of time in which Walrus storage nodes operate in. This attribute says when the file was stored on the network.

  • certifiedEpoch - epoch when the file was certified by the network. This is a moment when a corresponding transaction was finalized and considered valid by the Sui blockchain.

  • ref - reference SUI transaction.

  • erasureCodeType - specifies the algorithm or scheme used for encoding and distributing data in the Walrus system.

Uploading file is done by /uploads endpoint.

You may query your files by vaultId, parentId (direct parent of files, can be folder or vault) or by default owner - you.

Lists files

This operation returns a maximum of 1000 file entries and defaults to 100 if limit is not provided. Use the limit and nextToken parameters to paginate. You can query by container using the parentId or vaultId parameters.

Query Parameters
  • vaultId
    Type:string Format: uuid
  • parentId
    Type:string Format: uuid
  • uploadId
    Type:string Format: uuid
  • status
    Type:string enum
    • active
    • revoked
    • deleted
  • limit
    Type:number
    min: 
    1
    max: 
    1000
  • nextToken
    Type:string
  • Responses
    Request Example forGET/files
    curl https://api.tusky.io/files
    
    []

    Accounts (Collapsed)

    Account data read/write.

    Not much to see here for now but it will grow.

    Home of Tusky's account specific settings.

    Api Keys (Collapsed)

    API keys are long lived tokens tied to your account. Tusky's API validates requests using them.

    You can generate, revoke, and list yours here.

    Keep them safe, otherwise you may find some additional files in your vaults one day.

    Subscriptions (Collapsed)

    Recurring payment plans that grant access to premium features and services.

    You may need those if long term storage is required. Tusky will keep your files alive on decentralized network when you're subscribed.

    Models