Use the delete method to remove access to a specific file.

try {
  const fileId = 'file_id_here' // The ID of the file for which you want to remove access.
  const cid = 'content_identifier_here' // The content identifier (CID) for accessing the file.
  const accessInfo = {
    email: '[email protected]', // The email of the user to remove access from.
    deleteAll: true // (optional) Set to `true` to delete all access, or `false` to remove access for a specific user.
  }

  const deleteResult = await sdk.fileAccess.delete(
    fileId,
    cid,
    accessInfo
  )
  console.log('Access removed successfully.')
} catch (error) {
  console.error(error.message)
}

Params

  • fileId (string): The ID of the file for which you want to verify access.
  • cid (string): The content identifier (CID) for accessing the file.
  • accessInfo (object): An object containing the email of the user from whom you want to remove access and an optional deleteAll flag.

Required API Key Permission

  • Upload File