Skip to main content
Box Employee
May 22, 2025 9:11 AM UTC
Question

Unable to download file from Box using box-java-sdk getting Exception

BoxFile file = new BoxFile(api, "id");
BoxFile.Info info = file.getInfo();

FileOutputStream stream = new FileOutputStream(info.getName());
file.download(stream);
stream.close();

This is the code.
when I am trying to download I am getting exception

com.box.sdk.BoxAPIResponseException: The API returned an error code [404] 404.7010.0001 - The requested resource was not found

    2 replies

    Box Employee
    May 22, 2025 9:11 AM UTC

    Hello, 

     

    This error indicates that the user associated with your token does not have access (by ownership or collaboration) to the file you're trying to download. You will need to add this user as a collaborator or obtain a token for a user that already has access. 

     

    You can find out the user associated with your current token by using this endpoint: https://developer.box.com/reference/get-users-me/. 

     

    Best, 

    Kourtney

    Box Technical Support Engineer

    Translate
    Box Employee
    May 22, 2025 9:11 AM UTC

    HI 23426911768 I am also getting the same error. I am using my credentials to download the file and I can see that I've editor access to this file. Could you please help me how to resolve this issue.

    Translate