Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

Ronny_R26's avatar
Ronny_R26
Explorer | Level 4
2 years ago
Solved

Dropbox Error 401: Unauthorized API Call

Hello, guys. I'm having unexpected issues trying to download all the files in a folder from Dropbox using the "https://content.dropboxapi.com/2/files/download_zip" API Call Request. But, I keep receiving the 401 unauthorized error message when I have already given the permissions: files.content.write
files.content.read
sharing.write
sharing.read
Then I've created a new token and placed the request as explained in many forums and API docs from Dropbox but I keep receiving the same error. I need it to be used through make Integromat so I'm doing my tests through Postman and the error is the same thing. I'm using these parameters:

{"path": "/Automatización Inteligente/CSV/"} and the Access Token

 

  • Greg-DB's avatar
    Greg-DB
    2 years ago

    Are you using an app registered for the "app folder" access type? If so, it would only have access to contents of the special app folder that gets created for it. The folder in your screenshot isn't an an app folder though, so you'd need to use an app with the "full Dropbox" access type to access that. You can't switch the access type on an existing app, so you'd need to register another one here and switch to using token(s) for that one.

     

    Alternatively, you can move that folder into the app folder, as long as it isn't a shared folder. (App folders can't contain shared folders.)

8 Replies

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    Please print out the content of the response body, as it should contain a more detailed error message indicating why the call failed.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    From the configuration in the UI in your screenshot, it looks like your client may be trying to parse the response as JSON, but the response isn't guaranteed to be JSON, so please check the raw response.

     

    If the raw response is empty though, please check and share the headers as they may help indicate the issue. In that case, please ideally share both the request and response headers, but be sure to redact any sensitive values, such as the access token.

     

    In any case though, it also appears you're trying to send your path parameter as a header named "path", however the parameters for the /2/files/download_zip call should be sent as JSON in a header named "Dropbox-API-Arg". Please refer to the documentation for the /2/files/download_zip endpoints for information on how to correctly format the request. The API v2 Explorer can also be helpful for prototyping and testing out calls.

  • Ronny_R26's avatar
    Ronny_R26
    Explorer | Level 4
    2 years ago

    These are the headers:

    The authorization token starts with: sl.B_cyu, does it work for you?

     

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    Thanks for following up with the additional information.

     

    That looks like the right start of an access token. Looking at your headers though, your "Dropbox-API-Arg" value looks to be formatted incorrectly. Specifically, both:

    • it has extra slashes, which are normally meant for escaping slashes in the command prompt but aren't needed in Postman
    • the accented character needs to be encoded in the header (which Postman apparently doesn't do automatically). Refer to the documentation here for information on how to encode these values in headers.

    So, for example, your Dropbox-API-Arg value would be:

    {"path":"/Automatizaci\u00f3n Inteligente/CSV"}

  • Ronny_R26's avatar
    Ronny_R26
    Explorer | Level 4
    2 years ago

    Thanks, it worked! But now the path seems to be incorrect since I'm receiving the error 409 conflict: "path/not_found/.."
    But, that's the directory in my Dropbox. 

    Maybe I'm missing something?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    Are you using an app registered for the "app folder" access type? If so, it would only have access to contents of the special app folder that gets created for it. The folder in your screenshot isn't an an app folder though, so you'd need to use an app with the "full Dropbox" access type to access that. You can't switch the access type on an existing app, so you'd need to register another one here and switch to using token(s) for that one.

     

    Alternatively, you can move that folder into the app folder, as long as it isn't a shared folder. (App folders can't contain shared folders.)

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!