Skip to content

API reference

Async client

stavrophora._async.client

The Crossref API client; the sync twin is generated by scripts/unasync.py.

StavrophoraClient

Bases: BaseApiClient

Client for the Crossref API.

StavrophoraClient drives async code and its generated twin StavrophoraSyncClient drives synchronous code; both expose the same resources and methods.

Credentials are resolved in the constructor: an explicit auth_strategy wins, then a Metadata Plus key (crossref-api-key header), then mailto (polite pool via query parameter). When rate_limits, max_concurrency, and max_requests_per_second are not explicitly set on settings, pool-aware defaults apply: Metadata Plus (50/50 req/s, concurrency 10), Polite Pool (10/3 req/s, concurrency 3), or Public Pool (5/1 req/s, concurrency 1).

Source code in packages/stavrophora/src/stavrophora/_async/client.py
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
class StavrophoraClient(BaseApiClient):
    """Client for the Crossref API.

    ``StavrophoraClient`` drives async code and its generated twin
    ``StavrophoraSyncClient`` drives synchronous code; both expose the same
    resources and methods.

    Credentials are resolved in the constructor: an explicit ``auth_strategy``
    wins, then a Metadata Plus key (``crossref-api-key`` header), then
    ``mailto`` (polite pool via query parameter). When ``rate_limits``,
    ``max_concurrency``, and ``max_requests_per_second`` are not explicitly
    set on ``settings``, pool-aware defaults apply: Metadata Plus
    (``50/50`` req/s, concurrency ``10``), Polite Pool (``10/3`` req/s,
    concurrency ``3``), or Public Pool (``5/1`` req/s, concurrency ``1``).
    """

    def __init__(
        self,
        settings: StavrophoraSettings | None = None,
        *,
        mailto: str | None = None,
        plus_token: str | None = None,
        base_url: str | None = None,
        auth_strategy: AuthStrategy | None = None,
    ) -> None:
        resolved = settings or get_settings()
        mailto = mailto or resolved.mailto
        plus_token = plus_token or resolved.plus_token

        if plus_token:
            pool_rate_limits = _PLUS_RATE_LIMITS
            pool_concurrency = _PLUS_CONCURRENCY
        elif mailto:
            pool_rate_limits = _POLITE_RATE_LIMITS
            pool_concurrency = _POLITE_CONCURRENCY
        else:
            pool_rate_limits = _PUBLIC_RATE_LIMITS
            pool_concurrency = _PUBLIC_CONCURRENCY

        fields_set = resolved.model_fields_set
        updates: dict[str, Any] = {}
        if mailto and resolved.mailto != mailto:
            updates["mailto"] = mailto
        if (
            "rate_limits" not in fields_set
            and "max_requests_per_second" not in fields_set
        ):
            updates["rate_limits"] = dict(pool_rate_limits)
        if "max_concurrency" not in fields_set:
            updates["max_concurrency"] = pool_concurrency
        if updates:
            resolved = resolved.model_copy(update=updates)

        if auth_strategy is not None:
            auth = auth_strategy
        elif plus_token:
            auth = HeaderAuth(PLUS_TOKEN_HEADER, f"Bearer {plus_token}")
        elif mailto:
            auth = QueryParameterAuth("mailto", mailto)
        else:
            auth = NoAuth()
        super().__init__(
            base_url=base_url or CROSSREF_API_BASE_URL,
            settings=resolved,
            unwrapper=CrossrefUnwrapper(),
            auth=auth,
        )
        self._last_pool: str | None = None
        self._last_rate_limit_headers: dict[str, str] = {}

    @property
    def last_pool(self) -> str | None:
        """The ``x-api-pool`` header value from the most recent response, if any."""
        return self._last_pool

    @property
    def last_rate_limit_headers(self) -> dict[str, str]:
        """Crossref rate-limit headers captured from the most recent response."""
        return dict(self._last_rate_limit_headers)

    def on_response(self, response: httpx.Response) -> None:
        """Capture Crossref pool and rate-limit headers from each response."""
        captured: dict[str, str] = {}
        for header in _RATE_LIMIT_HEADERS:
            value = response.headers.get(header)
            if value is not None:
                captured[header] = value
        self._last_rate_limit_headers = captured
        self._last_pool = captured.get("x-api-pool")

    @cached_property
    def works(self) -> WorksResource:
        """The ``/works`` resource (search, iterate, batch DOI lookup, agency)."""
        return WorksResource(self)

    @cached_property
    def journals(self) -> JournalsResource:
        """The ``/journals`` resource."""
        return JournalsResource(self)

    @cached_property
    def funders(self) -> FundersResource:
        """The ``/funders`` resource."""
        return FundersResource(self)

    @cached_property
    def members(self) -> MembersResource:
        """The ``/members`` resource."""
        return MembersResource(self)

    @cached_property
    def types(self) -> TypesResource:
        """The ``/types`` resource."""
        return TypesResource(self)

    @cached_property
    def prefixes(self) -> PrefixesResource:
        """The ``/prefixes`` resource."""
        return PrefixesResource(self)

    @cached_property
    def licenses(self) -> LicensesResource:
        """The ``/licenses`` resource (list/iterate only)."""
        return LicensesResource(self)

    @cached_property
    def data_citations(self) -> DataCitationsResource:
        """The beta ``/beta/datacitations`` route (search, iterate, count)."""
        return DataCitationsResource(self)

    #: Only the top-level ``/works`` route is array-class. Everything else —
    #: single records, scoped ``/.../works`` routes, and all other routes —
    #: reports the ``polite-single`` pool in Crossref's ``x-api-pool`` header
    #: (2026-07-21 rate split; see the README and the phase 2 research). The
    #: beta data citations route reports its own ``datacitations`` pool.
    _TOP_LEVEL_WORKS = re.compile(r"^(/v1)?/works/?$")

    def rate_class(self, request: httpx.Request) -> str:
        """Map the request onto Crossref's polite pools (D-19)."""
        path = request.url.path
        if path.rstrip("/") == DATACITATIONS_PATH:
            return "datacitations"
        if self._TOP_LEVEL_WORKS.search(path):
            return "list"
        return "single"

data_citations cached property

The beta /beta/datacitations route (search, iterate, count).

funders cached property

The /funders resource.

journals cached property

The /journals resource.

last_pool property

The x-api-pool header value from the most recent response, if any.

last_rate_limit_headers property

Crossref rate-limit headers captured from the most recent response.

licenses cached property

The /licenses resource (list/iterate only).

members cached property

The /members resource.

prefixes cached property

The /prefixes resource.

types cached property

The /types resource.

works cached property

The /works resource (search, iterate, batch DOI lookup, agency).

on_response(response)

Capture Crossref pool and rate-limit headers from each response.

Source code in packages/stavrophora/src/stavrophora/_async/client.py
143
144
145
146
147
148
149
150
151
def on_response(self, response: httpx.Response) -> None:
    """Capture Crossref pool and rate-limit headers from each response."""
    captured: dict[str, str] = {}
    for header in _RATE_LIMIT_HEADERS:
        value = response.headers.get(header)
        if value is not None:
            captured[header] = value
    self._last_rate_limit_headers = captured
    self._last_pool = captured.get("x-api-pool")

rate_class(request)

Map the request onto Crossref's polite pools (D-19).

Source code in packages/stavrophora/src/stavrophora/_async/client.py
200
201
202
203
204
205
206
207
def rate_class(self, request: httpx.Request) -> str:
    """Map the request onto Crossref's polite pools (D-19)."""
    path = request.url.path
    if path.rstrip("/") == DATACITATIONS_PATH:
        return "datacitations"
    if self._TOP_LEVEL_WORKS.search(path):
        return "list"
    return "single"

Sync client

stavrophora._sync.client

The Crossref API client; the sync twin is generated by scripts/unasync.py.

StavrophoraSyncClient

Bases: SyncBaseApiClient

Client for the Crossref API.

StavrophoraClient drives async code and its generated twin StavrophoraSyncClient drives synchronous code; both expose the same resources and methods.

Credentials are resolved in the constructor: an explicit auth_strategy wins, then a Metadata Plus key (crossref-api-key header), then mailto (polite pool via query parameter). When rate_limits, max_concurrency, and max_requests_per_second are not explicitly set on settings, pool-aware defaults apply: Metadata Plus (50/50 req/s, concurrency 10), Polite Pool (10/3 req/s, concurrency 3), or Public Pool (5/1 req/s, concurrency 1).

Source code in packages/stavrophora/src/stavrophora/_sync/client.py
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
class StavrophoraSyncClient(SyncBaseApiClient):
    """Client for the Crossref API.

    ``StavrophoraClient`` drives async code and its generated twin
    ``StavrophoraSyncClient`` drives synchronous code; both expose the same
    resources and methods.

    Credentials are resolved in the constructor: an explicit ``auth_strategy``
    wins, then a Metadata Plus key (``crossref-api-key`` header), then
    ``mailto`` (polite pool via query parameter). When ``rate_limits``,
    ``max_concurrency``, and ``max_requests_per_second`` are not explicitly
    set on ``settings``, pool-aware defaults apply: Metadata Plus
    (``50/50`` req/s, concurrency ``10``), Polite Pool (``10/3`` req/s,
    concurrency ``3``), or Public Pool (``5/1`` req/s, concurrency ``1``).
    """

    def __init__(
        self,
        settings: StavrophoraSettings | None = None,
        *,
        mailto: str | None = None,
        plus_token: str | None = None,
        base_url: str | None = None,
        auth_strategy: AuthStrategy | None = None,
    ) -> None:
        resolved = settings or get_settings()
        mailto = mailto or resolved.mailto
        plus_token = plus_token or resolved.plus_token

        if plus_token:
            pool_rate_limits = _PLUS_RATE_LIMITS
            pool_concurrency = _PLUS_CONCURRENCY
        elif mailto:
            pool_rate_limits = _POLITE_RATE_LIMITS
            pool_concurrency = _POLITE_CONCURRENCY
        else:
            pool_rate_limits = _PUBLIC_RATE_LIMITS
            pool_concurrency = _PUBLIC_CONCURRENCY

        fields_set = resolved.model_fields_set
        updates: dict[str, Any] = {}
        if mailto and resolved.mailto != mailto:
            updates["mailto"] = mailto
        if (
            "rate_limits" not in fields_set
            and "max_requests_per_second" not in fields_set
        ):
            updates["rate_limits"] = dict(pool_rate_limits)
        if "max_concurrency" not in fields_set:
            updates["max_concurrency"] = pool_concurrency
        if updates:
            resolved = resolved.model_copy(update=updates)

        if auth_strategy is not None:
            auth = auth_strategy
        elif plus_token:
            auth = HeaderAuth(PLUS_TOKEN_HEADER, f"Bearer {plus_token}")
        elif mailto:
            auth = QueryParameterAuth("mailto", mailto)
        else:
            auth = NoAuth()
        super().__init__(
            base_url=base_url or CROSSREF_API_BASE_URL,
            settings=resolved,
            unwrapper=CrossrefUnwrapper(),
            auth=auth,
        )
        self._last_pool: str | None = None
        self._last_rate_limit_headers: dict[str, str] = {}

    @property
    def last_pool(self) -> str | None:
        """The ``x-api-pool`` header value from the most recent response, if any."""
        return self._last_pool

    @property
    def last_rate_limit_headers(self) -> dict[str, str]:
        """Crossref rate-limit headers captured from the most recent response."""
        return dict(self._last_rate_limit_headers)

    def on_response(self, response: httpx.Response) -> None:
        """Capture Crossref pool and rate-limit headers from each response."""
        captured: dict[str, str] = {}
        for header in _RATE_LIMIT_HEADERS:
            value = response.headers.get(header)
            if value is not None:
                captured[header] = value
        self._last_rate_limit_headers = captured
        self._last_pool = captured.get("x-api-pool")

    @cached_property
    def works(self) -> SyncWorksResource:
        """The ``/works`` resource (search, iterate, batch DOI lookup, agency)."""
        return SyncWorksResource(self)

    @cached_property
    def journals(self) -> SyncJournalsResource:
        """The ``/journals`` resource."""
        return SyncJournalsResource(self)

    @cached_property
    def funders(self) -> SyncFundersResource:
        """The ``/funders`` resource."""
        return SyncFundersResource(self)

    @cached_property
    def members(self) -> SyncMembersResource:
        """The ``/members`` resource."""
        return SyncMembersResource(self)

    @cached_property
    def types(self) -> SyncTypesResource:
        """The ``/types`` resource."""
        return SyncTypesResource(self)

    @cached_property
    def prefixes(self) -> SyncPrefixesResource:
        """The ``/prefixes`` resource."""
        return SyncPrefixesResource(self)

    @cached_property
    def licenses(self) -> SyncLicensesResource:
        """The ``/licenses`` resource (list/iterate only)."""
        return SyncLicensesResource(self)

    @cached_property
    def data_citations(self) -> SyncDataCitationsResource:
        """The beta ``/beta/datacitations`` route (search, iterate, count)."""
        return SyncDataCitationsResource(self)

    #: Only the top-level ``/works`` route is array-class. Everything else —
    #: single records, scoped ``/.../works`` routes, and all other routes —
    #: reports the ``polite-single`` pool in Crossref's ``x-api-pool`` header
    #: (2026-07-21 rate split; see the README and the phase 2 research). The
    #: beta data citations route reports its own ``datacitations`` pool.
    _TOP_LEVEL_WORKS = re.compile(r"^(/v1)?/works/?$")

    def rate_class(self, request: httpx.Request) -> str:
        """Map the request onto Crossref's polite pools (D-19)."""
        path = request.url.path
        if path.rstrip("/") == DATACITATIONS_PATH:
            return "datacitations"
        if self._TOP_LEVEL_WORKS.search(path):
            return "list"
        return "single"

data_citations cached property

The beta /beta/datacitations route (search, iterate, count).

funders cached property

The /funders resource.

journals cached property

The /journals resource.

last_pool property

The x-api-pool header value from the most recent response, if any.

last_rate_limit_headers property

Crossref rate-limit headers captured from the most recent response.

licenses cached property

The /licenses resource (list/iterate only).

members cached property

The /members resource.

prefixes cached property

The /prefixes resource.

types cached property

The /types resource.

works cached property

The /works resource (search, iterate, batch DOI lookup, agency).

on_response(response)

Capture Crossref pool and rate-limit headers from each response.

Source code in packages/stavrophora/src/stavrophora/_sync/client.py
144
145
146
147
148
149
150
151
152
def on_response(self, response: httpx.Response) -> None:
    """Capture Crossref pool and rate-limit headers from each response."""
    captured: dict[str, str] = {}
    for header in _RATE_LIMIT_HEADERS:
        value = response.headers.get(header)
        if value is not None:
            captured[header] = value
    self._last_rate_limit_headers = captured
    self._last_pool = captured.get("x-api-pool")

rate_class(request)

Map the request onto Crossref's polite pools (D-19).

Source code in packages/stavrophora/src/stavrophora/_sync/client.py
201
202
203
204
205
206
207
208
def rate_class(self, request: httpx.Request) -> str:
    """Map the request onto Crossref's polite pools (D-19)."""
    path = request.url.path
    if path.rstrip("/") == DATACITATIONS_PATH:
        return "datacitations"
    if self._TOP_LEVEL_WORKS.search(path):
        return "list"
    return "single"

Settings

stavrophora.config

Stavrophora settings for the Crossref API client.

StavrophoraSettings

Bases: BaseApiSettings

Crossref-specific tunables.

