Box Developer Documentation

Join BoxWorks 2024 to discover what's possible with content and AI!

Register now!

Remove Shared Link

Remove Shared Link

A shared link may be removed from a resource by calling the update file or update folder or update weblink endpoint and setting the shared_link value to null.

If you delete the shared link and create a new one, the new shared link will have a different URL and users with the old URL will not be able to access the resource.

To remove a shared link on a file, specify the ID of file to set the shared_link field to null.

cURL
curl -i -X PUT "https://api.box.com/2.0/files/32423234?fields=shared_link" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -d '{
       "shared_link": null
     }'
Java
BoxFile file = new BoxFile(api, "12345");
BoxFile.Info info = file.getInfo();
info.removeSharedLink();
file.updateInfo(info);
Python
file_id = '11111'
client.file(file_id).remove_shared_link()
Node
client.files.update('12345', {
  shared_link: null
}).then(file => {
  // ...
})
iOS
client.files.deleteSharedLink(fileId: "11111") { (result: Result<Void, BoxSDKError>) in
    guard case .success = result else {
        print("Error removing file shared link")
        return
    }

    print("File shared link removed")
}

To remove a shared link on a folder, specify the ID of folder to set the shared_link field to null.

cURL
curl -i -X PUT "https://api.box.com/2.0/folders/32423234?fields=shared_link" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -d '{
       "shared_link": null
     }'
Java
BoxFolder folder = new BoxFolder(api, "12345");
BoxFolder.Info info = folder.getInfo();
info.removeSharedLink();
folder.updateInfo(info);
Python
folder_id = '11111'
client.folder(folder_id).remove_shared_link()
Node
client.folders.update('12345', {
  shared_link: null
}).then(folder => {
  // ...
})
iOS
client.folders.deleteSharedLink(forFolder: "11111") { (result: Result<Void, BoxSDKError>) in
    guard case .success = result else {
        print("Error removing folder shared link")
        return
    }

    print("Folder shared link removed")
}

To remove a shared link on a web link, specify the ID of web link to set the shared_link field to null.

cURL
curl -i -X PUT "https://api.box.com/2.0/web_links/32423234?fields=shared_link" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -d '{
       "shared_link": null
     }'
Python
client.web_link('12345').remove_shared_link()
.NET
BoxWebLink updatedLink = client.WebLinksManager.DeleteSharedLinkAsync("11111");
iOS
client.webLinks.deleteSharedLink(forWebLink: "11111") { (result: Result<Void, BoxSDKError>) in
    guard case .success = result else {
        print("Error removing weblink shared link")
        return
    }

    print("WebLink shared link removed")
}