Skip to content

Instantly share code, notes, and snippets.

Last active February 10, 2023 02:28
What would you like to do?
import requests
params = {'access_token': '<your-access-token>'}
# Create the deposit resource
url = ""
headers = {"Content-Type": "application/json"}
res =
# Headers are not necessary here since "requests" automatically
# adds "Content-Type: application/json", because we're using
# the "json=" keyword argument...
# headers=headers,
# In the new files API we use a PUT request to a 'bucket' link, which is the container for files
# bucket url looks like this: ''
bucket_url = res.json()['links']['bucket']
# We pass the file object (fp) directly to request as 'data' for stream upload
# the target URL is the URL of the bucket and the desired filename on Zenodo seprated by slash
with open('/path/to/', 'rb') as fp:
res = requests.put(
bucket_url + '/',
# No headers included in the request, since it's a raw byte request
Copy link

When people talk about "the new files API" (#1764), is there some online documentation which shows its differences versus the "old API"?

Or is it the same API (same access point, same documentation), where some things have changed along time ... so an old script could now be failing because of the changes?

I have just discovered Zenodo and this is the only documentation I found. But it doesn't say it is new or old:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment