Use the update method to modify access settings for a specific file.

try {
  const fileId = 'file_id_here' // The ID of the file for which you want to modify access settings.
  const cid = 'content_identifier_here' // The content identifier (CID) for accessing the file.
  const accessSettings = {
    secureSharing: 'PUBLIC' // The desired access setting: 'PUBLIC', 'PASSWORD', or 'RESTRICTED'.
  }

  const updateResult = await sdk.fileAccess.update(
    fileId,
    cid,
    accessSettings
  )
  console.log('Access settings updated 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.
  • accessSettings (object): An object containing the desired access setting (secureSharing can be 'PUBLIC', 'PASSWORD', or 'RESTRICTED').

Required API Key Permission

  • Upload File