The Zenodo REST API currently supports:
Check out theQuickstart guide for an example on how toprogrammatically upload and publish your research outputs.
The following REST APIs are currently in testing before we launch them inbeta with full documentation:
You can have a sneak peek at the APIs in test from our root endpoint:https://zenodo.org/api/
This short guide will give a quick overview of how to upload and publish onZenodo, and will be using either:
#Install 'requests' module for pythonpip install requests#Install 'axios' module for nodejsnpm install axios
python# Python 3.6.5# [GCC 4.8.1] on linux2# Type "help", "copyright", "credits" or "license" for more information.
node// Welcome to Node.js v14.19.0.// Type ".help" for more information.
importrequests
constaxios=require('axios');
importrequestsr=requests.get("https://zenodo.org/api/deposit/depositions")r.status_code# 401r.json()
constaxios=require('axios');axios.get("https://zenodo.org/api/deposit/depositions").then(response=>{console.log(response);}).catch(error=>{console.log(error.response.data);});
{"message":"The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.","status":401}
ACCESS_TOKEN='ChangeMe'r=requests.get('https://zenodo.org/api/deposit/depositions',params={'access_token':ACCESS_TOKEN})r.status_code# 200r.json()# []
constACCESS_TOKEN='ChangeMe'constrequestParams={params:{'access_token':ACCESS_TOKEN}}axios.get("https://zenodo.org/api/deposit/depositions",requestParams).then(response=>{console.log(response.status);// > 200console.log(response.data);// > []}).catch(error=>{console.log(error.response.data);});
ACCESS_TOKEN
with your newly created personalaccess token):headers={"Content-Type":"application/json"}params={'access_token':ACCESS_TOKEN}r=requests.post('https://sandbox.zenodo.org/api/deposit/depositions',params=params,json={},''' Headers are not necessary here since "requests" automatically adds "Content-Type: application/json", because we're using the "json=" keyword argument headers=headers, '''headers=headers)r.status_code# 201r.json()
constrequestParams={params:{'access_token':ACCESS_TOKEN},headers:{"Content-Type":"application/json"}}axios.post("https://zenodo.org/api/deposit/depositions",requestParams).then(response=>{console.log(response.status);// 201console.log(response.data);}).catch(error=>{console.log(error.response.data);});
{"conceptrecid":"542200","created":"2020-05-19T11:58:41.606998+00:00","files":[],"id":542201,"links":{"bucket":"https://zenodo.org/api/files/568377dd-daf8-4235-85e1-a56011ad454b","discard":"https://zenodo.org/api/deposit/depositions/542201/actions/discard","edit":"https://zenodo.org/api/deposit/depositions/542201/actions/edit","files":"https://zenodo.org/api/deposit/depositions/542201/files","html":"https://zenodo.org/deposit/542201","latest_draft":"https://zenodo.org/api/deposit/depositions/542201","latest_draft_html":"https://zenodo.org/deposit/542201","publish":"https://zenodo.org/api/deposit/depositions/542201/actions/publish","self":"https://zenodo.org/api/deposit/depositions/542201"},"metadata":{"prereserve_doi":{"doi":"10.5072/zenodo.542201","recid":542201}},"modified":"2020-05-19T11:58:41.607012+00:00","owner":12345,"record_id":542201,"state":"unsubmitted","submitted":false,"title":""}
bucket_url=r.json()["links"]["bucket"]
curl https://zenodo.org/api/deposit/depositions/222761?access_token=$ACCESS_TOKEN{ ..."links":{"bucket":"https://zenodo.org/api/files/568377dd-daf8-4235-85e1-a56011ad454b", ...,},...}
bucket
link. The bucket is a folder-like object storing the files of our record. Our bucket URL will look like this:https://zenodo.org/api/files/568377dd-daf8-4235-85e1-a56011ad454b
and can be found under thelinks
key in our records metadata.''' This will stream the file located in '/path/to/your/file.dat' and store it in our bucket.The uploaded file will be named according to the last argument in the upload URL,'file.dat' in our case. '''$curl --upload-file /path/to/your/file.dat https://zenodo.org/api/files/568377dd-daf8-4235-85e1-a56011ad454b/file.dat?access_token=$ACCES_TOKEN{ ...}
''' New API '''filename="my-file.zip"path="/path/to/%s"%filename''' The target URL is a combination of the bucket link with the desired filenameseperated by a slash.'''withopen(path,"rb")asfp:r=requests.put("%s/%s"%(bucket_url,filename),data=fp,params=params,)r.json()
constfs=require('fs');constaxios=require('axios');constfilePath='<FILE_PATH>';// Replace with file pathconstbucketURL='<BUCKET_URL>';// Replace with bucket urlconstfileName='<FILE_NAME>';// Replace with file nameconsttoken='TOKEN';// Replace with token value// Create a formconstform=newFormData();// Read file as a streamconststream=fs.createReadStream(filePath);form.append('file',stream);// Create requestleturl=`${bucketURL}/${fileName}`;letparams={'access_token':token}letheaders={'Content-type':'application/zip'}constrequestConfig={data:{name:fileName,...form},headers:headers,params:params}axios.put(url,requestConfig).then(response=>{console.log(response.data);}).catch(error=>{console.log(error.response.data);});
{"key":"my-file.zip","mimetype":"application/zip","checksum":"md5:2942bfabb3d05332b66eb128e0842cff","version_id":"38a724d3-40f1-4b27-b236-ed2e43200f85","size":13264,"created":"2020-02-26T14:20:53.805734+00:00","updated":"2020-02-26T14:20:53.811817+00:00","links":{"self":"https://zenodo.org/api/files/44cc40bc-50fd-4107-b347-00838c79f4c1/dummy_example.pdf","version":"https://zenodo.org/api/files/44cc40bc-50fd-4107-b347-00838c79f4c1/dummy_example.pdf?versionId=38a724d3-40f1-4b27-b236-ed2e43200f85","uploads":"https://zenodo.org/api/files/44cc40bc-50fd-4107-b347-00838c79f4c1/dummy_example.pdf?uploads"},"is_head":true,"delete_marker":false}
'''Old APIGet the deposition id from the previous response'''deposition_id=r.json()['id']data={'name':'myfirstfile.csv'}files={'file':open('/path/to/myfirstfile.csv','rb')}r=requests.post('https://zenodo.org/api/deposit/depositions/%s/files'%deposition_id,params={'access_token':ACCESS_TOKEN},data=data,files=files)r.status_code# 201r.json()
// Old API documentation not available for javascript / NodeJS
{"checksum":"2b70e04bb31f2656ce967dc07103297f","name":"myfirstfile.csv","id":"eb78d50b-ecd4-407a-9520-dfc7a9d1ab2c","filesize":"27"}
data={'metadata':{'title':'My first upload','upload_type':'poster','description':'This is my first upload','creators':[{'name':'Doe, John','affiliation':'Zenodo'}]}}r=requests.put('https://zenodo.org/api/deposit/depositions/%s'%deposition_id,params={'access_token':ACCESS_TOKEN},data=json.dumps(data),headers=headers)r.status_code# 200
// Old API documentation not available for javascript / NodeJS
r=requests.post('https://zenodo.org/api/deposit/depositions/%s/actions/publish'%deposition_id,params={'access_token':ACCESS_TOKEN})r.status_code# 202
// Old API documentation not available for javascript / NodeJS
We provide a sandbox environment where you can test your API integrationduring development. The sandbox environment is available athttps://sandbox.zenodo.org.
Please note the following:
The REST API is versioned. We strive not to make backward incompatible changesto the API, but if we do, we release a new version.Changes to theAPI are documented on this page, and advance notification is given on ourTwitter account.
All API requests must be authenticated and over HTTPS. Any request over plainHTTP will fail. We support authentication with via OAuth 2.0.
deposit:write
anddeposit:actions
).An access token must be included in all requests as either:
GET /api/deposit/depositions?access_token=<ACCESS_TOKEN>
access_token
):GET /api/deposit/depositionsAuthorization: Bearer <ACCESS_TOKEN>
Authorization
):Scopes assigns permissions to your access token to limit access to data andactions in Zenodo. The following scopes exist:
Name | Description |
---|---|
deposit:write | Grants write access to depositions, but does not allow publishing the upload. |
deposit:actions | Grants access to publish, edit and discard edits for depositions. |
The base URL of the API ishttps://zenodo.org/api/
.
AllPOST
andPUT
request bodies must be JSON encoded, and must have contenttype ofapplication/json
unless specified otherwise in the specific resource(e.g. in the case of file uploads). The API will return a415
error (seeHTTPstatus codes anderror responses) if the wrongcontent type is provided.
{"field1":"value","...":"..."}
All response bodies are JSON encoded (UTF-8 encoded). A single resource isrepresented as a JSON object:
[{"field1":"value","...":"..."}"..."]
A collection of resources is represented as a JSON array of objects:
YYYY-MM-DDTHH:MM:SS+00:00
Timestamps are in UTC and formatted according toISO8601:
We use the following HTTP status codes to indicate success or failure of arequest.
Code | Name | Description |
---|---|---|
200 | OK | Request succeeded. Response included. Usually sent for GET/PUT/PATCH requests. |
201 | Created | Request succeeded. Response included. Usually sent for POST requests. |
202 | Accepted | Request succeeded. Response included. Usually sent for POST requests, where background processing is needed to fulfill the request. |
204 | No Content | Request succeeded. No response included. Usually sent for DELETE requests. |
400 | Bad Request | Request failed.Error response included. |
401 | Unauthorized | Request failed, due to an invalid access token.Error response included. |
403 | Forbidden | Request failed, due to missing authorization (e.g. deleting an already submitted upload or missing scopes for your access token).Error response included. |
404 | Not Found | Request failed, due to the resource not being found.Error response included. |
405 | Method Not Allowed | Request failed, due to unsupported HTTP method.Error response included. |
409 | Conflict | Request failed, due to the current state of the resource (e.g. edit a deopsition which is not fully integrated).Error response included. |
415 | Unsupported Media Type | Request failed, due to missing or invalid request headerContent-Type .Error response included. |
429 | Too Many Requests | Request failed, due to rate limiting.Error response included. |
500 | Internal Server Error | Request failed, due to an internal server error. Error responseNOT included. Don’t worry, Zenodo admins have been notified and will be dealing with the problem ASAP. |
Error responses for 400 series errors (e.g. 400, 401, 403, …) are returned asa JSON object with two attributesmessage
andstatus
(HTTP status code), andpossibly an attributeerrors
with a list of more detailed errors.
{"message":"Deposition not found","status":404}
For more complex errors, we include the attributeerrors
, a JSON array ofobjects, each with the attributesmessage
(with a human-readable explanationof the error), and possiblyfield
(with the “path” to field that containsthe error).
Example of an error message with detailed errors:
{"message":"Validation error","status":400,"errors":[{"field":"metadata.access_right","message":"Not a valid choice"},{"field":"metadata.creators.0.name","message":"Name is required."},{"field":"non_existent","message":"Unknown field name."}]}
The Deposition resource is used for uploading and editing records on Zenodo.
Field | Description |
---|---|
created timestamp | Creation time of deposition (in ISO8601 format). |
doi string | Digital Object Identifier (DOI). When you publish your deposition, we register a DOI inDataCite for your upload, unless you manually provided us with one. This field is only present for published depositions. |
doi_url url | Persistent link to your published deposition. This field is only present for published depositions. |
files array | A list ofdeposition files resources. |
id integer | Deposition identifier |
metadata object | Adeposition metadata resource |
modified timestamp | Last modification time of deposition (in ISO8601 format). |
owner integer | User identifier of the owner of the deposition. |
record_id integer | Record identifier. This field is only present for published depositions. |
record_url url | URL to public version of record for this deposition. This field is only present for published depositions. |
state string | One of the values: * inprogress : Deposition metadata can be updated. If deposition is also unsubmitted (seesubmitted ) files can be updated as well.* done : Deposition has been published.* error : Deposition is in an error state - contact our support. |
submitted bool | True if the deposition has been published, False otherwise. |
title string | Title of deposition (automatically set frommetadata ). Defaults to empty string. |
Attribute | Required | Description |
---|---|---|
upload_type string | Yes | Controlled vocabulary:*publication : Publication*poster : Poster*presentation : Presentation*dataset : Dataset*image : Image*video : Video/Audio*software : Software*lesson : Lesson*physicalobject : Physical object*other : Other |
publication_type string | Yes, ifupload_type is"publication" . | Controlled vocabulary:*annotationcollection : Annotation collection*book : Book*section : Book section*conferencepaper : Conference paper*datamanagementplan : Data management plan*article : Journal article*patent : Patent*preprint : Preprint*deliverable : Project deliverable*milestone : Project milestone*proposal : Proposal*report : Report*softwaredocumentation : Software documentation*taxonomictreatment : Taxonomic treatment*technicalnote : Technical note*thesis : Thesis*workingpaper : Working paper*other : Other |
image_type string | Yes, ifupload_type is"image" . | Controlled vocabulary:*figure : Figure*plot : Plot*drawing : Drawing*diagram : Diagram*photo : Photo*other : Other |
publication_date string | Yes | Date of publication in ISO8601 format (YYYY-MM-DD ). Defaults to current date. |
title string | Yes | Title of deposition. |
creators array of objects | Yes | The creators/authors of the deposition. Each array element is an object with the attributes:*name : Name of creator in the formatFamily name, Given names*affiliation : Affiliation of creator (optional).*orcid : ORCID identifier of creator (optional).*gnd : GND identifier of creator (optional).Example:[{'name':'Doe, John', 'affiliation': 'Zenodo'}, {'name':'Smith, Jane', 'affiliation': 'Zenodo', 'orcid': '0000-0002-1694-233X'}, {'name': 'Kowalski, Jack', 'affiliation': 'Zenodo', 'gnd': '170118215'}] |
description string (allows HTML) | Yes | Abstract or description for deposition. |
access_right string | Yes | Controlled vocabulary:*open : Open Access*embargoed : Embargoed Access*restricted : Restricted Access*closed : Closed AccessDefaults toopen . |
license string | Yes, ifaccess_right is"open" or"embargoed" . | Controlled vocabulary:The selected license applies to all files in this deposition, but not to the metadata which is licensed underCreative Commons Zero. You can find the available license IDs via our/api/licenses endpoint. Defaults tocc-zero for datasets andcc-by for everything else. |
embargo_date date | Yes, ifaccess_right is"embargoed" . | When the deposited files will be made automatically made publicly available by the system. Defaults to current date. |
access_conditions string (allows HTML) | Yes, ifaccess_right is"restricted" . | Specify the conditions under which you grant users access to the files in your upload. User requesting access will be asked to justify how they fulfil the conditions. Based on the justification, you decide who to grant/deny access. You are not allowed to charge users for granting access to data hosted on Zenodo. |
doi string | No | Digital Object Identifier. Did a publisher already assign a DOI to your deposited files? If not, leave the field empty and we will register a new DOI for you when you publish. A DOI allow others to easily and unambiguously cite your deposition. |
prereserve_doi object/bool | No | Set totrue , to reserve a Digital Object Identifier (DOI). The DOI is automatically generated by our system and cannot be changed. Also, The DOI is not registered withDataCite until you publish your deposition, and thus cannot be used before then. Reserving a DOI is useful, if you need to include it in the files you upload, or if you need to provide a dataset DOI to your publisher but not yet publish your dataset. The response from the REST API will include the reserved DOI. |
keywords array of strings | No | Free form keywords for this deposition.Example:["Keyword 1", "Keyword 2"] |
notes string (allows HTML) | No | Additional notes. |
related_identifiers array of objects | No | Persistent identifiers of related publications and datasets. Supported identifiers include: DOI, Handle, ARK, PURL, ISSN, ISBN, PubMed ID, PubMed Central ID, ADS Bibliographic Code, arXiv, Life Science Identifiers (LSID), EAN-13, ISTC, URNs and URLs. Each array element is an object with the attributes:*identifier : The persistent identifier*relation : Relationship. Controlled vocabulary (isCitedBy ,cites ,isSupplementTo ,isSupplementedBy ,isContinuedBy ,continues ,isDescribedBy ,describes ,hasMetadata ,isMetadataFor ,isNewVersionOf ,isPreviousVersionOf ,isPartOf ,hasPart ,isReferencedBy ,references ,isDocumentedBy ,documents ,isCompiledBy ,compiles ,isVariantFormOf ,isOriginalFormof ,isIdenticalTo ,isAlternateIdentifier ,isReviewedBy ,reviews ,isDerivedFrom ,isSourceOf ,requires ,isRequiredBy ,isObsoletedBy ,obsoletes ).*resource_type : Type of the related resource (based on theupload_type ,publication_type , andimage_type fields).Example:[{'relation': 'isSupplementTo', 'identifier':'10.1234/foo'}, {'relation': 'cites', 'identifier':'https://doi.org/10.1234/bar', 'resource_type': 'image-diagram'}] . Note the identifier type (e.g. DOI) is automatically detected, and used to validate and normalize the identifier into a standard form. |
contributors array of objects | No | The contributors of the deposition (e.g. editors, data curators, etc.). Each array element is an object with the attributes:*name : Name of creator in the formatFamily name, Given names*type : Contributor type. Controlled vocabulary (ContactPerson ,DataCollector ,DataCurator ,DataManager ,Distributor ,Editor ,HostingInstitution ,Producer ,ProjectLeader ,ProjectManager ,ProjectMember ,RegistrationAgency ,RegistrationAuthority ,RelatedPerson ,Researcher ,ResearchGroup ,RightsHolder ,Supervisor ,Sponsor ,WorkPackageLeader ,Other )*affiliation : Affiliation of creator (optional).*orcid : ORCID identifier of creator (optional).*gnd : GND identifier of creator (optional).Example:[{'name':'Doe, John', 'affiliation': 'Zenodo', 'type': 'Editor' }, ...] |
references array of strings | No | List of references.Example:["Doe J (2014). Title. Publisher. DOI", "Smith J (2014). Title. Publisher. DOI"] |
communities array of objects | No | List of communities you wish the deposition to appear. The owner of the community will be notified, and can either accept or reject your request. Each array element is an object with the attributes:*identifier : Community identifierExample:[{'identifier':'ecfunded'}] |
grants array of objects | No | List of OpenAIRE-supported grants, which have funded the research for this deposition. Each array element is an object with the attributes:*id : grant ID.Example:[{'id':'283595'}] (European Commission grants only)or funder DOI-prefixed:[{'id': '10.13039/501100000780::283595'}] (All grants, recommended) Accepted funder DOI prefixes:Academy of Finland:10.13039/501100002341 Agence Nationale de la Recherche:10.13039/501100001665 Aligning Science Across Parkinson’s:10.13039/100018231 Australian Research Council:10.13039/501100000923 Austrian Science Fund:10.13039/501100002428 Canadian Institutes of Health Research:10.13039/501100000024 European Commission:10.13039/501100000780 European Environment Agency:10.13039/501100000806 Fundação para a Ciência e a Tecnologia:10.13039/501100001871 Hrvatska Zaklada za Znanost:10.13039/501100004488 Institut National Du Cancer:10.13039/501100006364 Ministarstvo Prosvete, Nauke i Tehnološkog Razvoja:10.13039/501100004564 Ministarstvo Znanosti, Obrazovanja i Sporta:10.13039/501100006588 National Health and Medical Research Council:10.13039/501100000925 National Institutes of Health:10.13039/100000002 National Science Foundation:10.13039/100000001 Natural Sciences and Engineering Research Council of Canada:10.13039/501100000038 Nederlandse Organisatie voor Wetenschappelijk Onderzoek:10.13039/501100003246 Research Councils:10.13039/501100000690 Schweizerischer Nationalfonds zur Förderung der wissenschaftlichen Forschung:10.13039/501100001711 Science Foundation Ireland:10.13039/501100001602 Social Science Research Council:10.13039/100001345 Templeton World Charity Foundation:10.13039/501100011730 Türkiye Bilimsel ve Teknolojik Araştırma Kurumu:10.13039/501100004410 UK Research and Innovation:10.13039/100014013 Wellcome Trust:10.13039/100004440 |
journal_title string | No | Journal title, if deposition is a published article. |
journal_volume string | No | Journal volume, if deposition is a published article. |
journal_issue string | No | Journal issue, if deposition is a published article. |
journal_pages string | No | Journal pages, if deposition is a published article. |
conference_title string | No | Title of conference (e.g. 20th International Conference on Computing in High Energy and Nuclear Physics). |
conference_acronym string | No | Acronym of conference (e.g. CHEP'13). |
conference_dates string | No | Dates of conference (e.g. 14-18 October 2013). Conference title or acronym must also be specified if this field is specified. |
conference_place string | No | Place of conference in the format city, country (e.g. Amsterdam, The Netherlands). Conference title or acronym must also be specified if this field is specified. |
conference_url string | No | URL of conference (e.g. http://www.chep2013.org/). |
conference_session string | No | Number of session within the conference (e.g. VI). |
conference_session_part string | No | Number of part within a session (e.g. 1). |
imprint_publisher string | No | Publisher of a book/report/chapter |
imprint_isbn string | No | ISBN of a book/report |
imprint_place string | No | Place of publication of a book/report/chapter in the format city, country. |
partof_title string | No | Title of book for chapters |
partof_pages string | No | Pages numbers of book |
thesis_supervisors array of objects | No | Supervisors of the thesis. Same format as forcreators . |
thesis_university string | No | Awarding university of thesis. |
subjects array of objects | No | Specify subjects from a taxonomy or controlled vocabulary. Each term must be uniquely identified (e.g. a URL). For free form text, use the keywords field. Each array element is an object with the attributes:*term : Term from taxonomy or controlled vocabulary.*identifier : Unique identifier for term.*scheme : Persistent identifier scheme for id (automatically detected).Example:[{"term": "Astronomy", "identifier": "http://id.loc.gov/authorities/subjects/sh85009003", "scheme": "url"}] |
version string | No | Version of the resource. Any string will be accepted, however the suggested format is a semantically versioned tag (see more details on semantic versioning atsemver.org)Example:2.1.5 |
language string | No | Specify the main language of the record as ISO 639-2 or 639-3 code, seeLibrary of Congress ISO 639 codes list.Example:eng |
locations array of objects | No | List of locations*lat (double): latitude*lon (double): longitude*place (string): place’s name (required)*description (string): place’s description (optional)Example:[{"lat": 34.02577, "lon": -118.7804, "place": "Los Angeles"}, {"place": "Mt.Fuji, Japan", "description": "Sample found 100ft from the foot of the mountain."}] |
dates array of objects | No | List of date intervals*start (ISO date string): start date (*)*end (ISO date string): end date (*)*type (Collected, Valid, Withdrawn): The interval’s type (required)*description (string): The interval’s description (optional)(*) Note that you have to specify at least a start or end date. For an exact date, use the same value for bothstart andend .Example:[{"start": "2018-03-21", "end": "2018-03-25", "type": "Collected", "description": "Specimen A5 collection period."}] |
method string (allows HTML) | No | The methodology employed for the study or research. |
description
,notes
), for security reasons, only the following tags are accepted:a
,abbr
,acronym
,b
,blockquote
,br
,code
,caption
,div
,em
,i
,li
,ol
,p
,pre
,span
,strike
,strong
,sub
,table
,caption
,tbody
,thead
,th
,td
,tr
,u
,ul
.List all depositions for the currently authenticated user.
importrequestsresponse=requests.get('/api/deposit/depositions',params={'q':'my title','access_token':ACCESS_TOKEN})print(response.json())
curl -i /api/deposit/depositions/?access_token=ACCESS_TOKEN
GET /api/deposit/depositions
Parameter | Required | Description |
---|---|---|
q string | optional | Search query (usingElasticsearch query string syntax - note that some characters have special meaning here, including/ , which is also present in full DOIs). |
status string | optional | Filter result based on deposit status (eitherdraft orpublished ) |
sort string | optional | Sort order (bestmatch ormostrecent ). Prefix with minus to change form ascending to descending (e.g.-mostrecent ). |
page integer | optional | Page number for pagination. |
size integer | optional | Number of results to return per page. |
all_versions integer/string | optional | Show (true or1 ) or hide (false or0 ) all versions of deposits. |
200 OK
SeeHTTP status codes (400 and 500 series errors) anderror responses.
Create a new deposition resource.
curl -i -H"Content-Type: application/json" -X POST --data'{}' /api/deposit/depositions/?access_token=ACCESS_TOKEN# orcurl -i -H"Content-Type: application/json" -X POST --data'{"metadata": {"title": "My first upload", "upload_type": "poster", "description": "This is my first upload", "creators": [{"name": "Doe, John", "affiliation": "Zenodo"}]}}' /api/deposit/depositions/?access_token=ACCESS_TOKEN
importjsonimportrequestsurl="/api/deposit/depositions/?access_token=ACCESS_TOKEN"headers={"Content-Type":"application/json"}r=requests.post(url,data="{}",headers=headers)
POST /api/deposit/depositions
Content-Type: application/json
An empty JSON object{}
or adeposition metadataresource. Example:{"metadata": {"upload_type": "presentation" } }
deposit:write
201 Created
SeeHTTP status codes (400 and 500 series errors) anderror responses.
Retrieve a single deposition resource.
curl -i /api/deposit/depositions/1234?access_token=ACCESS_TOKEN
importrequestsr=requests.get("/api/deposit/depositions/1234?access_token=ACCESS_TOKEN")
GET /api/deposit/depositions/:id
200 OK
SeeHTTP status codes (400 and 500 series errors) anderror responses. |
Update an existing deposition resource.
curl -i -H"Content-Type: application/json" -X PUT --data'{"metadata": {"title": "My first upload", "upload_type": "poster", "description": "This is my first upload", "creators": [{"name": "Doe, John", "affiliation": "Zenodo"}]}}' https://zenodo.org/api/deposit/depositions/1234?access_token=ACCESS_TOKEN
importjsonimportrequestsdata={"metadata":{"title":"My first upload","upload_type":"poster","description":"This is my first upload","creators":[{"name":"Doe, John","affiliation":"Zenodo"}]}}url="https://zenodo.org/api/deposit/depositions/1234?access_token=ACCESS_TOKEN"headers={"Content-Type":"application/json"}r=requests.put(url,data=json.dumps(data),headers=headers)
PUT /api/deposit/depositions/:id
Content-Type: application/json
deposit:write
{"metadata":{"upload_type":"presentation","...":"..."}}
Adeposition metadata resource.
200 OK
SeeHTTP status codes (400 and 500 series errors) anderror responses.
Delete an existing deposition resource. Note, only unpublished depositions maybe deleted.
curl -i https://zenodo.org/api/deposit/depositions/1234?access_token=ACCESS_TOKEN -X DELETE
importrequestsr=requests.delete('https://zenodo.org/api/deposit/depositions/1234',params={'access_token':ACCESS_TOKEN})
DELETE /api/deposit/depositions/:id
deposit:write
201 Created
404 Not found
: Deposition does not exist.403 Forbidden
: Deleting an already published deposition.See alsoHTTP status codes (400 and 500 series errors) anderror responses.
The Deposition file resource is used for uploading and editing files of adeposition on Zenodo.
Attribute | Description |
---|---|
id string | Deposition file identifier |
filename string | Name of file |
filesize integer | Size of file in bytes |
checksum string | MD5 checksum of file, computed by our system. This allows you to check the integrity of the uploaded file. |
List all deposition files for a given deposition.
curl -i https://zenodo.org/api/deposit/depositions/1234/files?access_token=ACCESS_TOKEN
importrequestsr=requests.get('https://zenodo.org/api/deposit/depositions/1234/files',params={'access_token':ACCESS_TOKEN})
GET /api/deposit/depositions/:id/files
200 OK
SeeHTTP status codes (400 and 500 series errors) anderror responses.
Upload a new file.
curl -i https://zenodo.org/api/deposit/depositions/1234/files?access_token=ACCESS_TOKEN -Fname=myfirstfile.csv -Ffile=@path/to/local_file.csv
importjsonimportrequestsurl='https://zenodo.org/api/deposit/depositions/1234/files?access_token=ACCESS_TOKEN'data={'name':'myfirstfile.csv'}files={'file':open('path/to/local_file.csv','rb')}r=requests.post(url,data=data,files=files)
POST /api/deposit/depositions/:id/files
Content-Type: multipart/form-data
deposit:write
201 Created
SeeHTTP status codes (400 and 500 series errors) anderror responses.
Sort the files for a deposition. By default, the first file is shown in the filepreview.
curl -i https://zenodo.org/api/deposit/depositions/1234/files?access_token=ACCESS_TOKEN -X PUT -H"Content-Type: application/json" --data'[{"id":"21fedcba-9876-5432-1fed-cba987654321"}, {"id":"12345678-9abc-def1-2345-6789abcdef12"}]'
importjsonimportrequestsurl='https://zenodo.org/api/deposit/depositions/1234/files?access_token=ACCESS_TOKEN'headers={"Content-Type":"application/json"}data=[{'id':'21fedcba-9876-5432-1fed-cba987654321'},{'id':'12345678-9abc-def1-2345-6789abcdef12'}]r=requests.put(url,data=json.dumps(data),headers=headers)
PUT /api/deposit/depositions/:id/files
Content-Type: application/json
deposit:write
A JSON array of partialdeposition file resources with onlytheid
attribute. Example:
[{"id":"<file_id_1>"},{"id":"<file_id_2>"},"..."]
200 OK
SeeHTTP status codes (400 and 500 series errors) anderror responses.
Retrieve a single deposition file.
curl -i https://zenodo.org/api/deposit/depositions/1234/files/12345678-9abc-def1-2345-6789abcdef12?access_token=ACCESS_TOKEN
importrequestsr=requests.get('https://zenodo.org/api/deposit/depositions/1234/files/12345678-9abc-def1-2345-6789abcdef12',params={'access_token':ACCESS_TOKEN})
GET /api/deposit/depositions/:id/files/:file_id
200 OK
SeeHTTP status codes (400 and 500 series errors) anderror responses.
Update a deposition file resource. Currently the only use is renaming an alreadyuploaded file. If you one to replace the actual file, please delete the file andupload a new file.
curl -i https://zenodo.org/api/deposit/depositions/1234/files/21fedcba-9876-5432-1fed-cba987654321?access_token=ACCESS_TOKEN -X PUT -H"Content-Type: application/json" --data'{"filename": "someothername.csv"}'
importjsonimportrequestsurl='https://zenodo.org/api/deposit/depositions/1234/files/21fedcba-9876-5432-1fed-cba987654321?access_token=ACCESS_TOKEN'headers={"Content-Type":"application/json"}data={"name":"someothername.csv"}r=requests.put(url,data=json.dumps(data),headers=headers)
PUT /api/deposit/depositions/:id/files/:file_id
Content-Type: application/json
deposit:write
A partialdeposition file resources with only thefilename
attributes. Example:
{"name":"<new_file_name>"}
200 OK
SeeHTTP status codes (400 and 500 series errors) anderror responses.
Delete an existing deposition file resource. Note, only deposition files forunpublished depositions may be deleted.
curl -i -X DELETE https://zenodo.org/api/deposit/depositions/1234/files/21fedcba-9876-5432-1fed-cba987654321?access_token=ACCESS_TOKEN
importrequestsr=requests.delete('https://zenodo.org/api/deposit/depositions/1234/files/21fedcba-9876-5432-1fed-cba987654321',params={'access_token':ACCESS_TOKEN})
DELETE /api/deposit/depositions/:id/files/:file_id
deposit:write
204 No Content
404 Not found
: Deposition file does not exist.403 Forbidden
: Deleting an already published deposition.See alsoHTTP status codes (400 and 500 series errors) anderror responses.
Publish a deposition. Note, once a deposition is published, you can no longerdelete it.
curl -i -X POST https://zenodo.org/api/deposit/depositions/1234/actions/publish?access_token=ACCESS_TOKEN
importrequestsr=requests.post('https://zenodo.org/api/deposit/depositions/1234/actions/publish',params={'access_token':ACCESS_TOKEN})
POST /api/deposit/depositions/:id/actions/publish
deposit:actions
202 Accepted
SeeHTTP status codes (400 and 500 series errors) anderror responses.
Unlock already submitted deposition for editing.
curl -i -X POST https://zenodo.org/api/deposit/depositions/1234/actions/edit?access_token=ACCESS_TOKEN
importrequestsr=requests.post('https://zenodo.org/api/deposit/depositions/1234/actions/edit',params={'access_token':ACCESS_TOKEN})
POST /api/deposit/depositions/:id/actions/edit
deposit:actions
201 Created
400 Bad Request
: Deposition state does not allow for editing (e.g.depositions in stateinprogress
).409 Conflict
: Deposition is in the process of being integrated, please wait5 minutes before trying again.SeeHTTP status codes (400 and 500 series errors) anderror responses.
Discard changes in the current editing session.
curl -i -X POST https://zenodo.org/api/deposit/depositions/1234/actions/discard?access_token=ACCESS_TOKEN
importrequestsr=requests.post('https://zenodo.org/api/deposit/depositions/1234/actions/discard',params={'access_token':ACCESS_TOKEN})
POST /api/deposit/depositions/:id/actions/discard
deposit:actions
201 Created
400 Bad Request
: Deposition is not being edited.SeeHTTP status codes (400 and 500 series errors) anderror responses.
Create a new version of a deposition.
This action will create a new deposit, which will be a snapshot of the current resouce, inheriting the metadata as well as snapshot of files.The new version deposit will have a state similar to a new, unpublished deposit, most importantly its files will be modifiable as for a new deposit.
Only one unpublished new version deposit can be available at any moment, i.e.: calling new version action multiple times will have no effect, as long as the resulting new version deposit from the first call is not published or deleted.
NOTES: - The response body of this action is NOT the new version deposit, but the original resource.The new version deposition can be accessed through the"latest_draft"
under"links"
in the response body.- Theid
used to create this new version has to be theid
of the latest version. It is not possible to use the global id that references all the versions.
curl -i -X POST https://zenodo.org/api/deposit/depositions/1234/actions/newversion?access_token=ACCESS_TOKEN
importrequestsr=requests.post('https://zenodo.org/api/deposit/depositions/1234/actions/newversion',params={'access_token':ACCESS_TOKEN})
POST /api/deposit/depositions/:id/actions/newversion
deposit:actions
201 Created
SeeHTTP status codes (400 and 500 series errors) anderror responses.
The Records resource is used to search through published records.
List all open access records.
importrequestsresponse=requests.get('https://zenodo.org/api/records',params={'q':'my title','access_token':ACCESS_TOKEN})print(response.json())
curl -i /api/records/?access_token=ACCESS_TOKEN
GET /api/records/
Parameter | Required | Description |
---|---|---|
q string | optional | Search query (usingElasticsearch query string syntax - note that some characters have special meaning here, including/ , which is also present in full DOIs). |
status string | optional | Filter result based on the deposit status (eitherdraft orpublished ) |
sort string | optional | Sort order (bestmatch ormostrecent ). Prefix with minus to change form ascending to descending (e.g.-mostrecent ). |
page integer | optional | Page number for pagination. |
size integer | optional | Number of results to return per page. |
all_versions integer/string | optional | Show (true or1 ) or hide (false or0 ) all versions of records. |
communities string | optional | Return records that are part of the specified communities. (Use ofcommunity identifier ) |
type string | optional | Return records of the specified type. (Publication ,Poster ,Presentation …) |
subtype string | optional | Return records of the specified subtype. (Journal article ,Preprint ,Proposal …) |
bounds string | optional | Return records filtered by a geolocation bounding box. (Formatbounds=143.37158,-38.99357,146.90918,-37.35269 ) |
custom string | optional | Return records containing the specified custom keywords. (Formatcustom=[field_name]:field_value ) |
The response format of the search can be requested by specifying it in the header.
Accept | Description |
---|---|
application/json | JSON |
application/vnd.zenodo.v1+json | Zenodo |
application/marcxml+xml | Marc XML |
application/x-bibtex | Bibtex |
application/x-datacite+xml | Datacite XML |
application/x-dc+xml | Dublin Core |
200 OK
SeeHTTP status codes (400 and 500 series errors) anderror responses.
Advanced search queries can as well be performed on Zenodo website through the search box. This is documented in thesearch guide
Retrieve a single record.
curl -i https://zenodo.org/api/records/1234
importrequestsr=requests.get("https://zenodo.org/api/records/1234)
GET https://zenodo.org/api/records/:id
Again, the output format of the search can be specified in theheader
200 OK
SeeHTTP status codes (400 and 500 series errors) anderror responses. |
The License resource is used for serving the license metadata that can beapplied to uploaded content on Zenodo.
Field | Description |
---|---|
created timestamp | Creation time of the license (in ISO8601 format). |
updated timestamp | Last modification time of deposition (in ISO8601 format). |
metadata object | Thelicense metadata resource |
Attribute | Description |
---|---|
id string | Identifier for the license.Example:cc-by-nc-4.0 |
title string | The name of the licenseExample: GNU Lesser General Public License v3.0 |
url string | URL of the licenseExample:http://www.opensource.org/licenses/MIT |
Search through licenses.
importrequestsresponse=requests.get('/api/licenses/')print(response.json())
curl /api/licenses/
GET /api/licenses/
Parameter | Required | Description |
---|---|---|
q string | optional | Search query (usingElasticsearch query string syntax - note that some characters have special meaning here, including/ , which is also present in full DOIs). |
page integer | optional | Page number for pagination. |
size integer | optional | Number of results to return per page. |
200 OK
SeeHTTP status codes (400 and 500 series errors) anderror responses. |
Retrieve a single license resource.
importrequestsr=requests.get("/api/licenses/cc-by-nc-4.0")
curl /api/licenses/cc-by-nc-4.0
GET /api/licenses/:id
200 OK
SeeHTTP status codes (400 and 500 series errors) anderror responses. |
2017-10-04
version
to deposition metadata.language
to deposition metadata.2017-06-15
2016-09-12
2015-10-06
contributors
to deposition metadata.subjects
to deposition metadata.gnd
tocreators
in deposition metadata.2014-12-20
isAlternateIdentifier
in subfieldrelation
torelated_identifiers
in deposition metadata.2014-12-10
hasPart
,isPartOf
&isIdenticalTo
in subfieldrelation
torelated_identifiers
in deposition metadata.2014-11-20
orcid
tocreators
in deposition metadata.2014-10-21
conference_session
andconference_session_part
to deposition metadata.2014-09-09
references
to deposition metadata.2014-06-13
2013-12-18
REST API version 1.0 final release:
deposit/depositions/:id/action
todeposit/depositions/:id/actions
edit
anddiscard
deposition action resources.state
: Controlled vocabulary changed.submitted
: Data type changed from Timestamp to Bool.2013-11-13
REST API initial release candidate.
Zenodo allows you to harvest our entire repository via the Open ArchivesInitiative Protocol for Metadata Harvesting (OAI-PMH). OAI-PMH is a widely used protocol forharvesting metadata and most popular repository software provide support forthis protocol.
All metadata is licensed underCreative CommonsZero, while the data files may be either openaccess and subject to a license described in the metadata or closed access andnot available for download.
Our OAI-PMH base endpoint is athttps://zenodo.org/oai2d
.
For this example, we are going to be using Sickle since it simplifies our workflow and supports XML parsing.
# Install the Sickle package using pippipinstallSickle
'''Import Sickle and initialize the client by passing the base URL'''fromsickleimportSicklesickle=Sickle('https://zenodo.org/oai2d')
To get some general information about the OAI-PMH capabilities we can use theIdentify
verb.
'''Get information on the OAI-PMH API by using "Identify"'''info=sickle.Identify()info.granularity# 'YYYY-MM-DDThh:mm:ssZ'info.earliestDatestamp# '2014-02-03T14:41:33Z'
Resumption tokens are only valid for2 minutes. In case a token expired, you will receive a422 Unprocessable Entity
HTTP error.
The OAI-PMH API is rated limited like the REST API - i.e. you will receivea429 Too Many Requests
HTTP error if you exceed the limit.For more information please take a look at therate limiting documentation.
To list the available records metadata formats we can useListMetadataFormats
.
'''Metadata for each record is available in several formats'''metadataFormats=sickle.ListMetadataFormats()list(metadataFormats)# [<MetadataFormat marcxml>, <MetadataFormat oai_datacite4>, ...]
oai_datacite
OAI DataCite (latest schema version) — This metadata format has beenspecifically established for the dissemination of DataCite records usingOAI-PMH. In addition to the original DataCite metadata, this format containsseveral other elements describing the version of the metadata, whether it is ofreference quality, and the registering datacentre. For more information aboutthis format and its schema please see theDataCite OAI schema website.
This metadata format will always deliver metadata according to the latestavailable DataCite schema version.
To get the raw XML output of the example above, view the page’s source using the web browser’s “view source” option. We recommend you harvest using the “oai_datacite” metadata format. The format contains the most complete metadata and is our primary supported export format.datacite
DataCite (latest version) — This metadata format contains only the originalDataCite metadata without additions or alterations according to the latestDataCite schema. Please note that this format is not OAI-PMH version 2.0compliant.
oai_dc
Dublin Core — only minimal metadata is included in this format. The format is exported according to theOpenAIRE Guidelines.
dcat
DCAT — export format based on theDCAT Application Profile for data portals in Europe (DCAT-AP). The format is produced from the DataCite export format using theDataCite-to-DCAT-AP XSLT.This is the only OAI-PMH metadata format that currently exposes direct links to each record’s files content, via thedcat:Distribution
elements.
marc21
MARC21 — export format primarily supported for legacy reasons. Please considerusing one of the other export formats as we may discontinue support for MARC21.
We support both harvesting of theentire repository as well asselectiveharvesting of communities.
To harvest the entire repository, entirely skip theset
parameter (you still need to pass the requiredmetadataPrefix
parameter).
''' Harvest the entire repository '''records=sickle.ListRecords(metadataPrefix='oai_dc')record=records.next()# <Record oai:zenodo.org:3442216>
user-<identifier>
Community sets — allows selective harvesting of specific communities. Replace<identifier>
with the community identifier. Alternatively each communityprovides a direct harvesting API link on their front-page, which includes thecorrect community identifier.
''' Fetch a couple of records from the OAI Set of the "cfa" community '''records=sickle.ListRecords(metadataPrefix='oai_dc',set='user-cfa')record=records.next()''' To inspect on what sets a record is in '''record.header.setSpecs# ['openaire_data', 'user-cfa']
There is also the possibility of using different metadata formats. For that, we only need to replace themetadataPrefix
argument.
''' Community harvest using "oai_datacite" metadata format '''records=sickle.ListRecords(metadataPrefix='oai_datacite',set='user-cfa')record=records.next()''' Retrieving metadata from the record '''record.metadata# {# "title": ["Computing and Using Metrics in ADS"],# "creatorName": ["Henneken, Edwin"],# "identifier": ["10.5281/zenodo.10897"],# ...# }
Using multiple filters to harvest records enables a higher level of granularity, allowing us to retrieve specific groups of records.
''' Selecting harvesting using "from" '''records=sickle.ListRecords(**{'metadataPrefix':'oai_dc','set':'user-cfa','from':'2019-01-01',})records.next()# <Record oai:zenodo.org:7661>records.next()# <Record oai:zenodo.org:6738>
If you need selective harvesting and your use case is not supported by abovesets, you cancontact us and we can trycreate a specific set for you.
Most updates are available immediately, some few updates are only reflected in the OAI sets once an hour.
{"creators":[{"orcid":"0000-0002-1825-0097","affiliation":"Feline reasearch institute","name":"Field, Gar"},{"orcid":"0000-0002-1825-0097","affiliation":"Feline reasearch institute","name":"Cat, Felix"}],"license":"Apache-2.0","title":"Red-Dot: ML-powered laser vector detection","related_identifiers":[{"scheme":"doi","identifier":"10.1234/software.paper.5678","relation":"isDocumentedBy","resource_type":"publication-article"}],"keywords":["Cats","Laser","Behavior"],"communities":[{"identifier":"software-cats"}],"grants":[{"id":"777541"}]}
We automatically extract metadata about your release from GitHub APIs. For example, the authors are determined from the repository’s contributor statistics. To overwrite some of the default metadata that would come from a regular GitHub release you can include a.zenodo.json
file at the root of your GitHub repository.
The contents of the.zenodo.json
file are based on ourdeposit metadata documentation and can be structurally validated using ourlegacy deposit JSON Schema.
In the example shown, we add metadata regarding:
creators
fieldlicense
fieldtitle
fieldrelated_identifiers
fieldkeywords
fieldcommunities
fieldgrants
fieldAfter creating your.zenodo.json
file you should validate it to make sure that it contains valid JSON. You can use a tool like theJSON Formatter & Validator, or load it via your favorite programming language.
For our content and services to be available to everyone we have to make sure that our resources are being distributed fairly. To achieve this, we have rate-limiting measures in place which limit the number of requests users can perform in a time window. Depending on the complexity and load of each request, different endpoints have different limits configured.
Pages | Limitations |
---|---|
Global limit for guest users | 60 requests per minute, 2000 requests per hour |
Global limit forauthenticated users | 100 requests per minute, 5000 requests per hour |
OAI-PMH API harvesting | 120 requests per minute |
Thumbnails for image records | 20 requests per minute |
When you are making requests to any of our endpoints, you can inspect the following HTTP response headers for more information of your current rate-limit status:
HTTP header | Description |
---|---|
X-RateLimit-Limit | Current rate-limit policy, i.e. maximum number of requests per minute |
X-RateLimit-Remaining | Number of requests remaining in the current rate limit |
X-RateLimit-Reset | Reset time of the current rate limit |