Loaded from environment variables prefixed with STAVROPHORA_ (or a .env file): STAVROPHORA_MAILTO for the polite pool, and STAVROPHORA_PLUS_TOKEN for a Metadata Plus key. Generic behavior (timeout, retries, pacing) is inherited from :class:bibliofabric.config.BaseApiSettings.

Source code in packages/stavrophora/src/stavrophora/config.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class StavrophoraSettings(BaseApiSettings):
    """Crossref-specific tunables.

    Loaded from environment variables prefixed with ``STAVROPHORA_`` (or a
    ``.env`` file): ``STAVROPHORA_MAILTO`` for the polite pool, and
    ``STAVROPHORA_PLUS_TOKEN`` for a Metadata Plus key. Generic behavior
    (timeout, retries, pacing) is inherited from
    :class:`bibliofabric.config.BaseApiSettings`.
    """

    model_config = SettingsConfigDict(
        env_prefix="STAVROPHORA_", env_file=".env", extra="ignore"
    )

    #: Defaults for the Crossref polite pool: top-level ``/works`` searches
    #: are the ``list`` class at 3 requests/s, the beta data citations route
    #: the ``datacitations`` class at 3 requests/s, everything else (single
    #: records, scoped ``/.../works`` routes, other routes) the ``single``
    #: class at 10 requests/s; ``max_concurrency`` is shared. When left unset,
    #: :class:`StavrophoraClient` selects pool-aware defaults for Public,
    #: Polite, or Metadata Plus credentials.
    rate_limits: dict[str, float | None] = Field(default_factory=_default_rate_limits)
    max_requests_per_second: float | None = Field(default=3.0, gt=0)
    max_concurrency: int = Field(default=3, gt=0)

    #: Contact email; sent as the ``mailto`` query parameter so requests land
    #: in the Crossref polite pool.
    mailto: str | None = None

    #: Metadata Plus key, sent as ``crossref-api-key: Bearer <token>``.
    plus_token: str | None = None

    @model_validator(mode="after")
    def _apply_uniform_rate_limit(self) -> Self:
        """Honor an explicit ``max_requests_per_second`` when ``rate_limits`` is unset.

        Setting ``max_requests_per_second=None`` (or a single uniform rate)
        without also specifying ``rate_limits`` clears the per-class map so
        every request class falls back to ``"default"`` (unthrottled or that
        uniform rate).
        """
        if (
            "max_requests_per_second" in self.model_fields_set
            and "rate_limits" not in self.model_fields_set
        ):
            self.rate_limits = {}
        return self

get_settings() cached

Provide cached access to application settings.

Source code in packages/stavrophora/src/stavrophora/config.py
64
65
66
67
@lru_cache
def get_settings() -> StavrophoraSettings:
    """Provide cached access to application settings."""
    return StavrophoraSettings()

Async resources

stavrophora._async.works

Works resources: the top-level /works route and parent-scoped works.

ScopedWorksResource

Bases: _WorksListResource

Works capabilities bound to a parent route, e.g. members/{id}/works.

Obtain instances via the parent's works() method; scoped routes accept the full works list parameter set and count as single-record requests for Crossref rate limiting. Single-work methods (get, exists, agency, latest_version) are omitted because Crossref serves them only at /works/{doi}.

Source code in packages/stavrophora/src/stavrophora/_async/works.py
422
423
424
425
426
427
428
429
430
class ScopedWorksResource(_WorksListResource):
    """Works capabilities bound to a parent route, e.g. ``members/{id}/works``.

    Obtain instances via the parent's ``works()`` method; scoped routes
    accept the full works list parameter set and count as single-record
    requests for Crossref rate limiting. Single-work methods (``get``,
    ``exists``, ``agency``, ``latest_version``) are omitted because Crossref
    serves them only at ``/works/{doi}``.
    """

WorksResource

Bases: _WorksListResource

Typed client for the Crossref /works route.

