Box Developer Documentation
Latest version

Remove shared link from file

put
https://api.box.com/2.0
/files/:file_id

This endpoint is in the version 2024.0. No changes are required to continue using it. For more details, see Box API versioning.

Removes a shared link from a file.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
12345

The unique identifier that represents a file.

The ID for any file can be determined by visiting a file in the web application and copying the ID from the URL. For example, for the URL https://*.app.box.com/files/123 the file_id is 123.

Query Parameters

stringin queryrequired
shared_link

Explicitly request the shared_link fields to be returned for this item.

Request Body

Response

application/jsonFile (Full)

Returns a basic representation of a file, with the shared link removed.

application/jsonClient error

Returned when the access token provided in the Authorization header is not recognized or not provided.

application/jsonClient error

Returned if the user does not have all the permissions to complete the update.

application/jsonClient error

Returned if the file is not found, or the user does not have access to the file.

application/jsonClient error

Returned if the file_id is not in a recognized format.

application/jsonClient error

Returns an error when the If-Match header does not match the current etag value of the file. This indicates that the file has changed since it was last requested.

application/jsonClient error

An unexpected client error.

put
Remove shared link from file
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

Learn more about Box SDK versionig strategy.


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
     }'
Node/TypeScript v10
await client.sharedLinksFiles.removeSharedLinkFromFile(
  fileId,
  { sharedLink: createNull() } satisfies RemoveSharedLinkFromFileRequestBody,
  { fields: 'shared_link' } satisfies RemoveSharedLinkFromFileQueryParams,
);
Python v10
client.shared_links_files.remove_shared_link_from_file(
    file_id, "shared_link", shared_link=create_null()
)
.NET v10
await client.SharedLinksFiles.RemoveSharedLinkFromFileAsync(fileId: fileId, requestBody: new RemoveSharedLinkFromFileRequestBody() { SharedLink = null }, queryParams: new RemoveSharedLinkFromFileQueryParams(fields: "shared_link"));
Java v10
client.getSharedLinksFiles().removeSharedLinkFromFile(fileId, new RemoveSharedLinkFromFileRequestBody.Builder().sharedLink(null).build(), new RemoveSharedLinkFromFileQueryParams("shared_link"))
Java v4
BoxFile file = new BoxFile(api, "12345");
BoxFile.Info info = file.getInfo();
info.removeSharedLink();
file.updateInfo(info);
Python v3
file_id = '11111'
client.file(file_id).remove_shared_link()
Node v3
client.files.update('12345', {
  shared_link: null
}).then(file => {
  // ...
})

Response Example

{
  "etag": "1",
  "id": "12345",
  "shared_link": null,
  "type": "file"
}