Use the add method to enable file protection via password or invite-only via emails.

try {
  const fileId = 'file_id_here' // The ID of the file to grant access to.
  const cid = 'content_identifier_here' // The CID for acccessing the file.
  const accessInfo = {
    email: '[email protected]', // The email of the user you want to grant access to (optional).
    password: 'access_password' // The password to access the file (optional).

  const result = await sdk.fileAccess.add(fileId, cid, accessInfo)
  console.log(`Access granted to file ID ${fileId} with CID ${cid}`)
} catch (error) {


  • fileId (string): The ID of the file you want to grant access to.
  • cid (string): The content identifier (CID) for accessing the file.
  • accessInfo (object): An object containing access information, including an optional email and password.

Required API Key Permission

  • Upload File