Source code in packages/stavrophora/src/stavrophora/_async/works.py
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
class WorksResource(_WorksListResource):
    """Typed client for the Crossref ``/works`` route."""

    def item_path(self, id: str | int) -> str:
        """Return the single-work path with the DOI percent-encoded."""
        return self._resource.item_path(id)

    async def get(
        self,
        id: str | int,
        *,
        select: Sequence[str] | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> Work:
        """Fetch one work by DOI; 404 raises :class:`NotFoundError`."""
        return await self._resource.get(id, select=select, params=params)

    async def exists(self, id: str | int) -> bool:
        """Return ``True`` when the DOI exists (HTTP HEAD); 404 returns ``False``."""
        return await self._resource.exists(id)

    async def agency(self, doi: str) -> WorkAgency:
        """Look up the DOI registration agency for a work."""
        response = await self._client.request("GET", f"{self.item_path(doi)}/agency")
        data = self._client.unwrapper.item(self._client.parse_json(response))
        return validate_model(
            WorkAgency, data, request=response.request, response=response
        )

    async def latest_version(
        self,
        doi: str,
        update_types: Collection[str] | None = DEFAULT_VERSION_UPDATE_TYPES,
    ) -> Work:
        """Resolve a DOI to the newest record in its Crossmark update chain.

        Older records of an update chain carry ``updated-by`` entries naming
        the works that updated them, each with a ``type`` and a timestamp or
        date parts. By default only ``("new_version", "new_edition")`` entries
        are followed so retractions and corrections are not mistaken for newer
        versions; pass ``update_types=None`` to follow all Crossmark updates.
        A DOI without matching update data is returned unchanged.
        """
        allowed = set(update_types) if update_types is not None else None
        work = await self.get(doi)
        seen = {self.normalize_id(doi)}
        if work.doi:
            seen.add(self.normalize_id(work.doi))
        while work.updated_by:
            candidates = (
                [entry for entry in work.updated_by if entry.type in allowed]
                if allowed is not None
                else work.updated_by
            )
            if not candidates:
                break
            newest = max(candidates, key=_update_timestamp)
            target = newest.doi
            if not target or self.normalize_id(target) in seen:
                break
            seen.add(self.normalize_id(target))
            work = await self.get(target)
            if work.doi:
                seen.add(self.normalize_id(work.doi))
        return work

agency(doi) async

Look up the DOI registration agency for a work.

Source code in packages/stavrophora/src/stavrophora/_async/works.py
376
377
378
379
380
381
382
async def agency(self, doi: str) -> WorkAgency:
    """Look up the DOI registration agency for a work."""
    response = await self._client.request("GET", f"{self.item_path(doi)}/agency")
    data = self._client.unwrapper.item(self._client.parse_json(response))
    return validate_model(
        WorkAgency, data, request=response.request, response=response
    )

exists(id) async

Return True when the DOI exists (HTTP HEAD); 404 returns False.

Source code in packages/stavrophora/src/stavrophora/_async/works.py
372
373
374
async def exists(self, id: str | int) -> bool:
    """Return ``True`` when the DOI exists (HTTP HEAD); 404 returns ``False``."""
    return await self._resource.exists(id)

get(id, *, select=None, params=None) async

Fetch one work by DOI; 404 raises :class:NotFoundError.

Source code in packages/stavrophora/src/stavrophora/_async/works.py
362
363
364
365
366
367
368
369
370
async def get(
    self,
    id: str | int,
    *,
    select: Sequence[str] | None = None,
    params: Mapping[str, Any] | None = None,
) -> Work:
    """Fetch one work by DOI; 404 raises :class:`NotFoundError`."""
    return await self._resource.get(id, select=select, params=params)

item_path(id)

Return the single-work path with the DOI percent-encoded.

Source code in packages/stavrophora/src/stavrophora/_async/works.py
358
359
360
def item_path(self, id: str | int) -> str:
    """Return the single-work path with the DOI percent-encoded."""
    return self._resource.item_path(id)

latest_version(doi, update_types=DEFAULT_VERSION_UPDATE_TYPES) async

Resolve a DOI to the newest record in its Crossmark update chain.

Older records of an update chain carry updated-by entries naming the works that updated them, each with a type and a timestamp or date parts. By default only ("new_version", "new_edition") entries are followed so retractions and corrections are not mistaken for newer versions; pass update_types=None to follow all Crossmark updates. A DOI without matching update data is returned unchanged.

Source code in packages/stavrophora/src/stavrophora/_async/works.py
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
async def latest_version(
    self,
    doi: str,
    update_types: Collection[str] | None = DEFAULT_VERSION_UPDATE_TYPES,
) -> Work:
    """Resolve a DOI to the newest record in its Crossmark update chain.

    Older records of an update chain carry ``updated-by`` entries naming
    the works that updated them, each with a ``type`` and a timestamp or
    date parts. By default only ``("new_version", "new_edition")`` entries
    are followed so retractions and corrections are not mistaken for newer
    versions; pass ``update_types=None`` to follow all Crossmark updates.
    A DOI without matching update data is returned unchanged.
    """
    allowed = set(update_types) if update_types is not None else None
    work = await self.get(doi)
    seen = {self.normalize_id(doi)}
    if work.doi:
        seen.add(self.normalize_id(work.doi))
    while work.updated_by:
        candidates = (
            [entry for entry in work.updated_by if entry.type in allowed]
            if allowed is not None
            else work.updated_by
        )
        if not candidates:
            break
        newest = max(candidates, key=_update_timestamp)
        target = newest.doi
        if not target or self.normalize_id(target) in seen:
            break
        seen.add(self.normalize_id(target))
        work = await self.get(target)
        if work.doi:
            seen.add(self.normalize_id(work.doi))
    return work

stavrophora._async.journals

Journals resource: /journals and the /journals/{issn}/works scope.

JournalsResource

Bases: CrossrefResourceClient[Journal]

Typed client for the Crossref /journals routes.

Accepts plain query only; filter, sort, and select are rejected client-side because the route returns 400 for them.

Source code in packages/stavrophora/src/stavrophora/_async/journals.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class JournalsResource(CrossrefResourceClient[Journal]):
    """Typed client for the Crossref ``/journals`` routes.

    Accepts plain ``query`` only; ``filter``, ``sort``, and ``select`` are
    rejected client-side because the route returns 400 for them.
    """

    path = "journals"
    model = Journal

    def normalize_id(self, value: str | int) -> str:
        """Return the hyphenated uppercase ISSN form."""
        return normalize_issn(str(value))

    async def dois_by_year(self, issn: str) -> dict[int, int]:
        """Return DOI counts per issued year from the journal record.

        Reads ``breakdowns.dois-by-issued-year`` from ``/journals/{issn}``.
        Returns an empty dict when the record carries no breakdown.
        """
        journal = await self.get(issn)
        if journal.breakdowns is None:
            return {}
        return dict(journal.breakdowns.dois_by_issued_year)

    def works(self, issn: str) -> ScopedWorksResource:
        """Return a works client bound to ``journals/{issn}/works``.

        Accepts print or electronic ISSNs; hyphens and case are normalized.
        """
        issn = quote(normalize_issn(issn), safe="")
        return ScopedWorksResource(self._client, path=f"journals/{issn}/works")

dois_by_year(issn) async

Return DOI counts per issued year from the journal record.

Reads breakdowns.dois-by-issued-year from /journals/{issn}. Returns an empty dict when the record carries no breakdown.

Source code in packages/stavrophora/src/stavrophora/_async/journals.py
26
27
28
29
30
31
32
33
34
35
async def dois_by_year(self, issn: str) -> dict[int, int]:
    """Return DOI counts per issued year from the journal record.

    Reads ``breakdowns.dois-by-issued-year`` from ``/journals/{issn}``.
    Returns an empty dict when the record carries no breakdown.
    """
    journal = await self.get(issn)
    if journal.breakdowns is None:
        return {}
    return dict(journal.breakdowns.dois_by_issued_year)

normalize_id(value)

Return the hyphenated uppercase ISSN form.

Source code in packages/stavrophora/src/stavrophora/_async/journals.py
22
23
24
def normalize_id(self, value: str | int) -> str:
    """Return the hyphenated uppercase ISSN form."""
    return normalize_issn(str(value))

works(issn)

Return a works client bound to journals/{issn}/works.

Accepts print or electronic ISSNs; hyphens and case are normalized.

Source code in packages/stavrophora/src/stavrophora/_async/journals.py
37
38
39
40
41
42
43
def works(self, issn: str) -> ScopedWorksResource:
    """Return a works client bound to ``journals/{issn}/works``.

    Accepts print or electronic ISSNs; hyphens and case are normalized.
    """
    issn = quote(normalize_issn(issn), safe="")
    return ScopedWorksResource(self._client, path=f"journals/{issn}/works")

stavrophora._async.funders

Funders resource: /funders and the /funders/{id}/works scope.

FunderWorksResource

Bases: ScopedWorksResource

Works client that ORs a funder id plus its descendants into the funder filter of every request.

The id set is fetched from the funder record on first use and cached. Requests that carry their own funder filter are rejected, since the two would silently AND together.

Source code in packages/stavrophora/src/stavrophora/_async/funders.py
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
class FunderWorksResource(ScopedWorksResource):
    """Works client that ORs a funder id plus its descendants into the
    ``funder`` filter of every request.

    The id set is fetched from the funder record on first use and cached.
    Requests that carry their own ``funder`` filter are rejected, since the
    two would silently AND together.
    """

    def __init__(
        self,
        client: BaseApiClient,
        *,
        path: str,
        funders: FundersResource,
        funder_id: str,
    ) -> None:
        super().__init__(client, path=path)
        self._funders = funders
        self._funder_id = funder_id
        self._ids: list[str] | None = None

    async def _funder_ids(self) -> list[str]:
        """The funder id plus its descendants, fetched once."""
        if self._ids is None:
            record = await self._funders.get(self._funder_id)
            self._ids = [self._funder_id, *record.descendants]
        return self._ids

    def build_filter_params(
        self, filters: BaseModel | Mapping[str, Any] | None
    ) -> dict[str, str]:
        if self._ids is None:
            return super().build_filter_params(filters)
        if isinstance(filters, BaseModel):
            merged = filters.model_dump(exclude_none=True, by_alias=True)
        elif filters is None:
            merged = {}
        else:
            merged = dict(filters)
        if "funder" in merged:
            raise ConfigurationError(
                "Pass filters['funder'] or include_descendants=True, not both."
            )
        merged["funder"] = self._ids
        return super().build_filter_params(merged)

    async def search(
        self,
        filters: BaseModel | Mapping[str, Any] | None = None,
        *,
        query: str | None = None,
        sort: str | Sequence[str] | None = None,
        select: Sequence[str] | None = None,
        page: int | None = None,
        page_size: int | None = None,
        cursor: str | None = None,
        on_error: OnError = "raise",
        failures: list[tuple[dict[str, Any], Exception]] | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> Page[Work]:
        await self._funder_ids()
        return await super().search(
            filters,
            query=query,
            sort=sort,
            select=select,
            page=page,
            page_size=page_size,
            cursor=cursor,
            on_error=on_error,
            failures=failures,
            params=params,
        )

    async def count(
        self,
        filters: BaseModel | Mapping[str, Any] | None = None,
        *,
        query: str | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> int:
        await self._funder_ids()
        return await super().count(filters, query=query, params=params)

    async def facets(
        self,
        filters: BaseModel | Mapping[str, Any] | None = None,
        *,
        query: str | None = None,
        facets: Sequence[str] = ("*",),
        count: int | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> dict[str, dict[str, int]]:
        await self._funder_ids()
        return await super().facets(
            filters, query=query, facets=facets, count=count, params=params
        )

    async def sample(
        self,
        n: int = 100,
        filters: BaseModel | Mapping[str, Any] | None = None,
        *,
        query: str | None = None,
        select: Sequence[str] | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> Page[Work]:
        await self._funder_ids()
        return await super().sample(
            n, filters, query=query, select=select, params=params
        )

    def iterate(
        self,
        filters: BaseModel | Mapping[str, Any] | None = None,
        **kwargs: Any,
    ) -> AsyncIterator[Work]:
        return self._iterate(filters, **kwargs)

    async def _iterate(
        self,
        filters: BaseModel | Mapping[str, Any] | None,
        **kwargs: Any,
    ) -> AsyncIterator[Work]:
        await self._funder_ids()
        async for entity in super().iterate(filters, **kwargs):  # noqa: UP028
            # the sync twin cannot use ``yield from`` from an async generator
            yield entity

FundersResource

Bases: CrossrefResourceClient[Funder]

Typed client for the Crossref /funders routes.

Accepts plain query plus the location filter.

Source code in packages/stavrophora/src/stavrophora/_async/funders.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class FundersResource(CrossrefResourceClient[Funder]):
    """Typed client for the Crossref ``/funders`` routes.

    Accepts plain ``query`` plus the ``location`` filter.
    """

    path = "funders"
    model = Funder
    filters_model = FunderFilters
    supports_filter = True

    def normalize_id(self, value: str | int) -> str:
        """Return the bare lowercase funder DOI."""
        return normalize_doi(str(value))

    async def descendants(self, funder_id: str) -> list[str]:
        """Return the funder's descendant registry ids from its record.

        Funder ids come back in Crossref's bare form (``"100000025"``).
        Returns an empty list for funders without a hierarchy; list items
        from ``search()`` carry no hierarchy data at all.
        """
        record = await self.get(funder_id)
        return list(record.descendants)

    def works(
        self, funder_id: str, *, include_descendants: bool = False
    ) -> ScopedWorksResource:
        """Return a works client bound to ``funders/{id}/works``.

        ``funder_id`` is the funder's Funder Registry DOI. The scoped route
        already includes descendants' works; with ``include_descendants=True``
        the funder's own id plus its descendant ids are additionally ORed
        into every request's ``funder`` filter, pinning the result set to
        the listed ids.
        """
        funder_id = normalize_doi(funder_id)
        path = f"funders/{quote(funder_id, safe='')}/works"
        if include_descendants:
            return FunderWorksResource(
                self._client, path=path, funders=self, funder_id=funder_id
            )
        return ScopedWorksResource(self._client, path=path)

descendants(funder_id) async

Return the funder's descendant registry ids from its record.

Funder ids come back in Crossref's bare form ("100000025"). Returns an empty list for funders without a hierarchy; list items from search() carry no hierarchy data at all.

Source code in packages/stavrophora/src/stavrophora/_async/funders.py
34
35
36
37
38
39
40
41
42
async def descendants(self, funder_id: str) -> list[str]:
    """Return the funder's descendant registry ids from its record.

    Funder ids come back in Crossref's bare form (``"100000025"``).
    Returns an empty list for funders without a hierarchy; list items
    from ``search()`` carry no hierarchy data at all.
    """
    record = await self.get(funder_id)
    return list(record.descendants)

normalize_id(value)

Return the bare lowercase funder DOI.

Source code in packages/stavrophora/src/stavrophora/_async/funders.py
30
31
32
def normalize_id(self, value: str | int) -> str:
    """Return the bare lowercase funder DOI."""
    return normalize_doi(str(value))

works(funder_id, *, include_descendants=False)

Return a works client bound to funders/{id}/works.

funder_id is the funder's Funder Registry DOI. The scoped route already includes descendants' works; with include_descendants=True the funder's own id plus its descendant ids are additionally ORed into every request's funder filter, pinning the result set to the listed ids.

Source code in packages/stavrophora/src/stavrophora/_async/funders.py
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
def works(
    self, funder_id: str, *, include_descendants: bool = False
) -> ScopedWorksResource:
    """Return a works client bound to ``funders/{id}/works``.

    ``funder_id`` is the funder's Funder Registry DOI. The scoped route
    already includes descendants' works; with ``include_descendants=True``
    the funder's own id plus its descendant ids are additionally ORed
    into every request's ``funder`` filter, pinning the result set to
    the listed ids.
    """
    funder_id = normalize_doi(funder_id)
    path = f"funders/{quote(funder_id, safe='')}/works"
    if include_descendants:
        return FunderWorksResource(
            self._client, path=path, funders=self, funder_id=funder_id
        )
    return ScopedWorksResource(self._client, path=path)

stavrophora._async.members

Members resource: /members and the /members/{id}/works scope.

MembersResource

Bases: CrossrefResourceClient[Member]

Typed client for the Crossref /members routes.

Accepts plain query plus the member-specific filters (prefix, backfile-doi-count, current-doi-count).

Source code in packages/stavrophora/src/stavrophora/_async/members.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class MembersResource(CrossrefResourceClient[Member]):
    """Typed client for the Crossref ``/members`` routes.

    Accepts plain ``query`` plus the member-specific filters (``prefix``,
    ``backfile-doi-count``, ``current-doi-count``).
    """

    path = "members"
    model = Member
    filters_model = MemberFilters
    supports_filter = True

    def works(self, member_id: str | int) -> ScopedWorksResource:
        """Return a works client bound to ``members/{id}/works``."""
        member_id = quote(str(member_id).strip(), safe="")
        return ScopedWorksResource(self._client, path=f"members/{member_id}/works")

works(member_id)

Return a works client bound to members/{id}/works.

Source code in packages/stavrophora/src/stavrophora/_async/members.py
23
24
25
26
def works(self, member_id: str | int) -> ScopedWorksResource:
    """Return a works client bound to ``members/{id}/works``."""
    member_id = quote(str(member_id).strip(), safe="")
    return ScopedWorksResource(self._client, path=f"members/{member_id}/works")

stavrophora._async.types

Types resource: /types and the /types/{id}/works scope.

TypesResource

Bases: CrossrefResourceClient[CrossRefType]

Typed client for the Crossref /types routes.

The type list serves no query, filter, sort, or select; any of those parameters is rejected client-side. Crossref ignores rows and offset on /types and always returns the complete list in one response, so dialect is :data:CrossrefUnpagedDialect and count() and iterate() issue a single unpaged fetch.

Source code in packages/stavrophora/src/stavrophora/_async/types.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class TypesResource(CrossrefResourceClient[CrossRefType]):
    """Typed client for the Crossref ``/types`` routes.

    The type list serves no ``query``, ``filter``, ``sort``, or ``select``;
    any of those parameters is rejected client-side. Crossref ignores
    ``rows`` and ``offset`` on ``/types`` and always returns the complete
    list in one response, so ``dialect`` is :data:`CrossrefUnpagedDialect`
    and ``count()`` and ``iterate()`` issue a single unpaged fetch.
    """

    path = "types"
    model = CrossRefType
    dialect = CrossrefUnpagedDialect

    def works(self, type_id: str | int) -> ScopedWorksResource:
        """Return a works client bound to ``types/{id}/works``."""
        type_id = quote(str(type_id).strip(), safe="")
        return ScopedWorksResource(self._client, path=f"types/{type_id}/works")

    async def count(
        self,
        filters: BaseModel | Mapping[str, Any] | None = None,
        *,
        query: str | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> int:
        """Return the total number of Crossref work types (single unpaged fetch)."""
        query_params = self._search_params(filters=filters, query=query, params=params)
        response = await self._client.request(
            "GET", self.path, params=query_params or None
        )
        body = self._client.parse_json(response)
        unwrapper = self._client.unwrapper
        total = unwrapper.total(body)
        return total if total is not None else len(unwrapper.results(body))

count(filters=None, *, query=None, params=None) async

Return the total number of Crossref work types (single unpaged fetch).

Source code in packages/stavrophora/src/stavrophora/_async/types.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
async def count(
    self,
    filters: BaseModel | Mapping[str, Any] | None = None,
    *,
    query: str | None = None,
    params: Mapping[str, Any] | None = None,
) -> int:
    """Return the total number of Crossref work types (single unpaged fetch)."""
    query_params = self._search_params(filters=filters, query=query, params=params)
    response = await self._client.request(
        "GET", self.path, params=query_params or None
    )
    body = self._client.parse_json(response)
    unwrapper = self._client.unwrapper
    total = unwrapper.total(body)
    return total if total is not None else len(unwrapper.results(body))

works(type_id)

Return a works client bound to types/{id}/works.

Source code in packages/stavrophora/src/stavrophora/_async/types.py
29
30
31
32
def works(self, type_id: str | int) -> ScopedWorksResource:
    """Return a works client bound to ``types/{id}/works``."""
    type_id = quote(str(type_id).strip(), safe="")
    return ScopedWorksResource(self._client, path=f"types/{type_id}/works")

stavrophora._async.prefixes

Prefixes resource: /prefixes/{prefix} and its works scope.

Crossref serves no /prefixes list route (verified live: 404); prefixes are only addressable individually.

PrefixesResource

Bases: CrossrefResourceClient[Prefix]

Typed client for the Crossref /prefixes/{prefix} route.

Source code in packages/stavrophora/src/stavrophora/_async/prefixes.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class PrefixesResource(CrossrefResourceClient[Prefix]):
    """Typed client for the Crossref ``/prefixes/{prefix}`` route."""

    path = "prefixes"
    model = Prefix

    def works(self, prefix: str | int) -> ScopedWorksResource:
        """Return a works client bound to ``prefixes/{prefix}/works``."""
        prefix = quote(str(prefix).strip(), safe="")
        return ScopedWorksResource(self._client, path=f"prefixes/{prefix}/works")

    def search(self, *_args: Any, **_kwargs: Any) -> Any:
        """Not supported: Crossref serves no ``/prefixes`` list route."""
        raise ConfigurationError(
            "Crossref has no /prefixes list route; use get(prefix) or works(prefix)."
        )

    def count(self, *_args: Any, **_kwargs: Any) -> Any:
        """Not supported: Crossref serves no ``/prefixes`` list route."""
        raise ConfigurationError(
            "Crossref has no /prefixes list route; use get(prefix) or works(prefix)."
        )

    def iterate(self, *_args: Any, **_kwargs: Any) -> Any:
        """Not supported: Crossref serves no ``/prefixes`` list route."""
        raise ConfigurationError(
            "Crossref has no /prefixes list route; use get(prefix) or works(prefix)."
        )

count(*_args, **_kwargs)

Not supported: Crossref serves no /prefixes list route.

Source code in packages/stavrophora/src/stavrophora/_async/prefixes.py
34
35
36
37
38
def count(self, *_args: Any, **_kwargs: Any) -> Any:
    """Not supported: Crossref serves no ``/prefixes`` list route."""
    raise ConfigurationError(
        "Crossref has no /prefixes list route; use get(prefix) or works(prefix)."
    )

iterate(*_args, **_kwargs)

Not supported: Crossref serves no /prefixes list route.

Source code in packages/stavrophora/src/stavrophora/_async/prefixes.py
40
41
42
43
44
def iterate(self, *_args: Any, **_kwargs: Any) -> Any:
    """Not supported: Crossref serves no ``/prefixes`` list route."""
    raise ConfigurationError(
        "Crossref has no /prefixes list route; use get(prefix) or works(prefix)."
    )

search(*_args, **_kwargs)

Not supported: Crossref serves no /prefixes list route.

Source code in packages/stavrophora/src/stavrophora/_async/prefixes.py
28
29
30
31
32
def search(self, *_args: Any, **_kwargs: Any) -> Any:
    """Not supported: Crossref serves no ``/prefixes`` list route."""
    raise ConfigurationError(
        "Crossref has no /prefixes list route; use get(prefix) or works(prefix)."
    )

works(prefix)

Return a works client bound to prefixes/{prefix}/works.

Source code in packages/stavrophora/src/stavrophora/_async/prefixes.py
23
24
25
26
def works(self, prefix: str | int) -> ScopedWorksResource:
    """Return a works client bound to ``prefixes/{prefix}/works``."""
    prefix = quote(str(prefix).strip(), safe="")
    return ScopedWorksResource(self._client, path=f"prefixes/{prefix}/works")

stavrophora._async.licenses

Licenses resource: the /licenses list route.

Crossref has no single-license route (verified live: /licenses/{id} returns 404); only the list endpoint exists.

LicensesResource

Bases: CrossrefResourceClient[License]

Typed client for the Crossref /licenses route (list/iterate only).

Source code in packages/stavrophora/src/stavrophora/_async/licenses.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class LicensesResource(CrossrefResourceClient[License]):
    """Typed client for the Crossref ``/licenses`` route (list/iterate only)."""

    path = "licenses"
    model = License

    async def get(
        self,
        id: str | int,
        *,
        select: Sequence[str] | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> License:
        """Not supported: Crossref has no ``/licenses/{id}`` route."""
        raise ConfigurationError(
            "Crossref has no /licenses/{id} route; use search() or iterate()."
        )

    async def exists(self, id: str | int) -> bool:
        """Not supported: Crossref has no ``/licenses/{id}`` route."""
        raise ConfigurationError(
            "Crossref has no /licenses/{id} route; use search() or iterate()."
        )

exists(id) async

Not supported: Crossref has no /licenses/{id} route.

Source code in packages/stavrophora/src/stavrophora/_async/licenses.py
34
35
36
37
38
async def exists(self, id: str | int) -> bool:
    """Not supported: Crossref has no ``/licenses/{id}`` route."""
    raise ConfigurationError(
        "Crossref has no /licenses/{id} route; use search() or iterate()."
    )

get(id, *, select=None, params=None) async

Not supported: Crossref has no /licenses/{id} route.

Source code in packages/stavrophora/src/stavrophora/_async/licenses.py
22
23
24
25
26
27
28
29
30
31
32
async def get(
    self,
    id: str | int,
    *,
    select: Sequence[str] | None = None,
    params: Mapping[str, Any] | None = None,
) -> License:
    """Not supported: Crossref has no ``/licenses/{id}`` route."""
    raise ConfigurationError(
        "Crossref has no /licenses/{id} route; use search() or iterate()."
    )

stavrophora._async.datacitations

Data citations resource: the beta /beta/datacitations route.

The route lives beside the /v1 API (https://api.crossref.org/beta/ datacitations), runs in its own datacitations pool (3 requests per second, 3 concurrent on 2026-11-28), and pages by a 0-based page number: message.next-page holds the next page number, or null after the last page. Crossref marks the route as beta, so its contents and output format may change.

DataCitationsResource

Typed client for the Crossref Data Citations API (beta).

Every filter is optional and the filters combine with AND: subject_id (DOI of the citing work), object_id (DOI of the cited dataset or software), member_id (Crossref member of the citing work), relation (for example references), and from_created_date / until_created_date (when Crossref added the relationship; 2025, 2025-01, 2025-01-01, or 2025-01-01T12:00).

Source code in packages/stavrophora/src/stavrophora/_async/datacitations.py
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
class DataCitationsResource:
    """Typed client for the Crossref Data Citations API (beta).

    Every filter is optional and the filters combine with AND:
    ``subject_id`` (DOI of the citing work), ``object_id`` (DOI of the cited
    dataset or software), ``member_id`` (Crossref member of the citing
    work), ``relation`` (for example ``references``), and
    ``from_created_date`` / ``until_created_date`` (when Crossref added the
    relationship; ``2025``, ``2025-01``, ``2025-01-01``, or
    ``2025-01-01T12:00``).
    """

    def __init__(self, client: BaseApiClient) -> None:
        self._client = client
        self._url = str(httpx.URL(client.base_url).copy_with(path=DATACITATIONS_PATH))

    async def search(
        self,
        *,
        subject_id: str | None = None,
        object_id: str | None = None,
        member_id: str | int | None = None,
        relation: str | None = None,
        from_created_date: str | None = None,
        until_created_date: str | None = None,
        rows: int | None = None,
        page: int | None = None,
    ) -> Page[DataCitation]:
        """Return one page of data citations.

        ``page`` is 0-based. ``page.next_cursor`` holds the next page number
        as a string, or ``None`` after the last page; ``page.total`` is the
        number of matching relationships.
        """
        params = _params(
            subject_id=subject_id,
            object_id=object_id,
            member_id=member_id,
            relation=relation,
            from_created_date=from_created_date,
            until_created_date=until_created_date,
            rows=rows,
            page=page,
        )
        message, response = await self._fetch(params)
        results = [
            validate_model(
                DataCitation, item, request=response.request, response=response
            )
            for item in message.get("items") or []
        ]
        next_page = message.get("next-page")
        total = message.get("total-results")
        meta = {key: value for key, value in message.items() if key != "items"}
        return Page(
            results=results,
            total=int(total) if total is not None else None,
            next_cursor=str(next_page) if next_page is not None else None,
            page=page if page is not None else 0,
            meta=meta,
        )

    async def iterate(
        self,
        *,
        subject_id: str | None = None,
        object_id: str | None = None,
        member_id: str | int | None = None,
        relation: str | None = None,
        from_created_date: str | None = None,
        until_created_date: str | None = None,
        rows: int = DATACITATIONS_MAX_ROWS,
    ) -> AsyncIterator[DataCitation]:
        """Yield every matching data citation, following ``next-page``."""
        page_number: Any = 0
        while page_number is not None:
            params = _params(
                subject_id=subject_id,
                object_id=object_id,
                member_id=member_id,
                relation=relation,
                from_created_date=from_created_date,
                until_created_date=until_created_date,
                rows=rows,
                page=int(page_number),
            )
            message, response = await self._fetch(params)
            items = message.get("items") or []
            for item in items:
                yield validate_model(
                    DataCitation, item, request=response.request, response=response
                )
            page_number = message.get("next-page") if items else None

    async def _fetch(
        self, params: dict[str, Any]
    ) -> tuple[dict[str, Any], httpx.Response]:
        """Send one request and return the ``message`` object and the response."""
        response = await self._client.request("GET", self._url, params=params)
        body = self._client.parse_json(response)
        message = body.get("message") if isinstance(body, dict) else None
        if not isinstance(message, dict):
            raise ConfigurationError(
                "Crossref /beta/datacitations answered without a message object."
            )
        return message, response

    async def count(
        self,
        *,
        subject_id: str | None = None,
        object_id: str | None = None,
        member_id: str | int | None = None,
        relation: str | None = None,
        from_created_date: str | None = None,
        until_created_date: str | None = None,
    ) -> int:
        """Return the number of matching data citations (one 1-row request)."""
        page = await self.search(
            subject_id=subject_id,
            object_id=object_id,
            member_id=member_id,
            relation=relation,
            from_created_date=from_created_date,
            until_created_date=until_created_date,
            rows=1,
        )
        return page.total or 0

count(*, subject_id=None, object_id=None, member_id=None, relation=None, from_created_date=None, until_created_date=None) async

Return the number of matching data citations (one 1-row request).

Source code in packages/stavrophora/src/stavrophora/_async/datacitations.py
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
async def count(
    self,
    *,
    subject_id: str | None = None,
    object_id: str | None = None,
    member_id: str | int | None = None,
    relation: str | None = None,
    from_created_date: str | None = None,
    until_created_date: str | None = None,
) -> int:
    """Return the number of matching data citations (one 1-row request)."""
    page = await self.search(
        subject_id=subject_id,
        object_id=object_id,
        member_id=member_id,
        relation=relation,
        from_created_date=from_created_date,
        until_created_date=until_created_date,
        rows=1,
    )
    return page.total or 0

iterate(*, subject_id=None, object_id=None, member_id=None, relation=None, from_created_date=None, until_created_date=None, rows=DATACITATIONS_MAX_ROWS) async

Yield every matching data citation, following next-page.

Source code in packages/stavrophora/src/stavrophora/_async/datacitations.py
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
async def iterate(
    self,
    *,
    subject_id: str | None = None,
    object_id: str | None = None,
    member_id: str | int | None = None,
    relation: str | None = None,
    from_created_date: str | None = None,
    until_created_date: str | None = None,
    rows: int = DATACITATIONS_MAX_ROWS,
) -> AsyncIterator[DataCitation]:
    """Yield every matching data citation, following ``next-page``."""
    page_number: Any = 0
    while page_number is not None:
        params = _params(
            subject_id=subject_id,
            object_id=object_id,
            member_id=member_id,
            relation=relation,
            from_created_date=from_created_date,
            until_created_date=until_created_date,
            rows=rows,
            page=int(page_number),
        )
        message, response = await self._fetch(params)
        items = message.get("items") or []
        for item in items:
            yield validate_model(
                DataCitation, item, request=response.request, response=response
            )
        page_number = message.get("next-page") if items else None

search(*, subject_id=None, object_id=None, member_id=None, relation=None, from_created_date=None, until_created_date=None, rows=None, page=None) async

Return one page of data citations.

page is 0-based. page.next_cursor holds the next page number as a string, or None after the last page; page.total is the number of matching relationships.

Source code in packages/stavrophora/src/stavrophora/_async/datacitations.py
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
async def search(
    self,
    *,
    subject_id: str | None = None,
    object_id: str | None = None,
    member_id: str | int | None = None,
    relation: str | None = None,
    from_created_date: str | None = None,
    until_created_date: str | None = None,
    rows: int | None = None,
    page: int | None = None,
) -> Page[DataCitation]:
    """Return one page of data citations.

    ``page`` is 0-based. ``page.next_cursor`` holds the next page number
    as a string, or ``None`` after the last page; ``page.total`` is the
    number of matching relationships.
    """
    params = _params(
        subject_id=subject_id,
        object_id=object_id,
        member_id=member_id,
        relation=relation,
        from_created_date=from_created_date,
        until_created_date=until_created_date,
        rows=rows,
        page=page,
    )
    message, response = await self._fetch(params)
    results = [
        validate_model(
            DataCitation, item, request=response.request, response=response
        )
        for item in message.get("items") or []
    ]
    next_page = message.get("next-page")
    total = message.get("total-results")
    meta = {key: value for key, value in message.items() if key != "items"}
    return Page(
        results=results,
        total=int(total) if total is not None else None,
        next_cursor=str(next_page) if next_page is not None else None,
        page=page if page is not None else 0,
        meta=meta,
    )

Sync resources

stavrophora._sync.works

Works resources: the top-level /works route and parent-scoped works.

SyncScopedWorksResource

Bases: _WorksListResource

Works capabilities bound to a parent route, e.g. members/{id}/works.

Obtain instances via the parent's works() method; scoped routes accept the full works list parameter set and count as single-record requests for Crossref rate limiting. Single-work methods (get, exists, agency, latest_version) are omitted because Crossref serves them only at /works/{doi}.

Source code in packages/stavrophora/src/stavrophora/_sync/works.py
423
424
425
426
427
428
429
430
431
class SyncScopedWorksResource(_WorksListResource):
    """Works capabilities bound to a parent route, e.g. ``members/{id}/works``.

    Obtain instances via the parent's ``works()`` method; scoped routes
    accept the full works list parameter set and count as single-record
    requests for Crossref rate limiting. Single-work methods (``get``,
    ``exists``, ``agency``, ``latest_version``) are omitted because Crossref
    serves them only at ``/works/{doi}``.
    """

SyncWorksResource

Bases: _WorksListResource

Typed client for the Crossref /works route.

Source code in packages/stavrophora/src/stavrophora/_sync/works.py
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
class SyncWorksResource(_WorksListResource):
    """Typed client for the Crossref ``/works`` route."""

    def item_path(self, id: str | int) -> str:
        """Return the single-work path with the DOI percent-encoded."""
        return self._resource.item_path(id)

    def get(
        self,
        id: str | int,
        *,
        select: Sequence[str] | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> Work:
        """Fetch one work by DOI; 404 raises :class:`NotFoundError`."""
        return self._resource.get(id, select=select, params=params)

    def exists(self, id: str | int) -> bool:
        """Return ``True`` when the DOI exists (HTTP HEAD); 404 returns ``False``."""
        return self._resource.exists(id)

    def agency(self, doi: str) -> WorkAgency:
        """Look up the DOI registration agency for a work."""
        response = self._client.request("GET", f"{self.item_path(doi)}/agency")
        data = self._client.unwrapper.item(self._client.parse_json(response))
        return validate_model(
            WorkAgency, data, request=response.request, response=response
        )

    def latest_version(
        self,
        doi: str,
        update_types: Collection[str] | None = DEFAULT_VERSION_UPDATE_TYPES,
    ) -> Work:
        """Resolve a DOI to the newest record in its Crossmark update chain.

        Older records of an update chain carry ``updated-by`` entries naming
        the works that updated them, each with a ``type`` and a timestamp or
        date parts. By default only ``("new_version", "new_edition")`` entries
        are followed so retractions and corrections are not mistaken for newer
        versions; pass ``update_types=None`` to follow all Crossmark updates.
        A DOI without matching update data is returned unchanged.
        """
        allowed = set(update_types) if update_types is not None else None
        work = self.get(doi)
        seen = {self.normalize_id(doi)}
        if work.doi:
            seen.add(self.normalize_id(work.doi))
        while work.updated_by:
            candidates = (
                [entry for entry in work.updated_by if entry.type in allowed]
                if allowed is not None
                else work.updated_by
            )
            if not candidates:
                break
            newest = max(candidates, key=_update_timestamp)
            target = newest.doi
            if not target or self.normalize_id(target) in seen:
                break
            seen.add(self.normalize_id(target))
            work = self.get(target)
            if work.doi:
                seen.add(self.normalize_id(work.doi))
        return work

agency(doi)

Look up the DOI registration agency for a work.

Source code in packages/stavrophora/src/stavrophora/_sync/works.py
377
378
379
380
381
382
383
def agency(self, doi: str) -> WorkAgency:
    """Look up the DOI registration agency for a work."""
    response = self._client.request("GET", f"{self.item_path(doi)}/agency")
    data = self._client.unwrapper.item(self._client.parse_json(response))
    return validate_model(
        WorkAgency, data, request=response.request, response=response
    )

exists(id)

Return True when the DOI exists (HTTP HEAD); 404 returns False.

Source code in packages/stavrophora/src/stavrophora/_sync/works.py
373
374
375
def exists(self, id: str | int) -> bool:
    """Return ``True`` when the DOI exists (HTTP HEAD); 404 returns ``False``."""
    return self._resource.exists(id)

get(id, *, select=None, params=None)

Fetch one work by DOI; 404 raises :class:NotFoundError.

Source code in packages/stavrophora/src/stavrophora/_sync/works.py
363
364
365
366
367
368
369
370
371
def get(
    self,
    id: str | int,
    *,
    select: Sequence[str] | None = None,
    params: Mapping[str, Any] | None = None,
) -> Work:
    """Fetch one work by DOI; 404 raises :class:`NotFoundError`."""
    return self._resource.get(id, select=select, params=params)

item_path(id)

Return the single-work path with the DOI percent-encoded.

Source code in packages/stavrophora/src/stavrophora/_sync/works.py
359
360
361
def item_path(self, id: str | int) -> str:
    """Return the single-work path with the DOI percent-encoded."""
    return self._resource.item_path(id)

latest_version(doi, update_types=DEFAULT_VERSION_UPDATE_TYPES)

Resolve a DOI to the newest record in its Crossmark update chain.

Older records of an update chain carry updated-by entries naming the works that updated them, each with a type and a timestamp or date parts. By default only ("new_version", "new_edition") entries are followed so retractions and corrections are not mistaken for newer versions; pass update_types=None to follow all Crossmark updates. A DOI without matching update data is returned unchanged.

Source code in packages/stavrophora/src/stavrophora/_sync/works.py
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
def latest_version(
    self,
    doi: str,
    update_types: Collection[str] | None = DEFAULT_VERSION_UPDATE_TYPES,
) -> Work:
    """Resolve a DOI to the newest record in its Crossmark update chain.

    Older records of an update chain carry ``updated-by`` entries naming
    the works that updated them, each with a ``type`` and a timestamp or
    date parts. By default only ``("new_version", "new_edition")`` entries
    are followed so retractions and corrections are not mistaken for newer
    versions; pass ``update_types=None`` to follow all Crossmark updates.
    A DOI without matching update data is returned unchanged.
    """
    allowed = set(update_types) if update_types is not None else None
    work = self.get(doi)
    seen = {self.normalize_id(doi)}
    if work.doi:
        seen.add(self.normalize_id(work.doi))
    while work.updated_by:
        candidates = (
            [entry for entry in work.updated_by if entry.type in allowed]
            if allowed is not None
            else work.updated_by
        )
        if not candidates:
            break
        newest = max(candidates, key=_update_timestamp)
        target = newest.doi
        if not target or self.normalize_id(target) in seen:
            break
        seen.add(self.normalize_id(target))
        work = self.get(target)
        if work.doi:
            seen.add(self.normalize_id(work.doi))
    return work

stavrophora._sync.journals

Journals resource: /journals and the /journals/{issn}/works scope.

SyncJournalsResource

Bases: CrossrefResourceSyncClient[Journal]

Typed client for the Crossref /journals routes.

Accepts plain query only; filter, sort, and select are rejected client-side because the route returns 400 for them.

Source code in packages/stavrophora/src/stavrophora/_sync/journals.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class SyncJournalsResource(CrossrefResourceSyncClient[Journal]):
    """Typed client for the Crossref ``/journals`` routes.

    Accepts plain ``query`` only; ``filter``, ``sort``, and ``select`` are
    rejected client-side because the route returns 400 for them.
    """

    path = "journals"
    model = Journal

    def normalize_id(self, value: str | int) -> str:
        """Return the hyphenated uppercase ISSN form."""
        return normalize_issn(str(value))

    def dois_by_year(self, issn: str) -> dict[int, int]:
        """Return DOI counts per issued year from the journal record.

        Reads ``breakdowns.dois-by-issued-year`` from ``/journals/{issn}``.
        Returns an empty dict when the record carries no breakdown.
        """
        journal = self.get(issn)
        if journal.breakdowns is None:
            return {}
        return dict(journal.breakdowns.dois_by_issued_year)

    def works(self, issn: str) -> SyncScopedWorksResource:
        """Return a works client bound to ``journals/{issn}/works``.

        Accepts print or electronic ISSNs; hyphens and case are normalized.
        """
        issn = quote(normalize_issn(issn), safe="")
        return SyncScopedWorksResource(self._client, path=f"journals/{issn}/works")

dois_by_year(issn)

Return DOI counts per issued year from the journal record.

Reads breakdowns.dois-by-issued-year from /journals/{issn}. Returns an empty dict when the record carries no breakdown.

Source code in packages/stavrophora/src/stavrophora/_sync/journals.py
27
28
29
30
31
32
33
34
35
36
def dois_by_year(self, issn: str) -> dict[int, int]:
    """Return DOI counts per issued year from the journal record.

    Reads ``breakdowns.dois-by-issued-year`` from ``/journals/{issn}``.
    Returns an empty dict when the record carries no breakdown.
    """
    journal = self.get(issn)
    if journal.breakdowns is None:
        return {}
    return dict(journal.breakdowns.dois_by_issued_year)

normalize_id(value)

Return the hyphenated uppercase ISSN form.

Source code in packages/stavrophora/src/stavrophora/_sync/journals.py
23
24
25
def normalize_id(self, value: str | int) -> str:
    """Return the hyphenated uppercase ISSN form."""
    return normalize_issn(str(value))

works(issn)

Return a works client bound to journals/{issn}/works.

Accepts print or electronic ISSNs; hyphens and case are normalized.

Source code in packages/stavrophora/src/stavrophora/_sync/journals.py
38
39
40
41
42
43
44
def works(self, issn: str) -> SyncScopedWorksResource:
    """Return a works client bound to ``journals/{issn}/works``.

    Accepts print or electronic ISSNs; hyphens and case are normalized.
    """
    issn = quote(normalize_issn(issn), safe="")
    return SyncScopedWorksResource(self._client, path=f"journals/{issn}/works")

stavrophora._sync.funders

Funders resource: /funders and the /funders/{id}/works scope.

SyncFunderWorksResource

Bases: SyncScopedWorksResource

Works client that ORs a funder id plus its descendants into the funder filter of every request.

The id set is fetched from the funder record on first use and cached. Requests that carry their own funder filter are rejected, since the two would silently AND together.

Source code in packages/stavrophora/src/stavrophora/_sync/funders.py
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
class SyncFunderWorksResource(SyncScopedWorksResource):
    """Works client that ORs a funder id plus its descendants into the
    ``funder`` filter of every request.

    The id set is fetched from the funder record on first use and cached.
    Requests that carry their own ``funder`` filter are rejected, since the
    two would silently AND together.
    """

    def __init__(
        self,
        client: SyncBaseApiClient,
        *,
        path: str,
        funders: SyncFundersResource,
        funder_id: str,
    ) -> None:
        super().__init__(client, path=path)
        self._funders = funders
        self._funder_id = funder_id
        self._ids: list[str] | None = None

    def _funder_ids(self) -> list[str]:
        """The funder id plus its descendants, fetched once."""
        if self._ids is None:
            record = self._funders.get(self._funder_id)
            self._ids = [self._funder_id, *record.descendants]
        return self._ids

    def build_filter_params(
        self, filters: BaseModel | Mapping[str, Any] | None
    ) -> dict[str, str]:
        if self._ids is None:
            return super().build_filter_params(filters)
        if isinstance(filters, BaseModel):
            merged = filters.model_dump(exclude_none=True, by_alias=True)
        elif filters is None:
            merged = {}
        else:
            merged = dict(filters)
        if "funder" in merged:
            raise ConfigurationError(
                "Pass filters['funder'] or include_descendants=True, not both."
            )
        merged["funder"] = self._ids
        return super().build_filter_params(merged)

    def search(
        self,
        filters: BaseModel | Mapping[str, Any] | None = None,
        *,
        query: str | None = None,
        sort: str | Sequence[str] | None = None,
        select: Sequence[str] | None = None,
        page: int | None = None,
        page_size: int | None = None,
        cursor: str | None = None,
        on_error: OnError = "raise",
        failures: list[tuple[dict[str, Any], Exception]] | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> Page[Work]:
        self._funder_ids()
        return super().search(
            filters,
            query=query,
            sort=sort,
            select=select,
            page=page,
            page_size=page_size,
            cursor=cursor,
            on_error=on_error,
            failures=failures,
            params=params,
        )

    def count(
        self,
        filters: BaseModel | Mapping[str, Any] | None = None,
        *,
        query: str | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> int:
        self._funder_ids()
        return super().count(filters, query=query, params=params)

    def facets(
        self,
        filters: BaseModel | Mapping[str, Any] | None = None,
        *,
        query: str | None = None,
        facets: Sequence[str] = ("*",),
        count: int | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> dict[str, dict[str, int]]:
        self._funder_ids()
        return super().facets(
            filters, query=query, facets=facets, count=count, params=params
        )

    def sample(
        self,
        n: int = 100,
        filters: BaseModel | Mapping[str, Any] | None = None,
        *,
        query: str | None = None,
        select: Sequence[str] | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> Page[Work]:
        self._funder_ids()
        return super().sample(n, filters, query=query, select=select, params=params)

    def iterate(
        self,
        filters: BaseModel | Mapping[str, Any] | None = None,
        **kwargs: Any,
    ) -> Iterator[Work]:
        return self._iterate(filters, **kwargs)

    def _iterate(
        self,
        filters: BaseModel | Mapping[str, Any] | None,
        **kwargs: Any,
    ) -> Iterator[Work]:
        self._funder_ids()
        for entity in super().iterate(filters, **kwargs):  # noqa: UP028
            # the sync twin cannot use ``yield from`` from an async generator
            yield entity

SyncFundersResource

Bases: CrossrefResourceSyncClient[Funder]

Typed client for the Crossref /funders routes.

Accepts plain query plus the location filter.

Source code in packages/stavrophora/src/stavrophora/_sync/funders.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
class SyncFundersResource(CrossrefResourceSyncClient[Funder]):
    """Typed client for the Crossref ``/funders`` routes.

    Accepts plain ``query`` plus the ``location`` filter.
    """

    path = "funders"
    model = Funder
    filters_model = FunderFilters
    supports_filter = True

    def normalize_id(self, value: str | int) -> str:
        """Return the bare lowercase funder DOI."""
        return normalize_doi(str(value))

    def descendants(self, funder_id: str) -> list[str]:
        """Return the funder's descendant registry ids from its record.

        Funder ids come back in Crossref's bare form (``"100000025"``).
        Returns an empty list for funders without a hierarchy; list items
        from ``search()`` carry no hierarchy data at all.
        """
        record = self.get(funder_id)
        return list(record.descendants)

    def works(
        self, funder_id: str, *, include_descendants: bool = False
    ) -> SyncScopedWorksResource:
        """Return a works client bound to ``funders/{id}/works``.

        ``funder_id`` is the funder's Funder Registry DOI. The scoped route
        already includes descendants' works; with ``include_descendants=True``
        the funder's own id plus its descendant ids are additionally ORed
        into every request's ``funder`` filter, pinning the result set to
        the listed ids.
        """
        funder_id = normalize_doi(funder_id)
        path = f"funders/{quote(funder_id, safe='')}/works"
        if include_descendants:
            return SyncFunderWorksResource(
                self._client, path=path, funders=self, funder_id=funder_id
            )
        return SyncScopedWorksResource(self._client, path=path)

descendants(funder_id)

Return the funder's descendant registry ids from its record.

Funder ids come back in Crossref's bare form ("100000025"). Returns an empty list for funders without a hierarchy; list items from search() carry no hierarchy data at all.

Source code in packages/stavrophora/src/stavrophora/_sync/funders.py
35
36
37
38
39
40
41
42
43
def descendants(self, funder_id: str) -> list[str]:
    """Return the funder's descendant registry ids from its record.

    Funder ids come back in Crossref's bare form (``"100000025"``).
    Returns an empty list for funders without a hierarchy; list items
    from ``search()`` carry no hierarchy data at all.
    """
    record = self.get(funder_id)
    return list(record.descendants)

normalize_id(value)

Return the bare lowercase funder DOI.

Source code in packages/stavrophora/src/stavrophora/_sync/funders.py
31
32
33
def normalize_id(self, value: str | int) -> str:
    """Return the bare lowercase funder DOI."""
    return normalize_doi(str(value))

works(funder_id, *, include_descendants=False)

Return a works client bound to funders/{id}/works.

funder_id is the funder's Funder Registry DOI. The scoped route already includes descendants' works; with include_descendants=True the funder's own id plus its descendant ids are additionally ORed into every request's funder filter, pinning the result set to the listed ids.

Source code in packages/stavrophora/src/stavrophora/_sync/funders.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
def works(
    self, funder_id: str, *, include_descendants: bool = False
) -> SyncScopedWorksResource:
    """Return a works client bound to ``funders/{id}/works``.

    ``funder_id`` is the funder's Funder Registry DOI. The scoped route
    already includes descendants' works; with ``include_descendants=True``
    the funder's own id plus its descendant ids are additionally ORed
    into every request's ``funder`` filter, pinning the result set to
    the listed ids.
    """
    funder_id = normalize_doi(funder_id)
    path = f"funders/{quote(funder_id, safe='')}/works"
    if include_descendants:
        return SyncFunderWorksResource(
            self._client, path=path, funders=self, funder_id=funder_id
        )
    return SyncScopedWorksResource(self._client, path=path)

stavrophora._sync.members

Members resource: /members and the /members/{id}/works scope.

SyncMembersResource

Bases: CrossrefResourceSyncClient[Member]

Typed client for the Crossref /members routes.

Accepts plain query plus the member-specific filters (prefix, backfile-doi-count, current-doi-count).

Source code in packages/stavrophora/src/stavrophora/_sync/members.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class SyncMembersResource(CrossrefResourceSyncClient[Member]):
    """Typed client for the Crossref ``/members`` routes.

    Accepts plain ``query`` plus the member-specific filters (``prefix``,
    ``backfile-doi-count``, ``current-doi-count``).
    """

    path = "members"
    model = Member
    filters_model = MemberFilters
    supports_filter = True

    def works(self, member_id: str | int) -> SyncScopedWorksResource:
        """Return a works client bound to ``members/{id}/works``."""
        member_id = quote(str(member_id).strip(), safe="")
        return SyncScopedWorksResource(self._client, path=f"members/{member_id}/works")

works(member_id)

Return a works client bound to members/{id}/works.

Source code in packages/stavrophora/src/stavrophora/_sync/members.py
24
25
26
27
def works(self, member_id: str | int) -> SyncScopedWorksResource:
    """Return a works client bound to ``members/{id}/works``."""
    member_id = quote(str(member_id).strip(), safe="")
    return SyncScopedWorksResource(self._client, path=f"members/{member_id}/works")

stavrophora._sync.types

Types resource: /types and the /types/{id}/works scope.

SyncTypesResource

Bases: CrossrefResourceSyncClient[CrossRefType]

Typed client for the Crossref /types routes.

The type list serves no query, filter, sort, or select; any of those parameters is rejected client-side. Crossref ignores rows and offset on /types and always returns the complete list in one response, so dialect is :data:CrossrefUnpagedDialect and count() and iterate() issue a single unpaged fetch.

Source code in packages/stavrophora/src/stavrophora/_sync/types.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class SyncTypesResource(CrossrefResourceSyncClient[CrossRefType]):
    """Typed client for the Crossref ``/types`` routes.

    The type list serves no ``query``, ``filter``, ``sort``, or ``select``;
    any of those parameters is rejected client-side. Crossref ignores
    ``rows`` and ``offset`` on ``/types`` and always returns the complete
    list in one response, so ``dialect`` is :data:`CrossrefUnpagedDialect`
    and ``count()`` and ``iterate()`` issue a single unpaged fetch.
    """

    path = "types"
    model = CrossRefType
    dialect = CrossrefUnpagedDialect

    def works(self, type_id: str | int) -> SyncScopedWorksResource:
        """Return a works client bound to ``types/{id}/works``."""
        type_id = quote(str(type_id).strip(), safe="")
        return SyncScopedWorksResource(self._client, path=f"types/{type_id}/works")

    def count(
        self,
        filters: BaseModel | Mapping[str, Any] | None = None,
        *,
        query: str | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> int:
        """Return the total number of Crossref work types (single unpaged fetch)."""
        query_params = self._search_params(filters=filters, query=query, params=params)
        response = self._client.request("GET", self.path, params=query_params or None)
        body = self._client.parse_json(response)
        unwrapper = self._client.unwrapper
        total = unwrapper.total(body)
        return total if total is not None else len(unwrapper.results(body))

count(filters=None, *, query=None, params=None)

Return the total number of Crossref work types (single unpaged fetch).

Source code in packages/stavrophora/src/stavrophora/_sync/types.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
def count(
    self,
    filters: BaseModel | Mapping[str, Any] | None = None,
    *,
    query: str | None = None,
    params: Mapping[str, Any] | None = None,
) -> int:
    """Return the total number of Crossref work types (single unpaged fetch)."""
    query_params = self._search_params(filters=filters, query=query, params=params)
    response = self._client.request("GET", self.path, params=query_params or None)
    body = self._client.parse_json(response)
    unwrapper = self._client.unwrapper
    total = unwrapper.total(body)
    return total if total is not None else len(unwrapper.results(body))

works(type_id)

Return a works client bound to types/{id}/works.

Source code in packages/stavrophora/src/stavrophora/_sync/types.py
30
31
32
33
def works(self, type_id: str | int) -> SyncScopedWorksResource:
    """Return a works client bound to ``types/{id}/works``."""
    type_id = quote(str(type_id).strip(), safe="")
    return SyncScopedWorksResource(self._client, path=f"types/{type_id}/works")

stavrophora._sync.prefixes

Prefixes resource: /prefixes/{prefix} and its works scope.

Crossref serves no /prefixes list route (verified live: 404); prefixes are only addressable individually.

SyncPrefixesResource

Bases: CrossrefResourceSyncClient[Prefix]

Typed client for the Crossref /prefixes/{prefix} route.

Source code in packages/stavrophora/src/stavrophora/_sync/prefixes.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
class SyncPrefixesResource(CrossrefResourceSyncClient[Prefix]):
    """Typed client for the Crossref ``/prefixes/{prefix}`` route."""

    path = "prefixes"
    model = Prefix

    def works(self, prefix: str | int) -> SyncScopedWorksResource:
        """Return a works client bound to ``prefixes/{prefix}/works``."""
        prefix = quote(str(prefix).strip(), safe="")
        return SyncScopedWorksResource(self._client, path=f"prefixes/{prefix}/works")

    def search(self, *_args: Any, **_kwargs: Any) -> Any:
        """Not supported: Crossref serves no ``/prefixes`` list route."""
        raise ConfigurationError(
            "Crossref has no /prefixes list route; use get(prefix) or works(prefix)."
        )

    def count(self, *_args: Any, **_kwargs: Any) -> Any:
        """Not supported: Crossref serves no ``/prefixes`` list route."""
        raise ConfigurationError(
            "Crossref has no /prefixes list route; use get(prefix) or works(prefix)."
        )

    def iterate(self, *_args: Any, **_kwargs: Any) -> Any:
        """Not supported: Crossref serves no ``/prefixes`` list route."""
        raise ConfigurationError(
            "Crossref has no /prefixes list route; use get(prefix) or works(prefix)."
        )

count(*_args, **_kwargs)

Not supported: Crossref serves no /prefixes list route.

Source code in packages/stavrophora/src/stavrophora/_sync/prefixes.py
35
36
37
38
39
def count(self, *_args: Any, **_kwargs: Any) -> Any:
    """Not supported: Crossref serves no ``/prefixes`` list route."""
    raise ConfigurationError(
        "Crossref has no /prefixes list route; use get(prefix) or works(prefix)."
    )

iterate(*_args, **_kwargs)

Not supported: Crossref serves no /prefixes list route.

Source code in packages/stavrophora/src/stavrophora/_sync/prefixes.py
41
42
43
44
45
def iterate(self, *_args: Any, **_kwargs: Any) -> Any:
    """Not supported: Crossref serves no ``/prefixes`` list route."""
    raise ConfigurationError(
        "Crossref has no /prefixes list route; use get(prefix) or works(prefix)."
    )

search(*_args, **_kwargs)

Not supported: Crossref serves no /prefixes list route.

Source code in packages/stavrophora/src/stavrophora/_sync/prefixes.py
29
30
31
32
33
def search(self, *_args: Any, **_kwargs: Any) -> Any:
    """Not supported: Crossref serves no ``/prefixes`` list route."""
    raise ConfigurationError(
        "Crossref has no /prefixes list route; use get(prefix) or works(prefix)."
    )

works(prefix)

Return a works client bound to prefixes/{prefix}/works.

Source code in packages/stavrophora/src/stavrophora/_sync/prefixes.py
24
25
26
27
def works(self, prefix: str | int) -> SyncScopedWorksResource:
    """Return a works client bound to ``prefixes/{prefix}/works``."""
    prefix = quote(str(prefix).strip(), safe="")
    return SyncScopedWorksResource(self._client, path=f"prefixes/{prefix}/works")

stavrophora._sync.licenses

Licenses resource: the /licenses list route.

Crossref has no single-license route (verified live: /licenses/{id} returns 404); only the list endpoint exists.

SyncLicensesResource

Bases: CrossrefResourceSyncClient[License]

Typed client for the Crossref /licenses route (list/iterate only).

Source code in packages/stavrophora/src/stavrophora/_sync/licenses.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class SyncLicensesResource(CrossrefResourceSyncClient[License]):
    """Typed client for the Crossref ``/licenses`` route (list/iterate only)."""

    path = "licenses"
    model = License

    def get(
        self,
        id: str | int,
        *,
        select: Sequence[str] | None = None,
        params: Mapping[str, Any] | None = None,
    ) -> License:
        """Not supported: Crossref has no ``/licenses/{id}`` route."""
        raise ConfigurationError(
            "Crossref has no /licenses/{id} route; use search() or iterate()."
        )

    def exists(self, id: str | int) -> bool:
        """Not supported: Crossref has no ``/licenses/{id}`` route."""
        raise ConfigurationError(
            "Crossref has no /licenses/{id} route; use search() or iterate()."
        )

exists(id)

Not supported: Crossref has no /licenses/{id} route.

Source code in packages/stavrophora/src/stavrophora/_sync/licenses.py
35
36
37
38
39
def exists(self, id: str | int) -> bool:
    """Not supported: Crossref has no ``/licenses/{id}`` route."""
    raise ConfigurationError(
        "Crossref has no /licenses/{id} route; use search() or iterate()."
    )

get(id, *, select=None, params=None)

Not supported: Crossref has no /licenses/{id} route.

Source code in packages/stavrophora/src/stavrophora/_sync/licenses.py
23
24
25
26
27
28
29
30
31
32
33
def get(
    self,
    id: str | int,
    *,
    select: Sequence[str] | None = None,
    params: Mapping[str, Any] | None = None,
) -> License:
    """Not supported: Crossref has no ``/licenses/{id}`` route."""
    raise ConfigurationError(
        "Crossref has no /licenses/{id} route; use search() or iterate()."
    )

stavrophora._sync.datacitations

Data citations resource: the beta /beta/datacitations route.

The route lives beside the /v1 API (https://api.crossref.org/beta/ datacitations), runs in its own datacitations pool (3 requests per second, 3 concurrent on 2026-11-28), and pages by a 0-based page number: message.next-page holds the next page number, or null after the last page. Crossref marks the route as beta, so its contents and output format may change.

SyncDataCitationsResource

Typed client for the Crossref Data Citations API (beta).

Every filter is optional and the filters combine with AND: subject_id (DOI of the citing work), object_id (DOI of the cited dataset or software), member_id (Crossref member of the citing work), relation (for example references), and from_created_date / until_created_date (when Crossref added the relationship; 2025, 2025-01, 2025-01-01, or 2025-01-01T12:00).

Source code in packages/stavrophora/src/stavrophora/_sync/datacitations.py
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
class SyncDataCitationsResource:
    """Typed client for the Crossref Data Citations API (beta).

    Every filter is optional and the filters combine with AND:
    ``subject_id`` (DOI of the citing work), ``object_id`` (DOI of the cited
    dataset or software), ``member_id`` (Crossref member of the citing
    work), ``relation`` (for example ``references``), and
    ``from_created_date`` / ``until_created_date`` (when Crossref added the
    relationship; ``2025``, ``2025-01``, ``2025-01-01``, or
    ``2025-01-01T12:00``).
    """

    def __init__(self, client: SyncBaseApiClient) -> None:
        self._client = client
        self._url = str(httpx.URL(client.base_url).copy_with(path=DATACITATIONS_PATH))

    def search(
        self,
        *,
        subject_id: str | None = None,
        object_id: str | None = None,
        member_id: str | int | None = None,
        relation: str | None = None,
        from_created_date: str | None = None,
        until_created_date: str | None = None,
        rows: int | None = None,
        page: int | None = None,
    ) -> Page[DataCitation]:
        """Return one page of data citations.

        ``page`` is 0-based. ``page.next_cursor`` holds the next page number
        as a string, or ``None`` after the last page; ``page.total`` is the
        number of matching relationships.
        """
        params = _params(
            subject_id=subject_id,
            object_id=object_id,
            member_id=member_id,
            relation=relation,
            from_created_date=from_created_date,
            until_created_date=until_created_date,
            rows=rows,
            page=page,
        )
        message, response = self._fetch(params)
        results = [
            validate_model(
                DataCitation, item, request=response.request, response=response
            )
            for item in message.get("items") or []
        ]
        next_page = message.get("next-page")
        total = message.get("total-results")
        meta = {key: value for key, value in message.items() if key != "items"}
        return Page(
            results=results,
            total=int(total) if total is not None else None,
            next_cursor=str(next_page) if next_page is not None else None,
            page=page if page is not None else 0,
            meta=meta,
        )

    def iterate(
        self,
        *,
        subject_id: str | None = None,
        object_id: str | None = None,
        member_id: str | int | None = None,
        relation: str | None = None,
        from_created_date: str | None = None,
        until_created_date: str | None = None,
        rows: int = DATACITATIONS_MAX_ROWS,
    ) -> Iterator[DataCitation]:
        """Yield every matching data citation, following ``next-page``."""
        page_number: Any = 0
        while page_number is not None:
            params = _params(
                subject_id=subject_id,
                object_id=object_id,
                member_id=member_id,
                relation=relation,
                from_created_date=from_created_date,
                until_created_date=until_created_date,
                rows=rows,
                page=int(page_number),
            )
            message, response = self._fetch(params)
            items = message.get("items") or []
            for item in items:
                yield validate_model(
                    DataCitation, item, request=response.request, response=response
                )
            page_number = message.get("next-page") if items else None

    def _fetch(self, params: dict[str, Any]) -> tuple[dict[str, Any], httpx.Response]:
        """Send one request and return the ``message`` object and the response."""
        response = self._client.request("GET", self._url, params=params)
        body = self._client.parse_json(response)
        message = body.get("message") if isinstance(body, dict) else None
        if not isinstance(message, dict):
            raise ConfigurationError(
                "Crossref /beta/datacitations answered without a message object."
            )
        return message, response

    def count(
        self,
        *,
        subject_id: str | None = None,
        object_id: str | None = None,
        member_id: str | int | None = None,
        relation: str | None = None,
        from_created_date: str | None = None,
        until_created_date: str | None = None,
    ) -> int:
        """Return the number of matching data citations (one 1-row request)."""
        page = self.search(
            subject_id=subject_id,
            object_id=object_id,
            member_id=member_id,
            relation=relation,
            from_created_date=from_created_date,
            until_created_date=until_created_date,
            rows=1,
        )
        return page.total or 0

count(*, subject_id=None, object_id=None, member_id=None, relation=None, from_created_date=None, until_created_date=None)

Return the number of matching data citations (one 1-row request).

Source code in packages/stavrophora/src/stavrophora/_sync/datacitations.py
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
def count(
    self,
    *,
    subject_id: str | None = None,
    object_id: str | None = None,
    member_id: str | int | None = None,
    relation: str | None = None,
    from_created_date: str | None = None,
    until_created_date: str | None = None,
) -> int:
    """Return the number of matching data citations (one 1-row request)."""
    page = self.search(
        subject_id=subject_id,
        object_id=object_id,
        member_id=member_id,
        relation=relation,
        from_created_date=from_created_date,
        until_created_date=until_created_date,
        rows=1,
    )
    return page.total or 0

iterate(*, subject_id=None, object_id=None, member_id=None, relation=None, from_created_date=None, until_created_date=None, rows=DATACITATIONS_MAX_ROWS)

Yield every matching data citation, following next-page.

Source code in packages/stavrophora/src/stavrophora/_sync/datacitations.py
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
def iterate(
    self,
    *,
    subject_id: str | None = None,
    object_id: str | None = None,
    member_id: str | int | None = None,
    relation: str | None = None,
    from_created_date: str | None = None,
    until_created_date: str | None = None,
    rows: int = DATACITATIONS_MAX_ROWS,
) -> Iterator[DataCitation]:
    """Yield every matching data citation, following ``next-page``."""
    page_number: Any = 0
    while page_number is not None:
        params = _params(
            subject_id=subject_id,
            object_id=object_id,
            member_id=member_id,
            relation=relation,
            from_created_date=from_created_date,
            until_created_date=until_created_date,
            rows=rows,
            page=int(page_number),
        )
        message, response = self._fetch(params)
        items = message.get("items") or []
        for item in items:
            yield validate_model(
                DataCitation, item, request=response.request, response=response
            )
        page_number = message.get("next-page") if items else None

search(*, subject_id=None, object_id=None, member_id=None, relation=None, from_created_date=None, until_created_date=None, rows=None, page=None)

Return one page of data citations.

page is 0-based. page.next_cursor holds the next page number as a string, or None after the last page; page.total is the number of matching relationships.

Source code in packages/stavrophora/src/stavrophora/_sync/datacitations.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
def search(
    self,
    *,
    subject_id: str | None = None,
    object_id: str | None = None,
    member_id: str | int | None = None,
    relation: str | None = None,
    from_created_date: str | None = None,
    until_created_date: str | None = None,
    rows: int | None = None,
    page: int | None = None,
) -> Page[DataCitation]:
    """Return one page of data citations.

    ``page`` is 0-based. ``page.next_cursor`` holds the next page number
    as a string, or ``None`` after the last page; ``page.total`` is the
    number of matching relationships.
    """
    params = _params(
        subject_id=subject_id,
        object_id=object_id,
        member_id=member_id,
        relation=relation,
        from_created_date=from_created_date,
        until_created_date=until_created_date,
        rows=rows,
        page=page,
    )
    message, response = self._fetch(params)
    results = [
        validate_model(
            DataCitation, item, request=response.request, response=response
        )
        for item in message.get("items") or []
    ]
    next_page = message.get("next-page")
    total = message.get("total-results")
    meta = {key: value for key, value in message.items() if key != "items"}
    return Page(
        results=results,
        total=int(total) if total is not None else None,
        next_cursor=str(next_page) if next_page is not None else None,
        page=page if page is not None else 0,
        meta=meta,
    )

Filters

stavrophora.filters

Pydantic filter models for the Crossref API.

Crossref filter syntax: filter=field:value,field:value — repeated keys act as OR (filter=doi:a,doi:b), different keys as AND. The field lists mirror the live API's advertised filters (verified 2026-11); unknown filters are accepted through extra="allow" and serialized with their literal name.

FunderFilters

Bases: _CrossrefFilters

Filter model for /funders; location is a case-sensitive country name.

Source code in packages/stavrophora/src/stavrophora/filters.py
155
156
157
158
class FunderFilters(_CrossrefFilters):
    """Filter model for ``/funders``; ``location`` is a case-sensitive country name."""

    location: StrFilter = None

MemberFilters

Bases: _CrossrefFilters

Filter model for /members (probe-verified 2026-11).

Source code in packages/stavrophora/src/stavrophora/filters.py
147
148
149
150
151
152
class MemberFilters(_CrossrefFilters):
    """Filter model for ``/members`` (probe-verified 2026-11)."""

    prefix: StrFilter = None
    backfile_doi_count: IntFilter = Field(None, alias="backfile-doi-count")
    current_doi_count: IntFilter = Field(None, alias="current-doi-count")

WorksFilters

Bases: _CrossrefFilters

Filter model for the works routes (top-level and scoped).

Source code in packages/stavrophora/src/stavrophora/filters.py
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
class WorksFilters(_CrossrefFilters):
    """Filter model for the works routes (top-level and scoped)."""

    # Type / classification
    type: StrFilter = None
    type_name: StrFilter = Field(None, alias="type-name")
    category_name: StrFilter = Field(None, alias="category-name")
    group_title: StrFilter = Field(None, alias="group-title")
    directory: StrFilter = None

    # Identifiers
    doi: StrFilter = None
    issn: StrFilter = None
    isbn: StrFilter = None
    orcid: StrFilter = None
    ror_id: StrFilter = Field(None, alias="ror-id")
    prefix: StrFilter = None
    member: IdFilter = None
    container_title: StrFilter = Field(None, alias="container-title")
    alternative_id: StrFilter = Field(None, alias="alternative-id")
    article_number: StrFilter = Field(None, alias="article-number")
    archive: StrFilter = None
    content_domain: StrFilter = Field(None, alias="content-domain")
    project_id: StrFilter = Field(None, alias="project-id")

    # Publication dates (YYYY, YYYY-MM, or YYYY-MM-DD)
    from_pub_date: str | None = Field(None, alias="from-pub-date")
    until_pub_date: str | None = Field(None, alias="until-pub-date")
    from_print_pub_date: str | None = Field(None, alias="from-print-pub-date")
    until_print_pub_date: str | None = Field(None, alias="until-print-pub-date")
    from_online_pub_date: str | None = Field(None, alias="from-online-pub-date")
    until_online_pub_date: str | None = Field(None, alias="until-online-pub-date")
    from_issued_date: str | None = Field(None, alias="from-issued-date")
    until_issued_date: str | None = Field(None, alias="until-issued-date")
    from_accepted_date: str | None = Field(None, alias="from-accepted-date")
    until_accepted_date: str | None = Field(None, alias="until-accepted-date")
    from_approved_date: str | None = Field(None, alias="from-approved-date")
    until_approved_date: str | None = Field(None, alias="until-approved-date")
    from_awarded_date: str | None = Field(None, alias="from-awarded-date")
    until_awarded_date: str | None = Field(None, alias="until-awarded-date")
    from_posted_date: str | None = Field(None, alias="from-posted-date")
    until_posted_date: str | None = Field(None, alias="until-posted-date")
    from_event_start_date: str | None = Field(None, alias="from-event-start-date")
    until_event_start_date: str | None = Field(None, alias="until-event-start-date")
    from_event_end_date: str | None = Field(None, alias="from-event-end-date")
    until_event_end_date: str | None = Field(None, alias="until-event-end-date")

    # System dates — incremental sync (prefer created/deposit windows: cursor
    # result sets under index-date windows are not stable since 2026-08-24)
    from_index_date: str | None = Field(None, alias="from-index-date")
    until_index_date: str | None = Field(None, alias="until-index-date")
    from_created_date: str | None = Field(None, alias="from-created-date")
    until_created_date: str | None = Field(None, alias="until-created-date")
    from_deposit_date: str | None = Field(None, alias="from-deposit-date")
    until_deposit_date: str | None = Field(None, alias="until-deposit-date")
    from_update_date: str | None = Field(None, alias="from-update-date")
    until_update_date: str | None = Field(None, alias="until-update-date")

    # Updates
    update_type: StrFilter = Field(None, alias="update-type")
    updates: StrFilter = None
    is_update: bool | None = Field(None, alias="is-update")

    # Citation thresholds
    gte_citation: int | None = Field(None, alias="gte-citation")
    lte_citation: int | None = Field(None, alias="lte-citation")

    # Funding
    funder: StrFilter = None
    award_number: StrFilter = Field(None, alias="award.number")
    award_funder: StrFilter = Field(None, alias="award.funder")
    funder_doi_asserted_by: StrFilter = Field(None, alias="funder-doi-asserted-by")
    gte_award_amount: int | None = Field(None, alias="gte-award-amount")
    lte_award_amount: int | None = Field(None, alias="lte-award-amount")

    # Licenses / full text
    license_url: StrFilter = Field(None, alias="license.url")
    license_version: StrFilter = Field(None, alias="license.version")
    license_delay: IntFilter = Field(None, alias="license.delay")
    full_text_application: StrFilter = Field(None, alias="full-text.application")
    full_text_type: StrFilter = Field(None, alias="full-text.type")
    full_text_version: StrFilter = Field(None, alias="full-text.version")

    # Relations
    relation_object: StrFilter = Field(None, alias="relation.object")
    relation_object_type: StrFilter = Field(None, alias="relation.object-type")
    relation_type: StrFilter = Field(None, alias="relation.type")

    # Publisher assertions
    assertion: StrFilter = None
    assertion_group: StrFilter = Field(None, alias="assertion-group")
    clinical_trial_number: StrFilter = Field(None, alias="clinical-trial-number")

    # Boolean presence filters
    has_abstract: bool | None = Field(None, alias="has-abstract")
    has_affiliation: bool | None = Field(None, alias="has-affiliation")
    has_affiliation_ror_id: bool | None = Field(None, alias="has-affiliation-ror-id")
    has_authenticated_orcid: bool | None = Field(None, alias="has-authenticated-orcid")
    has_archive: bool | None = Field(None, alias="has-archive")
    has_assertion: bool | None = Field(None, alias="has-assertion")
    has_award: bool | None = Field(None, alias="has-award")
    has_clinical_trial_number: bool | None = Field(
        None, alias="has-clinical-trial-number"
    )
    has_content_domain: bool | None = Field(None, alias="has-content-domain")
    has_domain_restriction: bool | None = Field(None, alias="has-domain-restriction")
    has_event: bool | None = Field(None, alias="has-event")
    has_full_text: bool | None = Field(None, alias="has-full-text")
    has_funder: bool | None = Field(None, alias="has-funder")
    has_funder_doi: bool | None = Field(None, alias="has-funder-doi")
    has_funder_ror_id: bool | None = Field(None, alias="has-funder-ror-id")
    has_license: bool | None = Field(None, alias="has-license")
    has_orcid: bool | None = Field(None, alias="has-orcid")
    has_prime_doi: bool | None = Field(None, alias="has-prime-doi")
    has_references: bool | None = Field(None, alias="has-references")
    has_relation: bool | None = Field(None, alias="has-relation")
    has_ror_id: bool | None = Field(None, alias="has-ror-id")
    has_update: bool | None = Field(None, alias="has-update")
    has_update_policy: bool | None = Field(None, alias="has-update-policy")
    has_alias: bool | None = Field(None, alias="has-alias")

Models

stavrophora.models.base

Base Pydantic models for the Crossref API response envelope and shared nested types.

Affiliation

Bases: EntityModel

Contributor affiliation ({name, id: [...], place: [...]}).

Source code in packages/stavrophora/src/stavrophora/models/base.py
81
82
83
84
85
86
87
class Affiliation(EntityModel):
    """Contributor affiliation (``{name, id: [...], place: [...]}``)."""

    name: SafeStr | None = None
    #: ROR etc. ids; the wire key is the singular ``id``
    ids: SafeList[Identifier] = Field(default_factory=list, alias="id")
    place: SafeList[str] = Field(default_factory=list)

Assertion

Bases: EntityModel

Publisher assertion on a work (history, license info, ...).

Source code in packages/stavrophora/src/stavrophora/models/base.py
172
173
174
175
176
177
178
179
180
class Assertion(EntityModel):
    """Publisher assertion on a work (history, license info, ...)."""

    name: str | None = None
    value: str | None = None
    label: str | None = None
    order: int | None = None
    url: str | None = Field(None, alias="URL")
    group: AssertionGroup | None = None

AssertionGroup

Bases: EntityModel

Named grouping of assertions on a work.

Source code in packages/stavrophora/src/stavrophora/models/base.py
165
166
167
168
169
class AssertionGroup(EntityModel):
    """Named grouping of assertions on a work."""

    name: str | None = None
    label: str | None = None

AwardInfo

Bases: EntityModel

Award number grouping inside a funder entry.

Source code in packages/stavrophora/src/stavrophora/models/base.py
113
114
115
116
class AwardInfo(EntityModel):
    """Award number grouping inside a funder entry."""

    award_number: SafeList[str] = Field(default_factory=list, alias="award-number")

Breakdowns

Bases: EntityModel

DOI counts by issued year ([[year, count], ...]).

Source code in packages/stavrophora/src/stavrophora/models/base.py
57
58
59
60
61
62
class Breakdowns(EntityModel):
    """DOI counts by issued year (``[[year, count], ...]``)."""

    dois_by_issued_year: SafeList[tuple[int, int]] = Field(
        default_factory=list, alias="dois-by-issued-year"
    )

ClinicalTrialNumber

Bases: EntityModel

Clinical trial registration attached to a work.

Source code in packages/stavrophora/src/stavrophora/models/base.py
183
184
185
186
187
class ClinicalTrialNumber(EntityModel):
    """Clinical trial registration attached to a work."""

    clinical_trial_number: str | None = Field(None, alias="clinical-trial-number")
    registry: str | None = None

ContentDomain

Bases: EntityModel

Crossmark content domain of a work.

Source code in packages/stavrophora/src/stavrophora/models/base.py
241
242
243
244
245
class ContentDomain(EntityModel):
    """Crossmark content domain of a work."""

    domain: SafeList[str] = Field(default_factory=list)
    crossmark_restriction: bool | None = Field(None, alias="crossmark-restriction")

Contributor

Bases: EntityModel

Author/editor/contributor/chair on a work.

Source code in packages/stavrophora/src/stavrophora/models/base.py
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
class Contributor(EntityModel):
    """Author/editor/contributor/chair on a work."""

    given: str | None = None
    family: str | None = None
    name: str | None = None
    orcid: str | None = Field(None, validation_alias=AliasChoices("ORCID", "orcid"))
    affiliation: SafeList[Affiliation] = Field(default_factory=list)
    role: SafeList[ContributorRole] = Field(default_factory=list)
    sequence: str | None = None
    authenticated_orcid: bool | None = Field(None, alias="authenticated-orcid")
    suffix: str | None = None

ContributorRole

Bases: EntityModel

Controlled-vocabulary role of a contributor ({role, vocabulary}).

Source code in packages/stavrophora/src/stavrophora/models/base.py
74
75
76
77
78
class ContributorRole(EntityModel):
    """Controlled-vocabulary role of a contributor (``{role, vocabulary}``)."""

    role: SafeStr | None = None
    vocabulary: SafeStr | None = None

Counts

Bases: EntityModel

DOI totals shared by journal and member records.

Source code in packages/stavrophora/src/stavrophora/models/base.py
49
50
51
52
53
54
class Counts(EntityModel):
    """DOI totals shared by journal and member records."""

    total_dois: SafeInt = Field(0, alias="total-dois")
    backfile_dois: SafeInt = Field(0, alias="backfile-dois")
    current_dois: SafeInt = Field(0, alias="current-dois")

CrossRefDate

Bases: EntityModel

Crossref date object (issued, published, created, ...).

Shape: {"date-parts": [[2021, 6, 11]], "timestamp": ..., "source": ...}

Source code in packages/stavrophora/src/stavrophora/models/base.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class CrossRefDate(EntityModel):
    """Crossref date object (``issued``, ``published``, ``created``, ...).

    Shape: ``{"date-parts": [[2021, 6, 11]], "timestamp": ..., "source": ...}``
    """

    date_parts: SafeList[SafeList[int]] = Field(
        default_factory=list, alias="date-parts"
    )
    date_time: str | None = Field(None, alias="date-time")
    timestamp: int | None = None
    source: str | None = None
    version: str | None = None

    @property
    def year(self) -> int | None:
        """First year of the first date part, if present."""
        for part in self.date_parts:
            if part:
                return part[0]
        return None

year property

First year of the first date part, if present.

EntityModel

Bases: BaseModel

Shared base for Crossref entity and nested models.

Every field is optional with a default so results requested with select (sparse fieldsets) still validate; extra="allow" keeps fields the API returns that the spec does not document.

Source code in packages/stavrophora/src/stavrophora/models/base.py
 8
 9
10
11
12
13
14
15
16
class EntityModel(BaseModel):
    """Shared base for Crossref entity and nested models.

    Every field is optional with a default so results requested with
    ``select`` (sparse fieldsets) still validate; ``extra="allow"`` keeps
    fields the API returns that the spec does not document.
    """

    model_config = ConfigDict(extra="allow", populate_by_name=True)

Event

Bases: EntityModel

Event (conference) associated with a proceedings work.

Source code in packages/stavrophora/src/stavrophora/models/base.py
206
207
208
209
210
211
212
213
214
215
216
217
class Event(EntityModel):
    """Event (conference) associated with a proceedings work."""

    name: str | None = None
    acronym: str | None = None
    number: str | None = None
    location: str | None = None
    #: a bare string for one sponsor, a list for several (the deposit schema allows ten)
    sponsor: SafeStrList = Field(default_factory=list)
    theme: SafeStrList = Field(default_factory=list)
    start: CrossRefDate | None = None
    end: CrossRefDate | None = None

FunderRef

Bases: EntityModel

Funder entry on a work (Funder Registry DOI + award numbers).

Source code in packages/stavrophora/src/stavrophora/models/base.py
119
120
121
122
123
124
125
126
127
class FunderRef(EntityModel):
    """Funder entry on a work (Funder Registry DOI + award numbers)."""

    name: str | None = None
    doi: str | None = Field(None, alias="DOI")
    award: SafeList[str] = Field(default_factory=list)
    award_info: SafeList[AwardInfo] = Field(default_factory=list, alias="award-info")
    id: SafeList[Identifier] = Field(default_factory=list)
    doi_asserted_by: str | None = Field(None, alias="doi-asserted-by")

Identifier

Bases: EntityModel

External id ({id, id-type, asserted-by}) used for ROR ids, funder ids, and relation objects.

Source code in packages/stavrophora/src/stavrophora/models/base.py
65
66
67
68
69
70
71
class Identifier(EntityModel):
    """External id ({``id``, ``id-type``, ``asserted-by``}) used for ROR ids,
    funder ids, and relation objects."""

    id: SafeStr | None = None
    id_type: SafeStr | None = Field(None, alias="id-type")
    asserted_by: SafeStr | None = Field(None, alias="asserted-by")

Institution

Bases: EntityModel

Institution associated with a work (e.g. posted-content affiliations).

Source code in packages/stavrophora/src/stavrophora/models/base.py
190
191
192
193
194
195
196
class Institution(EntityModel):
    """Institution associated with a work (e.g. posted-content affiliations)."""

    name: str | None = None
    acronym: SafeList[str] = Field(default_factory=list)
    place: SafeList[str] = Field(default_factory=list)
    department: SafeList[str] = Field(default_factory=list)

IssnType

Bases: EntityModel

ISSN with its type (print/electronic).

Source code in packages/stavrophora/src/stavrophora/models/base.py
42
43
44
45
46
class IssnType(EntityModel):
    """ISSN with its type (print/electronic)."""

    type: str | None = None
    value: str | None = None

JournalIssue

Bases: EntityModel

Issue details nested on a work (journal-issue).

Source code in packages/stavrophora/src/stavrophora/models/base.py
248
249
250
251
252
253
254
class JournalIssue(EntityModel):
    """Issue details nested on a work (``journal-issue``)."""

    issue: str | None = None
    volume: str | None = None
    published_print: CrossRefDate | None = Field(None, alias="published-print")
    published_online: CrossRefDate | None = Field(None, alias="published-online")

LicenseRef

Bases: EntityModel

License entry on a work.

Source code in packages/stavrophora/src/stavrophora/models/base.py
104
105
106
107
108
109
110
class LicenseRef(EntityModel):
    """License entry on a work."""

    url: str | None = Field(None, alias="URL")
    content_version: str | None = Field(None, alias="content-version")
    delay_in_days: int | None = Field(None, alias="delay-in-days")
    start: CrossRefDate | None = None

Bases: EntityModel

Full-text link on a work.

Source code in packages/stavrophora/src/stavrophora/models/base.py
156
157
158
159
160
161
162
class Link(EntityModel):
    """Full-text link on a work."""

    url: str | None = Field(None, alias="URL")
    content_type: str | None = Field(None, alias="content-type")
    content_version: str | None = Field(None, alias="content-version")
    intended_application: str | None = Field(None, alias="intended-application")

Reference

Bases: EntityModel

Bibliographic reference on a work.

Which keys are present varies by publisher; all are optional.

Source code in packages/stavrophora/src/stavrophora/models/base.py
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
class Reference(EntityModel):
    """Bibliographic reference on a work.

    Which keys are present varies by publisher; all are optional.
    """

    key: str | None = None
    doi: str | None = Field(None, alias="DOI")
    doi_asserted_by: str | None = Field(None, alias="doi-asserted-by")
    identifier: str | None = None
    unstructured: str | None = None
    author: str | None = None
    year: str | None = None
    volume: str | None = None
    issue: str | None = None
    first_page: str | None = Field(None, alias="first-page")
    journal_title: str | None = Field(None, alias="journal-title")
    article_title: str | None = Field(None, alias="article-title")
    series_title: str | None = Field(None, alias="series-title")
    volume_title: str | None = Field(None, alias="volume-title")
    issn: str | None = Field(None, alias="ISSN")
    #: bare string in references ("print"), not an ``{type, value}`` object
    issn_type: str | None = Field(None, alias="issn-type")
    type: str | None = None

RelationObject

Bases: EntityModel

One end of a relation: {id, id-type, asserted-by}.

Source code in packages/stavrophora/src/stavrophora/models/base.py
220
221
222
223
224
225
class RelationObject(EntityModel):
    """One end of a relation: ``{id, id-type, asserted-by}``."""

    id: str | None = None
    id_type: str | None = Field(None, alias="id-type")
    asserted_by: str | None = Field(None, alias="asserted-by")

Resource

Bases: EntityModel

Landing-page resources of a work.

Source code in packages/stavrophora/src/stavrophora/models/base.py
234
235
236
237
238
class Resource(EntityModel):
    """Landing-page resources of a work."""

    primary: ResourceUrl | None = None
    secondary: SafeList[ResourceUrl] = Field(default_factory=list)

ResourceUrl

Bases: EntityModel

URL entry inside a work resource.

Source code in packages/stavrophora/src/stavrophora/models/base.py
228
229
230
231
class ResourceUrl(EntityModel):
    """URL entry inside a work ``resource``."""

    url: str | None = Field(None, alias="URL")

StandardsBody

Bases: EntityModel

Standards body of a standard work ({name, acronym}).

Source code in packages/stavrophora/src/stavrophora/models/base.py
199
200
201
202
203
class StandardsBody(EntityModel):
    """Standards body of a standard work (``{name, acronym}``)."""

    name: str | None = None
    acronym: str | None = None

UpdateTo

Bases: EntityModel

Entry in a work's update-to or updated-by list.

type names the update (retraction, correction, new_version, ...) and source who asserted it: publisher or retraction-watch. Entries from Retraction Watch carry the Retraction Watch database id in record_id.

Source code in packages/stavrophora/src/stavrophora/models/base.py
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
class UpdateTo(EntityModel):
    """Entry in a work's ``update-to`` or ``updated-by`` list.

    ``type`` names the update (``retraction``, ``correction``,
    ``new_version``, ...) and ``source`` who asserted it: ``publisher`` or
    ``retraction-watch``. Entries from Retraction Watch carry the Retraction
    Watch database id in ``record_id``.
    """

    doi: str | None = Field(None, alias="DOI")
    type: str | None = None
    label: str | None = None
    source: str | None = None
    updated: CrossRefDate | None = None
    record_id: str | None = Field(None, alias="record-id")

stavrophora.models.work

Pydantic models for the Work entity and its nested types.

Work

Bases: EntityModel

A Crossref work record.

Field names are snake_case with kebab-case aliases matching the live API keys (DOI, container-title, is-referenced-by-count, ...). The Crossref spec is incomplete — extra="allow" keeps any field the API returns but the model does not declare.

Source code in packages/stavrophora/src/stavrophora/models/work.py
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
class Work(EntityModel):
    """A Crossref work record.

    Field names are snake_case with kebab-case aliases matching the live
    API keys (``DOI``, ``container-title``, ``is-referenced-by-count``,
    ...). The Crossref spec is incomplete — ``extra="allow"`` keeps any
    field the API returns but the model does not declare.
    """

    # Identity
    doi: SafeStr | None = Field(None, alias="DOI")
    url: str | None = Field(None, alias="URL")
    title: SafeList[str] = Field(default_factory=list)
    subtitle: SafeList[str] = Field(default_factory=list)
    original_title: SafeList[str] = Field(default_factory=list, alias="original-title")
    short_title: SafeList[str] = Field(default_factory=list, alias="short-title")
    container_title: SafeList[str] = Field(
        default_factory=list, alias="container-title"
    )
    short_container_title: SafeList[str] = Field(
        default_factory=list, alias="short-container-title"
    )
    description: SafeStr | None = None

    # People
    author: SafeList[Contributor] = Field(default_factory=list)
    editor: SafeList[Contributor] = Field(default_factory=list)
    translator: SafeList[Contributor] = Field(default_factory=list)
    chair: SafeList[Contributor] = Field(default_factory=list)

    # Dates
    issued: CrossRefDate | None = None
    published: CrossRefDate | None = None
    published_print: CrossRefDate | None = Field(None, alias="published-print")
    published_online: CrossRefDate | None = Field(None, alias="published-online")
    published_other: CrossRefDate | None = Field(None, alias="published-other")
    created: CrossRefDate | None = None
    deposited: CrossRefDate | None = None
    indexed: CrossRefDate | None = None
    content_created: CrossRefDate | None = Field(None, alias="content-created")
    content_updated: CrossRefDate | None = Field(None, alias="content-updated")
    approved: CrossRefDate | None = None
    posted: CrossRefDate | None = None
    accepted: CrossRefDate | None = None

    # Classification
    type: str | None = None
    subtype: str | None = None
    publisher: SafeStr | None = None
    publisher_location: SafeStr | None = Field(None, alias="publisher-location")
    language: SafeStr | None = None
    subject: SafeList[str] = Field(default_factory=list)

    # Citation metrics
    is_referenced_by_count: SafeInt = Field(0, alias="is-referenced-by-count")
    references_count: SafeInt = Field(
        0, validation_alias=AliasChoices("references-count", "reference-count")
    )
    #: relevance score, present on list items when a query or relevance sort is used
    score: float | None = None
    source: SafeStr | None = None

    # Bibliographic
    issn: SafeList[str] = Field(default_factory=list, alias="ISSN")
    isbn: SafeList[str] = Field(default_factory=list, alias="ISBN")
    issn_type: SafeList[IssnType] = Field(default_factory=list, alias="issn-type")
    isbn_type: SafeList[IssnType] = Field(default_factory=list, alias="isbn-type")
    page: SafeStr | None = None
    volume: SafeStr | None = None
    issue: SafeStr | None = None
    article_number: SafeStr | None = Field(None, alias="article-number")
    edition_number: SafeStr | None = Field(None, alias="edition-number")
    journal_issue: JournalIssue | None = Field(None, alias="journal-issue")

    # Content
    abstract: SafeStr | None = None
    license: SafeList[LicenseRef] = Field(default_factory=list)
    funder: SafeList[FunderRef] = Field(default_factory=list)
    reference: SafeList[Reference] = Field(default_factory=list)
    link: SafeList[Link] = Field(default_factory=list)
    alternative_id: SafeList[str] = Field(default_factory=list, alias="alternative-id")

    # Provenance / relations
    #: bare member id (``"297"``) or ``https://id.crossref.org/member/297`` URI
    member: IdSafeStr | None = None
    #: bare prefix (``"10.1038"``) or ``https://id.crossref.org/prefix/10.1038`` URI
    prefix: IdSafeStr | None = None
    resource: Resource | None = None
    content_domain: ContentDomain | None = Field(None, alias="content-domain")
    #: ``{relation-type: [{id, id-type, asserted-by}]}``; relation types are open-ended
    relation: dict[str, SafeList[RelationObject]] | None = None
    update_policy: SafeStr | None = Field(None, alias="update-policy")
    #: works that updated this one (later versions, corrections, ...);
    #: present on the older records of an update chain
    updated_by: SafeList[UpdateTo] = Field(default_factory=list, alias="updated-by")
    #: works this one updated (earlier versions); present on the newer records
    update_to: SafeList[UpdateTo] = Field(default_factory=list, alias="update-to")
    group_title: SafeStr | None = Field(None, alias="group-title")
    clinical_trial_number: SafeList[ClinicalTrialNumber] = Field(
        default_factory=list, alias="clinical-trial-number"
    )
    #: Live API returns bare archive names (``["CLOCKSS", "LOCKSS", "Portico"]``).
    archive: SafeStrList = Field(default_factory=list)
    assertion: SafeList[Assertion] = Field(default_factory=list)
    event: Event | None = None
    agent: SafeStr | None = None
    institution: SafeList[Institution] = Field(default_factory=list)
    degree: SafeStrList = Field(default_factory=list)
    project: SafeList[dict[str, Any]] = Field(default_factory=list)
    standards_body: StandardsBody | None = Field(None, alias="standards-body")
    #: documented in the swagger spec, not yet seen on live probes
    review: dict | None = None

    @property
    def primary_title(self) -> str:
        """First title string, or ``""`` when absent (SafeStr-style access)."""
        return self.title[0] if self.title else ""

    @property
    def retractions(self) -> list[UpdateTo]:
        """The ``updated-by`` entries of type ``retraction``.

        Each entry names the DOI of a retraction notice. Crossref lists the
        publisher's notice and the Retraction Watch record separately, so one
        retraction can appear twice with different ``source`` values.
        """
        return [entry for entry in self.updated_by if entry.type == "retraction"]

    @property
    def is_retracted(self) -> bool:
        """Whether a publisher or Retraction Watch reports a retraction."""
        return bool(self.retractions)

is_retracted property

Whether a publisher or Retraction Watch reports a retraction.

primary_title property

First title string, or "" when absent (SafeStr-style access).

retractions property

The updated-by entries of type retraction.

Each entry names the DOI of a retraction notice. Crossref lists the publisher's notice and the Retraction Watch record separately, so one retraction can appear twice with different source values.

stavrophora.models.entities

Pydantic models for Crossref journal, funder, member, type, prefix and license entities.

CrossRefType

Bases: EntityModel

A Crossref work type (e.g. journal-article).

Source code in packages/stavrophora/src/stavrophora/models/entities.py
89
90
91
92
93
class CrossRefType(EntityModel):
    """A Crossref work type (e.g. ``journal-article``)."""

    id: SafeStr | None = None
    label: SafeStr | None = None

Funder

Bases: EntityModel

A Crossref funder (Funder Registry record).

hierarchy fields only appear on /funders/{id} records, not on funder list items.

Source code in packages/stavrophora/src/stavrophora/models/entities.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
class Funder(EntityModel):
    """A Crossref funder (Funder Registry record).

    ``hierarchy`` fields only appear on ``/funders/{id}`` records, not
    on funder list items.
    """

    id: SafeStr | None = None
    name: SafeStr | None = None
    tokens: SafeList[str] = Field(default_factory=list)
    uri: SafeStr | None = None
    location: SafeStr | None = None
    alt_names: SafeList[str] = Field(default_factory=list, alias="alt-names")
    replaces: SafeList[str] = Field(default_factory=list)
    replaced_by: SafeList[str] = Field(default_factory=list, alias="replaced-by")
    work_count: SafeInt = Field(0, alias="work-count")
    descendant_work_count: SafeInt = Field(0, alias="descendant-work-count")
    #: nested ``{funder-id: {child-funder-id: {...}}}`` tree; recursive, so kept as dicts
    hierarchy: dict[str, Any] | None = None
    hierarchy_names: dict[str, str] | None = Field(None, alias="hierarchy-names")
    descendants: SafeList[str] = Field(default_factory=list)

Journal

Bases: EntityModel

A Crossref journal (list item and /journals/{issn} record).

Source code in packages/stavrophora/src/stavrophora/models/entities.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class Journal(EntityModel):
    """A Crossref journal (list item and ``/journals/{issn}`` record)."""

    #: bare string on ``/journals/{issn}``, list on ``/journals`` — SafeStrList handles both
    title: SafeStrList = Field(default_factory=list)
    publisher: SafeStr | None = None
    issn: SafeList[str] = Field(default_factory=list, alias="ISSN")
    issn_type: SafeList[IssnType] = Field(default_factory=list, alias="issn-type")
    counts: Counts | None = None
    #: ``{coverage-key: fraction}``; coverage keys are open-ended
    coverage: dict[str, float] | None = None
    #: nested per ``{all, backfile, current}``, each ``{coverage-key: fraction}``;
    #: coverage keys are open-ended
    coverage_type: dict[str, dict[str, float]] | None = Field(
        None, alias="coverage-type"
    )
    flags: dict[str, bool] | None = None
    breakdowns: Breakdowns | None = None
    subjects: SafeList[str] = Field(default_factory=list)
    last_status_check_time: float | None = Field(None, alias="last-status-check-time")

    @property
    def primary_title(self) -> str:
        """First title string, or ``""`` when absent."""
        return self.title[0] if self.title else ""

primary_title property

First title string, or "" when absent.

License

Bases: EntityModel

A Crossref license (list item on /licenses).

Source code in packages/stavrophora/src/stavrophora/models/entities.py
109
110
111
112
113
class License(EntityModel):
    """A Crossref license (list item on ``/licenses``)."""

    url: str | None = Field(None, alias="URL")
    work_count: int = Field(0, alias="work-count")

Member

Bases: EntityModel

A Crossref member (publisher account).

Source code in packages/stavrophora/src/stavrophora/models/entities.py
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
class Member(EntityModel):
    """A Crossref member (publisher account)."""

    id: int | None = None
    primary_name: SafeStr | None = Field(None, alias="primary-name")
    names: SafeList[str] = Field(default_factory=list)
    prefixes: SafeList[str] = Field(default_factory=list)
    prefix: SafeList[MemberPrefix] = Field(default_factory=list)
    tokens: SafeList[str] = Field(default_factory=list)
    location: SafeStr | None = None
    counts: Counts | None = None
    counts_type: dict[str, dict[str, int]] | None = Field(None, alias="counts-type")
    coverage: dict[str, float] | None = None
    coverage_type: dict[str, dict[str, dict[str, float]]] | None = Field(
        None, alias="coverage-type"
    )
    flags: dict[str, bool] | None = None
    breakdowns: Breakdowns | None = None
    last_status_check_time: float | None = Field(None, alias="last-status-check-time")

MemberPrefix

Bases: EntityModel

Prefix entry on a member record ({name, value}).

Source code in packages/stavrophora/src/stavrophora/models/entities.py
11
12
13
14
15
class MemberPrefix(EntityModel):
    """Prefix entry on a member record (``{name, value}``)."""

    name: SafeStr | None = None
    value: SafeStr | None = None

Prefix

Bases: EntityModel

A Crossref DOI prefix owned by a member.

/prefixes/{prefix} returns member/prefix as full https://id.crossref.org/... URIs (live 2026-09); IdSafeStr normalizes both URI and bare forms to the bare value.

Source code in packages/stavrophora/src/stavrophora/models/entities.py
 96
 97
 98
 99
100
101
102
103
104
105
106
class Prefix(EntityModel):
    """A Crossref DOI prefix owned by a member.

    ``/prefixes/{prefix}`` returns ``member``/``prefix`` as full
    ``https://id.crossref.org/...`` URIs (live 2026-09); ``IdSafeStr``
    normalizes both URI and bare forms to the bare value.
    """

    member: IdSafeStr | None = None
    name: SafeStr | None = None
    prefix: IdSafeStr | None = None

stavrophora.models.agency

Pydantic model for the DOI registration agency lookup.

Agency

Bases: EntityModel

Registration agency for a DOI.

Source code in packages/stavrophora/src/stavrophora/models/agency.py
 9
10
11
12
13
class Agency(EntityModel):
    """Registration agency for a DOI."""

    id: SafeStr | None = None
    label: SafeStr | None = None

WorkAgency

Bases: EntityModel

Response of GET /works/{doi}/agency.

Source code in packages/stavrophora/src/stavrophora/models/agency.py
16
17
18
19
20
class WorkAgency(EntityModel):
    """Response of ``GET /works/{doi}/agency``."""

    doi: SafeStr | None = Field(None, alias="DOI")
    agency: Agency | None = None

stavrophora.models.datacitation

Pydantic models for the Crossref Data Citations API (beta).

DataCitation

Bases: EntityModel

One data citation relationship from /beta/datacitations.

subject cites object with the relation type relation (for example references). timestamp is the ISO 8601 time at which Crossref added the relationship to its database.

Source code in packages/stavrophora/src/stavrophora/models/datacitation.py
22
23
24
25
26
27
28
29
30
31
32
33
class DataCitation(EntityModel):
    """One data citation relationship from ``/beta/datacitations``.

    ``subject`` cites ``object`` with the relation type ``relation``
    (for example ``references``). ``timestamp`` is the ISO 8601 time at which
    Crossref added the relationship to its database.
    """

    timestamp: SafeStr | None = None
    relation: SafeStr | None = None
    subject: DataCitationEnd | None = None
    object: DataCitationEnd | None = None

DataCitationEnd

Bases: EntityModel

One end of a data citation: the citing work or the cited object.

member is set on the subject only: the Crossref member that registered the citing work.

Source code in packages/stavrophora/src/stavrophora/models/datacitation.py
 9
10
11
12
13
14
15
16
17
18
19
class DataCitationEnd(EntityModel):
    """One end of a data citation: the citing work or the cited object.

    ``member`` is set on the subject only: the Crossref member that
    registered the citing work.
    """

    id: SafeStr | None = None
    type: SafeStr | None = None
    registration_agency: SafeStr | None = Field(None, alias="registration-agency")
    member: SafeStr | None = None

Exceptions

Exceptions are re-exported from bibliofabric; see its documentation for details. stavrophora exports APIError, AuthError, BibliofabricError, ConfigurationError, NetworkError, NotFoundError, RateLimitError, TimeoutError, and ValidationError, plus Page.