Download Completed Report File via API Developer Key

Jump to solution
Community Member

There is an API to start and run reports and check the status of a running report and when status=complete it will even give the download url of the report file:

When attempting to download the report file using the API developer key authentication, it does not authenticate.

Now I'm stuck, how do I authenticate to programmatically download the report file?  I've tried getting a refresh_token to use via google sso with no success.  Is there some known way to authenticate programmatically for the report download URLs?

BTW, the download URLs simply end up redirecting through to insgate cloud files, why not provide the direct link in the API instead of a link that requires user authentication?

Why not provide a download link that allows developer key authentication before the redirect?

Labels (1)
1 Solution
Community Member

Unfortunately as I mentioned in my original post I could not use any of the canvas API authentication mechanisms to download the report file.  Still seems silly to allow API access to start the report, check the status is completed, get the file_url for download, but not be able to use API authentication to allow the download.

What I have done to work around the deficiency is automate the user authentication login form with specific accounts user/pass.  

  1. GET /login/canvas
  2. Parse the response html and grab the value of authenticity_token.
  3. POST authenticity_token, along with pseudonym_session[unique_id] and pseudonym_session[password] for a specially created user account.
  4. Parse the response header with the cookie that contains the canvas_session value.
  5. Get the file_url value from a completed report object using typical API calls.
  6. GET <file_url> with the canvas_session as a cookie header.


View solution in original post