Box Developer Documentation

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

Register now!

Restore web link

post
https://api.box.com/2.0
/web_links/:web_link_id

Restores a web link that has been moved to the trash.

An optional new parent ID can be provided to restore the web link to in case the original folder has been deleted.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

Query Parameters

string arrayin queryoptional
id,type,name

A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response.

Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested.

Request Body

stringin bodyoptional
"Restored.docx"

An optional new name for the web link.

objectin body

Specifies an optional ID of a folder to restore the web link to when the original folder no longer exists.

Please be aware that this ID will only be used if the original folder no longer exists. Use this ID to provide a fallback location to restore the web link to if the original location has been deleted.

stringin bodyoptional
"123"

The ID of parent item

Response

Returns a web link object when it has been restored.

application/jsonClient error

Returns an error if the user does not have access to the folder the web link is being restored to, or the user does not have permission to restore web link from the trash.

application/jsonClient error

Returns an error if the web link is not in the trash.

application/jsonClient error

Returns an error if there is an web link with the same name in the folder the web link is being restored to.

application/jsonClient error

An unexpected client error.

post
Restore web link
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X POST "https://api.box.com/2.0/web_links/12345" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
TypeScript Gen
await client.trashedWebLinks.restoreWeblinkFromTrash(weblink.id);
Python Gen
client.trashed_web_links.restore_weblink_from_trash(weblink.id)
.NET Gen
await client.TrashedWebLinks.RestoreWeblinkFromTrashAsync(webLinkId: weblink.Id);
Swift Gen (Beta)
try await client.trashedWebLinks.restoreWeblinkFromTrash(webLinkId: weblink.id)
Python
web_link_to_restore = client.web_link(web_link_id='33333')
restored_web_link = client.trash().restore_item(web_link_to_restore)
print(f'Web link ID is {restored_web_link.id} and name is {restored_web_link.name}')

Response Example

{
  "id": "11446498",
  "type": "web_link",
  "created_at": "2012-12-12T10:53:43-08:00",
  "created_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "description": "Example page",
  "etag": "1",
  "item_status": "trashed",
  "modified_at": "2012-12-12T10:53:43-08:00",
  "modified_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "name": "My Bookmark",
  "owned_by": {
    "id": "11446498",
    "type": "user",
    "login": "ceo@example.com",
    "name": "Aaron Levie"
  },
  "parent": {
    "id": "12345",
    "type": "folder",
    "etag": "1",
    "name": "Contracts",
    "sequence_id": "3"
  },
  "path_collection": {
    "entries": [
      {
        "id": "12345",
        "etag": "1",
        "type": "folder",
        "sequence_id": "3",
        "name": "Contracts"
      }
    ],
    "total_count": 1
  },
  "purged_at": "null",
  "sequence_id": "3",
  "shared_link": "null",
  "trashed_at": "null",
  "url": "https://www.example.com/example/1234"
}