docuseal icon indicating copy to clipboard operation
docuseal copied to clipboard

Document access

Open MarcS1975 opened this issue 9 months ago • 8 comments

How can we get our documents? The documented API calls ignore the archived docs and in general that method is convoluted and bears security risks. I would rather the documents could be accessed via database download that doesnt have to go through the entire public internet. How can we download docs from the db?

MarcS1975 avatar Mar 24 '25 16:03 MarcS1975

@MarcS1975 you can enable API token auth to make documents downloaded only via API key with API:

Image

omohokcoj avatar Mar 24 '25 16:03 omohokcoj

I dont want to go through the entire internet when i just want to see my documents. For sepf hosted installations there must be a better way to access documents directly on the backend.

On 25 Mar 2025 at 00:10, Pete Matsyburka @.***> wrote:

@MarcS1975 you can enable API token auth to make documents downloaded only via API key with API:

image.png (view on web)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

omohokcoj left a comment (docusealco/docuseal#458)

@MarcS1975 you can enable API token auth to make documents downloaded only via API key with API:

image.png (view on web)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

MarcS1975 avatar Mar 24 '25 22:03 MarcS1975

Hey @omohokcoj! Thanks for that - big fan of Docuseal, could you send me a code snippet with an example of that?

I've had to enable that setting for security reasons but this line I used to use:

URI.parse(params[:data][:documents][0][:url]).open

now no longer works - as expected. thanks so much!

sampoder avatar Mar 29 '25 19:03 sampoder

Hi @sampoder when this option is turned on - it requires to pass ""X-Auth-Token" header when download files:

require 'faraday'

# Replace with your actual values
url = params[:data][:documents][0][:url]
auth_token = 'your_x_auth_token_here'

response = Faraday.get(url) do |req|
  req.headers['X-Auth-Token'] = auth_token
end

if response.success?
  file_contents = response.body
  # You can now process the file_contents (e.g., save, parse, etc.)
else
  raise "Failed to fetch document: #{response.status} - #{response.body}"
end

omohokcoj avatar Mar 29 '25 19:03 omohokcoj

Hi - Docuseal is great. Thanks for putting together. I am also struggling with document access. I am self-hosted, using your API with key and python3. But your python library uses a different auth-method that doesnt seem to work (Bearer token vs x-auth-token). How should I access api calls via python? I used this example:

from docuseal import docuseal

docuseal.key = "MY_API_KEY"
docuseal.url = "https://mydocuseal.com/api"

docuseal.list_submissions({ "limit": 10 })

Softbox44 avatar Mar 30 '25 07:03 Softbox44

@Softbox44 the code example you shared should work - just make sure you're using the latest 1.0.4 python package version.

omohokcoj avatar Mar 30 '25 07:03 omohokcoj

the script runs without error but no output. I have lots of documents inside but nothing comes through.

Softbox44 avatar Mar 30 '25 08:03 Softbox44

Ok - this brings some output, so I think your Python documentation is wrong.

curl --request GET   --url MYURL/api/templates   --header 'X-Auth-Token: my x-auth-token'

Can you please let me know what the correct Pychon call syntax is.

Softbox44 avatar Mar 30 '25 08:03 Softbox44