Skip to main content
Question

I want to get "download_count" of a file, but the shared_link object is null

  • May 22, 2025
  • 1 reply
  • 27 views

Forum|alt.badge.img

I want to get "download_count" of a file, so I use this API (get  https://api.box.com/2.0/files/:file_id).  According to API reference, the "download_count"  is in shared_link object.

"shared_link": {
    "access": "open",
    "download_count": 3,
    "download_url": "https://ww...

But when I call this API,  the shared_link object is null. Could you please tell me how to get shared_link object or how to get download_count? Thanks.

Below is API response:

{
    "type""file",
    "id""998558659552",
    "etag""2",
    "permissions": {
        "can_download"true,
        "can_preview"true,
        "can_upload"true,
        "can_comment"true,
        "can_rename"true,
        "can_delete"false,
        "can_share"true,
        "can_set_share_access"true,
        "can_invite_collaborator"false,
        "can_annotate"true,
        "can_view_annotations_all"true,
        "can_view_annotations_self"true,
        "can_create_annotations"true,
        "can_view_annotations"true
    },
    "shared_link"null,

......

1 reply

Forum|alt.badge.img

Hello, 

Does the file you are looking at have a shared link set up? Typically if the value is null - a shared link hasn't been set up for the file. That download_count field is only tracking how many downloads have occurred after someone has clicked on the shared link. 

Alex, Box Developer Advocate