API reference
Generated from the source with mkdocstrings.
Client
dataphora.DataphoraClient
Bases: BaseApiClient
Client for the DataCite REST API.
Public reads need no credentials. The client sends
Accept: application/vnd.api+json on every request and paces itself
at the anonymous limit documented by DataCite (500 requests per 5
minutes) by default.
dois
cached
property
The DOIs resource client.
activities
cached
property
The global activities resource client.
clients
cached
property
The repository accounts resource client.
client_prefixes
cached
property
The client prefix assignments resource client.
providers
cached
property
The DataCite members resource client.
provider_prefixes
cached
property
The provider prefix assignments resource client.
repositories
cached
property
The re3data/OpenDOAR repository view resource client.
prefixes
cached
property
The DOI prefixes resource client.
events
cached
property
The citation events resource client.
graphql
cached
property
The public GraphQL API client.
heartbeat()
async
Return True when the API answers GET /heartbeat with OK.
The route needs no credentials and answers a plain OK. An error
status raises, as with every request.
Sync client
dataphora.DataphoraSyncClient
Bases: SyncBaseApiClient
Client for the DataCite REST API.
Public reads need no credentials. The client sends
Accept: application/vnd.api+json on every request and paces itself
at the anonymous limit documented by DataCite (500 requests per 5
minutes) by default.
dois
cached
property
The DOIs resource client.
activities
cached
property
The global activities resource client.
clients
cached
property
The repository accounts resource client.
client_prefixes
cached
property
The client prefix assignments resource client.
providers
cached
property
The DataCite members resource client.
provider_prefixes
cached
property
The provider prefix assignments resource client.
repositories
cached
property
The re3data/OpenDOAR repository view resource client.
prefixes
cached
property
The DOI prefixes resource client.
events
cached
property
The citation events resource client.
graphql
cached
property
The public GraphQL API client.
heartbeat()
Return True when the API answers GET /heartbeat with OK.
The route needs no credentials and answers a plain OK. An error
status raises, as with every request.
The sync twins of the resource clients are exported from the package root
(DoisSyncClient, ClientsSyncClient, and so on). They mirror the
async resource clients method for method.
Settings
dataphora.DataphoraSettings
Bases: BaseApiSettings
DataCite-specific client settings.
Inherits timeout, max_retries, max_retry_wait,
max_requests_per_second, max_concurrency, user_agent and
mailto from :class:bibliofabric.config.BaseApiSettings and sets
DataCite defaults (1.5 req/s, concurrency 3). Public reads need no
credentials; the client never sends them.
Resource clients
Each resource client inherits the generic operations from
bibliofabric.ResourceClient (get, exists, search, iterate,
collect, first, count, batch_get) through
dataphora._async.dialect.DataphoraResourceClient. Only class-specific
members are shown here.
dataphora._async.dois.DoisClient
Bases: DataphoraDoiClient[DataphoraDoi]
Client for the /dois endpoint.
Generic operations (get, exists, search, iterate,
collect, first, count) come from
:class:bibliofabric.ResourceClient. iterate() walks with
page[cursor] so it can pass the 10,000-record limit of numbered
paging; cursor walks always run in created ascending order.
activities(doi)
async
Return the provenance activities of one DOI, newest first.
The route pages like every list route, so the method reads every
page of up to 1000 records. The links.next link of these pages
points at the global /activities route, so the method numbers
the pages itself and stops at the first 10,000 records, the limit
of numbered paging.
dataphora._async.dois.ActivitiesClient
Bases: DataphoraDoiClient[DataphoraActivity]
Client for the global /activities endpoint.
For the activities of one DOI, prefer
:meth:DoisClient.activities; this client lists and fetches
activities across all DOIs. The route accepts page[size],
page[number], and page[cursor]. Without a login its id and
ids[] filters answer nothing, so the client has no typed filter
model; narrow a search with query and quote a value that contains
a slash (query='"10.5438/0012"'), because the bare value is a
400. Fetch one activity with get().
normalize_id(value)
Return the activity id unchanged (uuids, kept verbatim).
dataphora._async.registry.ClientsClient
Bases: DataphoraResourceClient[DataphoraClientRecord]
Client for the /clients endpoint.
activities(id, *, page=None, page_size=None)
async
Return one page of the provenance activities of this client.
Numbered paging only: upstream's next link leaves the client's own
activities (see :func:_account_activities), so the page's
next_cursor is always None.
dois(id, **kwargs)
async
Return one page of the DOIs registered by this client.
Keyword arguments forward to :meth:bibliofabric.ResourceClient.search
(query, sort, page_size, cursor, select, and
friends).
totals(*, provider_id=None, state=None)
async
Return per-client DOI production statistics (/clients/totals).
provider_id narrows the entries to the clients of one provider,
or of several when it is a sequence. state is documented
upstream, but without a login it does not change the answer. The
answer is not paged; without a provider it is large (about 1.5 MB).
dataphora._async.registry.ProvidersClient
Bases: DataphoraResourceClient[DataphoraProvider]
Client for the /providers endpoint.
activities(id, *, page=None, page_size=None)
async
Return one page of the provenance activities of this provider.
Numbered paging only; the page's next_cursor is always None
(see :meth:ClientsClient.activities).
dois(id, **kwargs)
async
Return one page of the DOIs registered under this provider.
totals(*, state=None)
async
Return per-provider DOI production statistics (/providers/totals).
state is documented upstream, but without a login it does not
change the answer. The answer is not paged (about 0.6 MB).
dataphora._async.registry.RepositoriesClient
Bases: DataphoraResourceClient[DataphoraRepository]
Client for the /repositories endpoint.
The route is an alias of /clients and serves every account,
periodicals included; ids match :class:ClientsClient ids
(datacite.datacite).
dois(id, **kwargs)
async
Return one page of the DOIs registered by this repository.
dataphora._async.registry.PrefixesClient
Bases: DataphoraResourceClient[DataphoraPrefix]
Client for the /prefixes endpoint.
dois(id, **kwargs)
async
Return one page of the DOIs registered under this prefix.
totals(client_id)
async
Return DOI production statistics per prefix of one client.
client_id is required: without client-id the route
/prefixes/totals answers 204 No Content (verified
2026-11-28). A client without prefixes answers an empty list.
dataphora._async.registry.ClientPrefixesClient
dataphora._async.registry.ProviderPrefixesClient
dataphora._async.events.EventsClient
Bases: DataphoraResourceClient[DataphoraEvent]
Client for the /events endpoint.
Events are the citation graph DataCite records between identifiers;
the collection is large, so prefer first(), search() with a
filter, or count() over full iterate() walks.
dataphora._async.graphql.GraphqlClient
The public GraphQL API of DataCite.
The schema covers the same records as the REST API (works, persons,
organizations, repositories, funders, prefixes, and events) and adds the
connections between them. Queries need no credentials. The schema also
lists three mutations (createClaim, deleteClaim, and
updateUserProfile); they need a bearer token and are out of scope.
DataCite will retire the GraphQL API in July 2027 and asks its users to move to the REST API (announced on the DataCite support portal). New code should use the REST resources of this client.
query(query, variables=None)
async
Run one GraphQL query and return its data object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The GraphQL document, for example
|
required |
variables
|
Mapping[str, Any] | None
|
Values for the variables that |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The |
dict[str, Any]
|
lists. The answer shape follows the query, so the client does |
dict[str, Any]
|
not validate it. |
Raises:
| Type | Description |
|---|---|
ConfigurationError
|
|
APIError
|
DataCite rejected the query, or a field failed. The
|
Filter models
Every filter model dumps with by_alias=True into DataCite hyphenated keys
and allows extra fields.
dataphora.filters.DoiFilters
Bases: BaseModel
Filter model for the /dois route.
state is findable, registered, or draft. Without a login
the API ignores registered and draft and answers as for
findable. affiliation-id and funded-by take ROR ids,
funder-id a Crossref Funder ID, and user-id an ORCID iD, bare or
as a URL. Date filters (created, registered, published) take a
year or a comma-separated list of years. field-of-science takes the
plain label (natural sciences). has-citations,
has-references, has-parts, has-part-of, has-versions,
has-version-of, has-views, and has-downloads take a minimum
count (1); true does not work for them, while it does for
has-person, has-affiliation, has-organization, and
has-funder. random=true draws random records, and
sample_group="client" draws one random record per client account (a
slow query, about two minutes on 2026-11-28). sample_size did not
change the number of records on 2026-11-28; the page size decides how
many of the drawn records come back.
dataphora.filters.ClientFilters
Bases: BaseModel
Filter model for the /clients route.
client-type is repository, periodical, igsnCatalog, or
raidRegistry; repository-type is disciplinary,
governmental, institutional, multidisciplinary,
project-related, or other; year is the year the client was
created; software is the repository software (dspace).
dataphora.filters.ProviderFilters
Bases: BaseModel
Filter model for the /providers route.
member-type is one of consortium_organization, direct_member,
consortium, member_only, or developer (underscores, as in the
payloads); region is emea, amer, or apac, in any case.
dataphora.filters.RepositoryFilters
Bases: ClientFilters
Filter model for the /repositories route.
The route serves every client account, periodicals included, and accepts
the filters of /clients plus consortium-id.
dataphora.filters.PrefixFilters
Bases: BaseModel
Filter model for the /prefixes route.
state is with-repository, without-repository, or
unassigned.
dataphora.filters.ClientPrefixFilters
Bases: BaseModel
Filter model for the /client-prefixes route.
dataphora.filters.ProviderPrefixFilters
Bases: BaseModel
Filter model for the /provider-prefixes route.
dataphora.filters.EventFilters
Bases: BaseModel
Filter model for the /events route.
relation-type-id takes DataCite relation type ids in their stored
spelling (references, is-referenced-by, cites); subj-id
and obj-id take the full identifier URLs, doi a bare DOI that
may appear on either side. The unfiltered collection is large and slow,
so prefer a filter.
Dialect and helpers
dataphora.dialect
DataCite query dialect constants.
DATACITE_DIALECT tells bibliofabric how DataCite names its query
parameters. The resource-client base that consumes these constants lives in
:mod:dataphora._async.dialect (its sync twin is generated from it).
Verified against the live API and the DataCite reference on 2026-11-28:
- The default page size is 25;
page[size]accepts 0 to 1000. - Numbered paging (
page[number]) can reach the first 10,000 records of a query only. Beyond that the API answers with the last reachable page again instead of an error, so the resource clients raiseConfigurationErrorfirst.page[cursor]paging has no depth limit and always walks increatedascending order.
DATACITE_API_BASE_URL = 'https://api.datacite.org'
module-attribute
DATACITE_MAX_PAGE_SIZE = 1000
module-attribute
DATACITE_MAX_NUMBERED_RESULTS = 10000
module-attribute
DATACITE_DIALECT = QueryDialect(page_size_param='page[size]', max_page_size=DATACITE_MAX_PAGE_SIZE, default_page_size=DATACITE_PAGE_SIZE, iterate_page_size=DATACITE_ITERATE_PAGE_SIZE, count_page_size=1, page_param='page[number]', page_start=1, max_offset=DATACITE_MAX_NUMBERED_RESULTS, cursor_param='page[cursor]', cursor_start='1', sort_param='sort', query_param='query', select_param='fields[dois]')
module-attribute
dataphora._async.dialect.DataphoraResourceClient
Bases: ResourceClient[E]
Base client for DataCite resources: filter serialization and dialect.
batch_get() is disabled (batch_size = 0): DataCite has no route
that reads several records by id, and it silently ignores unknown query
parameters.
build_filter_params(filters)
Convert filter criteria into DataCite query parameters.
dataphora.filters.serialize_filter_params(filters)
Convert filter criteria into DataCite query parameters.
Each criterion becomes its own parameter. A sequence value joins with
commas (DataCite reads that as OR); None values are dropped.
dataphora.models.common.DataphoraResource
Bases: DataphoraModel
A flattened JSON:API resource.
A raw resource object {"id": ..., "type": ..., "attributes": {...},
"relationships": {...}, "links": {...}} validates into one model whose
fields are id, the attributes at top level, and relationships and
links as attributes of their own. Passing an already-flat dict (for
example DataphoraDoi(doi="10.5438/0012")) also works.
dataphora.models.common.resource_ids(relationship)
Return the ids a relationship points at, in order.
Models
Record models live in dataphora.models and re-export from the
top-level package (from dataphora import DataphoraDoi, ...). They
are plain Pydantic models; see the source for the full field list.
dataphora.models.DataphoraDoi
Bases: DataphoraResource
A DataCite DOI record.
id and doi are the same DOI string. state is findable,
registered, or draft; anonymous reads only see findable
records. The usage counters (viewCount, downloadCount,
citationCount, and friends) arrive with every record, while the
xml metadata and the *OverTime series only arrive with
detail=true.
client_id
property
The repository (client) account that registered the DOI.
provider_id
property
The DataCite provider (member) behind the registering client.
resource_type
property
The resourceTypeGeneral value (dataset, text).
title
property
The first title text, None when the record has no titles.
dataphora.models.DataphoraClientRecord
Bases: DataphoraResource
A DataCite client account: the repository or periodical that registers DOIs under a provider.
dataphora.models.DataphoraProvider
Bases: DataphoraResource
A DataCite provider: the member or consortium organization that manages clients and prefixes.
dataphora.models.DataphoraRepository
dataphora.models.DataphoraPrefix
Bases: DataphoraResource
A DataCite DOI prefix (10.5438).
id and prefix are the same string; createdAt is the only
other attribute the API returns.
dataphora.models.DataphoraEvent
Bases: DataphoraResource
A DataCite event: one relation between two identifiers.
Attribute keys are hyphenated upstream; the fields here carry aliases
so both spellings validate. subj-id and obj-id name the two
ends, relation-type-id the relation (references, cites,
is-cited-by); the subj and obj relationships hold the
identifier pairs, and occurred-at the event time.
dataphora.models.DataphoraActivity
Bases: DataphoraResource
One provenance activity in the history of a DOI or an account.
The prov_* fields carry the prov: attributes upstream: which
activity ran, when, which DOI or account it changed, and which account
made the change. changes maps each changed attribute to its
[old, new] pair.
dataphora.models.DataphoraClientPrefix
Bases: DataphoraResource
The assignment of one DOI prefix to one client account.
The prefix and the account are relationships (prefix, client);
the resource itself only carries timestamps.
dataphora.models.DataphoraProviderPrefix
Bases: DataphoraResource
The assignment of one DOI prefix to one provider.
The prefix and the provider are relationships (prefix,
provider); the resource itself only carries timestamps.
dataphora.models.DataphoraTotals
Bases: DataphoraModel
One entry of a /totals statistics route.
temporal groups counts by this_month, this_year,
last_year, and two_years_ago; states breaks the count down
by DOI state. The body of these routes is a bare array, not a JSON:API
envelope.