API reference
Generated from the source with mkdocstrings.
Client
zenotheca.ZenothecaClient
Bases: BaseApiClient
Client for the Zenodo REST API and its OAI-PMH endpoint.
Public reads need no credentials. With api_token set the client
sends Authorization: Bearer on every request and allows the larger
authenticated page size. The client sends Accept: application/json
and a User-Agent on every request; Zenodo rejects requests without
a User-Agent.
records
cached
property
The records resource client.
communities
cached
property
The communities resource client.
vocabularies
cached
property
The vocabularies resource client.
oai
cached
property
The OAI-PMH client for https://zenodo.org/oai2d.
rate_class(request)
Pace the two search routes in their own class.
Callers without a token get 30 search requests per minute, far
fewer than the 133 of the other routes, so the record search and
the search over the records of one community get the search
rate class of :attr:ZenothecaSettings.rate_limits.
Sync client
zenotheca.ZenothecaSyncClient
Bases: SyncBaseApiClient
Client for the Zenodo REST API and its OAI-PMH endpoint.
Public reads need no credentials. With api_token set the client
sends Authorization: Bearer on every request and allows the larger
authenticated page size. The client sends Accept: application/json
and a User-Agent on every request; Zenodo rejects requests without
a User-Agent.
records
cached
property
The records resource client.
communities
cached
property
The communities resource client.
vocabularies
cached
property
The vocabularies resource client.
oai
cached
property
The OAI-PMH client for https://zenodo.org/oai2d.
The sync twins of the resource clients are exported from the package root
(ZenothecaRecordsSyncClient, ZenothecaCommunitiesSyncClient,
VocabulariesSyncClient, OaiSyncClient). They
mirror the async resource clients method for method.
Settings
zenotheca.ZenothecaSettings
Bases: BaseApiSettings
Zenodo-specific client settings.
Inherits timeout, max_retries, max_retry_wait,
max_requests_per_second, max_concurrency, rate_limits,
user_agent and mailto from :class:bibliofabric.config.BaseApiSettings
and sets Zenodo defaults: 2 requests per second, concurrency 5, and a
search class at one request every 2 seconds for the two search
routes, which allow 30 requests per minute without a token. Public
reads need no credentials. Zenodo rejects requests without a
User-Agent header; the client always sends one.
api_token = Field(default=None, repr=False)
class-attribute
instance-attribute
Optional Zenodo access token.
Sent as Authorization: Bearer; lifts the page size cap from 25 to
the documented 100 and grants access to private record reads. Public
reads work without it.
Resource clients
Each resource client inherits the generic operations from
bibliofabric.ResourceClient (get, search, iterate, collect,
first, count) through zenotheca._async.dialect.ZenothecaResourceClient.
Only the members that Zenodo changes or adds are shown here.
zenotheca._async.records.ZenothecaRecordsClient
Bases: ZenothecaResourceClient[ZenothecaRecord]
Client for the /records endpoints.
get accepts a version id (24378467) or a concept id
(6347574); a concept id follows Zenodo's redirect and answers the
newest version. versions and latest need a version id.
get(id, *, select=None, params=None)
async
Fetch one record by version or concept id.
Zenodo answers a concept id with a redirect to the newest version;
the redirect is followed. 404 raises :class:NotFoundError.
search(filters=None, *, query=None, sort=None, select=None, page=None, page_size=None, cursor=None, on_error='raise', failures=None, params=None, all_versions=False)
async
Fetch one page of records.
query is an Elasticsearch query string (build clauses with
:mod:zenotheca.filters). sort accepts bestmatch,
mostrecent, and -mostrecent; mostrecent orders by last
update, not by publication date. all_versions counts every
version of each matching concept, not only the newest.
:attr:Page.meta carries the facet counts (access_status,
file_type, publication_date, resource_type,
subject).
iterate(filters=None, *, query=None, sort=None, select=None, page_size=None, limit=None, cursor=None, on_error='raise', failures=None, on_page=None, params=None, all_versions=False)
Iterate over all matching records, page by page.
Accepts the same arguments as :meth:search. Iteration stops at
limit, on an empty page, when hits.total records were seen,
or when a page would cross the Elasticsearch max_result_window
of 10,000 results.
count(filters=None, *, query=None, params=None, all_versions=False)
async
Return hits.total of the query.
versions(id, *, page=None, page_size=None, on_error='raise', failures=None, params=None)
async
List the versions of one concept, newest first.
id is any version id of the concept (24378467); a concept
id answers 404. Zenodo pages the list like a search (default
size 25, sorted by version) and reports the family size in
hits.total.
latest(id)
async
Return the newest version of the concept id belongs to.
id is any version id; Zenodo answers the versions/latest
route with a redirect to the newest version, which is followed.
files(id)
async
List the files of one record version.
Returns the full listing with one :class:ZenothecaFileEntry per
file; the file list embedded in a record is shorter.
download_file(id, key, dest)
async
Stream one file of a record version to dest and return the path.
key is the file name from the record's files list or from
:meth:files. Creates parent directories and overwrites an
existing file.
communities(id, *, page=None, page_size=None)
async
List the communities that include one record version.
Zenodo pages the list like a search and reports the number of
communities in hits.total.
export(id, format)
async
Return one record version in an export format, as text.
format is a name from :data:zenotheca.RECORD_EXPORT_FORMATS,
such as bibtex, csl, datacite-json, or dcat-ap. The
exports live on the website (/records/{id}/export/{format}), not
under /api; an unknown format answers 404.
zenotheca._async.communities.ZenothecaCommunitiesClient
Bases: ZenothecaResourceClient[ZenothecaCommunity]
Client for the /communities endpoints.
get, :meth:search, and :meth:iterate accept the community slug
(ror-data) or the community URL. The community id the API
returns is a UUID that the /communities/{id} routes accept too.
records(id, filters=None, *, query=None, sort=None, page=None, page_size=None, on_error='raise', failures=None, params=None, all_versions=False)
async
Search the records accepted into one community.
Accepts the query parameters of the records search; filters
takes a mapping such as {"type": "dataset"}. The route answers
the same envelope, so :attr:Page.meta carries the records facet
counts.
subcommunities(id, filters=None, *, query=None, sort=None, page=None, page_size=None, on_error='raise', failures=None, params=None)
async
List the subcommunities of one community.
The route answers the community envelope with sortBy newest
and the type, funder, and organization facets; most
communities carry no children, so total is usually 0.
zenotheca._async.vocabularies.VocabulariesClient
Client for the vocabulary routes.
A vocabulary is a reference list. Most live under /vocabularies/{name}
(resourcetypes, licenses, languages, communitytypes).
The four large ones have their own top-level routes, which the client
picks for these names: funders, awards, affiliations, and
subjects (/funders and so on). Unknown names answer 404. Entries
page like a search (size, page, q).
get(name, id)
async
Return one entry of vocabulary name; 404 raises NotFoundError.
iterate(name, *, query=None, page_size=None, limit=None, params=None)
Iterate over every entry of vocabulary name; limit stops early.
search(name, *, query=None, page=None, page_size=None, params=None)
async
Fetch one page of the entries of vocabulary name.
zenotheca._async.oai.OaiClient
Client for the six OAI-PMH verbs of Zenodo.
list_records and list_identifiers accept from, until,
set, and resumption_token; the iterate_records and
iterate_identifiers helpers follow the resumption tokens until the
repository reports the end of the list.
get_record(identifier, metadata_prefix)
async
Return one record by its OAI identifier (oai:zenodo.org:<id>).
identify()
async
Return the repository identity (Identify).
iterate_identifiers(metadata_prefix, *, from_=None, until=None, set=None)
async
Yield every record header that matches, following resumption tokens.
iterate_records(metadata_prefix, *, from_=None, until=None, set=None)
async
Yield every record that matches, following resumption tokens.
list_identifiers(metadata_prefix, *, from_=None, until=None, set=None, resumption_token=None)
async
Return one page of record headers.
list_metadata_formats(*, identifier=None)
async
Return the metadata prefixes the repository offers.
list_records(metadata_prefix, *, from_=None, until=None, set=None, resumption_token=None)
async
Return one page of records with raw metadata payloads.
list_sets(*, resumption_token=None)
async
Return one page of sets; pass the resumption token for the next page.
zenotheca._async.dialect.ZenothecaResourceClient
Bases: ResourceClient[E]
Base client for Zenodo resources: the shared query dialect.
with_params(params, *, all_versions=False)
staticmethod
Merge the all_versions switch into params.
Query helpers
zenotheca.filters.term(field, value)
Return field:value as a bare term clause.
Use this for values without whitespace or special characters, such as
term("communities", "ror-data"). Anything else needs
:func:phrase.
zenotheca.filters.phrase(field, value)
Return field:"value" as a quoted phrase clause (title:"ROR Data").
zenotheca.filters.community(slug)
Return the communities:<slug> clause (verified 2026-11-27).
zenotheca.filters.resource_type(value)
Return the type:<value> clause (dataset, publication, ...).
zenotheca.filters.any_of(*clauses)
Join clauses with OR; a single clause passes through unchanged.
zenotheca.filters.all_of(*clauses)
Join clauses with the implicit AND of the query string.
Identifier helpers
zenotheca.ids.normalize_record_id(value)
Return the bare numeric record or concept id behind value.
Accepts the bare id (24378467), a DOI
(10.5281/zenodo.24378467), and Zenodo record URLs
(https://zenodo.org/records/24378467 and the /api/records/ and
/record/ variants). A value that does not resolve to a numeric id
raises :class:ConfigurationError.
zenotheca.ids.normalize_community_slug(value)
Return the bare community slug behind value.
Accepts the bare slug (ror-data) and the community URL
(https://zenodo.org/communities/ror-data).
Dialect
zenotheca.dialect
Zenodo query dialect constants.
ZENODO_DIALECT tells bibliofabric how Zenodo names its query parameters.
The resource-client base that consumes these constants lives in
:mod:zenotheca._async.dialect (its sync twin is generated from it).
ZENODO_API_BASE_URL = 'https://zenodo.org/api'
module-attribute
ZENODO_OAI_BASE_URL = 'https://zenodo.org/oai2d'
module-attribute
ZENODO_MAX_PAGE_SIZE = 25
module-attribute
ZENODO_DEFAULT_PAGE_SIZE = 25
module-attribute
ZENODO_MAX_RESULT_WINDOW = 10000
module-attribute
RECORD_SORT_OPTIONS = frozenset({'bestmatch', 'mostrecent', '-mostrecent'})
module-attribute
RECORD_EXPORT_FORMATS = frozenset({'bibtex', 'cff', 'codemeta', 'csl', 'datacite-json', 'datacite-xml', 'dcat-ap', 'dublincore', 'geojson', 'json', 'json-ld', 'marcxml'})
module-attribute
TOP_LEVEL_VOCABULARIES = frozenset({'affiliations', 'awards', 'funders', 'subjects'})
module-attribute
ZENODO_SEARCH_RATE_CLASS = 'search'
module-attribute
ZENODO_SEARCH_REQUESTS_PER_SECOND = 0.5
module-attribute
is_search_route(path, api_path='/api')
Return whether path is one of the two Zenodo search routes.
The record search (/records) and the search over the records of one
community (/communities/{slug}/records) share the stricter limit of
the search engine. Every other route, including OAI-PMH, does not.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path of the request URL. |
required |
api_path
|
str
|
Path prefix of the REST API below the host. |
'/api'
|
Models
Entity models live in zenotheca.models and re-export from the top-level
package (from zenotheca import ZenothecaRecord, ...). They are plain
Pydantic models with extra="allow"; see the source for the full field
list.
zenotheca.models.ZenothecaRecord
Bases: BaseModel
One Zenodo record (a published version of a concept).
id is the numeric version id, conceptrecid the id of the version
family, and recid repeats id as a string. state is done
on published records and status is published. links maps the
related routes (self, latest, versions, parent,
files, ...).
concept_id
property
The concept id (conceptrecid), shared by every version.
zenotheca.models.ZenothecaRecordMetadata
Bases: BaseModel
The metadata block of a record.
Legacy deposit fields (journal, part_of, thesis, ...),
granted fields, and any field added upstream are kept through
extra="allow".
concept_id
property
The concept id from relations.version[0].parent.pid_value, if any.
zenotheca.models.ZenothecaFiles
Bases: BaseModel
The answer of GET /records/{id}/files.
keys
property
The file keys in order when set, else the entries order.
zenotheca.models.ZenothecaFileEntry
Bases: BaseModel
One entry of the /records/{id}/files listing.
Carries more detail than the file list embedded in a record:
mimetype, version_id, bucket_id, and links with the
self, content, and container routes.
zenotheca.models.ZenothecaCommunity
Bases: BaseModel
One Zenodo community.
id is the stable UUID the API routes accept; slug is the short
name (ror-data) that the /communities/{slug} routes and the
communities parameter of the records search accept too.
zenotheca.models.ZenothecaCommunityMetadata
Bases: BaseModel
The metadata block of a community.
zenotheca.models.ZenothecaVocabulary
Bases: BaseModel
One entry of a Zenodo vocabulary (resourcetypes, licenses, ...).
title and description map language codes to texts; props
carries the vocabulary-specific extra properties (schema.org,
datacite_general, alpha_2, ...).
english_title
property
The en title, else the first title the entry carries.
zenotheca.models.OaiIdentifyResponse
Bases: BaseModel
The answer of Identify.
zenotheca.models.OaiFormats
Bases: BaseModel
The answer of ListMetadataFormats.
zenotheca.models.OaiSets
Bases: BaseModel
One page of ListSets.
zenotheca.models.OaiIdentifiers
Bases: BaseModel
One page of ListIdentifiers.
zenotheca.models.OaiRecords
Bases: BaseModel
One page of ListRecords.
zenotheca.models.OaiRecordResponse
Bases: BaseModel
The answer of GetRecord.
zenotheca.models.OaiRecord
Bases: BaseModel
One OAI-PMH record.
metadata is the raw XML string of the metadata element, tagged with
the metadata_prefix that produced it and the namespace URI of that
prefix. about holds the raw XML strings of the about elements.
zenotheca.models.OaiHeader
Bases: BaseModel
The header of an OAI record (identifier, datestamp, sets).
deleted
property
Whether the record carries status="deleted".
zenotheca.models.OaiResumptionToken
Bases: BaseModel
An OAI-PMH resumption token with its attributes.