Skip to content

API reference

Generated from the source with mkdocstrings.

Client

scholiast.ScholiastClient

Bases: BaseApiClient

Client for the Semantic Scholar Academic Graph API.

The API key is optional. When the settings carry one, the client sends it in the x-api-key header on every request and the caller gets a guaranteed 1 request per second allocation. Without a key the client runs on the shared anonymous pool, where any request may answer HTTP 429.

papers cached property

The papers resource client.

authors cached property

The authors resource client.

recommendations cached property

The recommendations client (its own base URL).

datasets cached property

The datasets client (its own base URL).

snippets cached property

The snippet search client.

patents cached property

The patents client.

Sync client

scholiast.ScholiastSyncClient

Bases: SyncBaseApiClient

Client for the Semantic Scholar Academic Graph API.

The API key is optional. When the settings carry one, the client sends it in the x-api-key header on every request and the caller gets a guaranteed 1 request per second allocation. Without a key the client runs on the shared anonymous pool, where any request may answer HTTP 429.

papers cached property

The papers resource client.

authors cached property

The authors resource client.

recommendations cached property

The recommendations client (its own base URL).

datasets cached property

The datasets client (its own base URL).

snippets cached property

The snippet search client.

patents cached property

The patents client.

Settings

scholiast.ScholiastSettings

Bases: BaseApiSettings

Semantic Scholar client settings.

Inherits timeout, max_retries, max_retry_wait, max_requests_per_second, max_concurrency, user_agent and mailto from :class:bibliofabric.config.BaseApiSettings. The defaults pace the client at 1 request per second with concurrency 1, matching the guaranteed per-key limit of the API.

api_key is optional. When set, it travels in the x-api-key header and the caller gets its own rate allocation; without it the client runs on the shared anonymous pool, where any request may answer HTTP 429.

Resource clients

Each resource client inherits the generic operations from bibliofabric.ResourceClient (get, search, iterate, collect, first, count) through scholiast._async.resources.ScholiastResourceClient. Only the members that Semantic Scholar changes or adds are shown here.

scholiast._async.papers.PapersClient

Bases: ScholiastResourceClient[Paper]

Client for the /paper routes.

get, search, iterate, collect, first, count, and exists come from the resource base; fields is the select argument everywhere. get accepts every id form the API documents (S2 id, DOI:, ARXIV:, PMID:, PMCID:, MAG:, ACL:, PubMedCentral:, CorpusId:, URL:).

authors(id, *, fields=None, limit=None, offset=None) async

Fetch one page of the authors of id.

autocomplete(query) async

Return completion candidates for a partial query.

Candidates carry a minimal record (id, title, authorsYear). The API returns an empty list for no matches.

batch(ids, *, fields=None) async

Fetch many papers in one or more POST /paper/batch calls.

Ids use the same forms as :meth:get. The API answers null for unknown ids; those entries are dropped. Requests chunk at 500 ids (the API maximum) and are sent with retries.

bulk_iterate(query=None, filters=None, *, fields=None, limit=None, params=None)

Iterate over every matching paper by following the bulk token.

Fetch one page of up to 1000 papers from /paper/search/bulk.

Bulk search returns basic paper data ordered by corpus id, not by relevance, and has no limit parameter: a page holds up to 1000 records whatever the caller asks for. When more papers match, page.next_cursor carries the continuation token; pass it back as token. params adds query parameters the method does not name, such as sort (citationCount:desc or publicationDate:asc).

citations(id, *, fields=None, limit=None, offset=None, params=None) async

Fetch one page of the papers citing id.

Each record carries the citing paper plus contexts, intents, contextsWithIntent, and isInfluential. page.next_cursor is the next offset, or None on the last page. params adds query parameters the method does not name, such as publicationDateOrYear (2020:2021). The papers of an author see only their most recent 10,000 citation and reference edges.

references(id, *, fields=None, limit=None, offset=None) async

Fetch one page of the papers id cites.

Each record carries the cited paper plus the citation contexts of the source paper, which page.meta["citingPaperInfo"] describes.

search(filters=None, *, query=None, sort=None, select=None, page=None, page_size=None, cursor=None, on_error='raise', failures=None, params=None, fields=None) async

Fetch one page of relevance-ranked papers.

fields selects the returned fields (the API's fields parameter; the same list select accepts).

search_match(query, *, fields=None, filters=None) async

Return the paper whose title matches query best.

filters narrows the candidates with the same criteria :meth:search accepts. Raises :class:NotFoundError when no candidate passes the relevance threshold. matchScore sits on the returned match.

search_path(query)

Return paper/search; the query always travels on the search route.

scholiast._async.authors.AuthorsClient

Bases: ScholiastResourceClient[Author]

Client for the /author routes.

get, search, iterate, collect, first, count, and exists come from the resource base; fields is the select argument everywhere. A search page holds up to 1000 authors.

batch(ids, *, fields=None) async

Fetch many authors in one or more POST /author/batch calls.

The API answers null for unknown ids; those entries are dropped. Requests chunk at 1000 ids (the API maximum) and are sent with retries.

papers(id, *, fields=None, limit=None, offset=None, params=None) async

Fetch one page of the papers written by author id.

The route serves at most the most recent 10,000 papers. page.next_cursor is the next offset, or None on the last page. params adds query parameters the method does not name, such as publicationDateOrYear (2020:2021).

search_path(query)

Return author/search; the query always travels on the search route.

scholiast._async.recommendations.RecommendationsClient

Client for the /recommendations/v1 routes.

Both routes answer {"recommendedPapers": [...]} and work without an API key; for_list is more restricted upstream and may answer 400 on the anonymous pool.

for_list(positive_paper_ids, negative_paper_ids=(), *, fields=None, limit=None) async

Return recommendations for a list of papers (POST /papers/).

positive_paper_ids steers toward these papers; negative_paper_ids steers away. Both take the same id forms as a paper get. The POST is read-only and is sent with retries.

for_paper(id, *, fields=None, limit=None, params=None) async

Return papers related to id (GET /papers/forpaper/{id}).

id takes the same forms as a paper get (DOI:, ARXIV:, a bare S2 id, and so on). params adds query parameters the method does not name, such as from (recent, the default, or all-cs).

scholiast._async.datasets.DatasetsClient

Client for the /datasets/v1 routes.

A release is a dated snapshot of the whole Academic Graph. Listing releases and reading a release's dataset summaries works without a key. Reading a dataset's file URLs and fetching diffs need an API key and answer HTTP 401 without one.

dataset(name, *, release_id='latest') async

Return one dataset of one release, with its file URLs.

files holds temporary pre-signed download links. This route needs an API key.

diffs(dataset_name, start_release, end_release) async

Return the diffs between two releases of one dataset.

Applying updateFiles and deleteFiles in order brings a local copy from start_release to end_release. This route needs an API key.

latest() async

Return the newest release with its dataset summaries.

release(release_id='latest') async

Return one release with its dataset summaries.

release_id is a date string or latest.

releases() async

Return every release id (GET /release).

The ids are date strings such as 2026-11-24, oldest first.

scholiast._async.snippets.SnippetsClient

Client for the /snippet/search route.

Snippet search needs an API key with snippet access; keyless requests answered HTTP 429 on the anonymous pool on 2026-11-27 and 2026-11-28.

search(query, *, fields=None, limit=None, params=None) async

Return the snippets that match query best.

Each match carries the snippet text, its annotations, a score, and a minimal paper record. fields picks parts of the snippet, such as snippet.text or snippet.annotations.sentences. The default limit is 10 and the API maximum is 1000. params adds query parameters the method does not name, such as paperIds, authors, year, or venue.

scholiast._async.patents.PatentsClient

Client for the /patent routes.

All three routes answered without an API key on 2026-11-28. search and outbound_citations are paged like the paper lists.

get(ucid, *, fields=None) async

Return one patent by its UCID (for example US10296086B2).

Without fields the answer holds ucid and title; ask for abstract, claims, inventors, and the other names of the Patent model for the full record. claims is served by this route only.

outbound_citations(paper_id, *, fields=None, limit=None, offset=None) async

Return the patents that cite paper paper_id.

paper_id takes the paper id forms (DOI:, CorpusId:, a bare S2 id, and so on). A paper that no patent cites answers HTTP 404, which raises :class:NotFoundError. claims is not served here.

search(query, *, fields=None, limit=None, offset=None) async

Search patents by plain-text query, ranked by BM25 relevance.

The answer holds ucid and title only unless fields names more. A page holds at most 100 patents, and claims is not served here: ask :meth:get for it.

Models

scholiast.models.Paper

Bases: BaseModel

A Semantic Scholar paper record.

The API returns paperId (plus title and year on some routes) even without fields; every other field appears only when the caller asks for it in fields. embedding and openAccessDoi need an API key; keyless requests that ask for them answer HTTP 400.

scholiast.models.Author

Bases: BaseModel

A Semantic Scholar author record.

Like papers, authors answer authorId (plus name on search routes) even without fields; every other field appears only when the caller asks for it. aliases and normalizedAffiliations are key-gated upstream: keyless requests that ask for them answer HTTP 400.

scholiast.models.ExternalIds

Bases: BaseModel

The paper's identifiers in external catalogs.

CorpusId is the integer Semantic Scholar corpus id; the others use the catalog's own spelling (for example ArXiv and MAG carry strings). Fields the paper lacks are None.

scholiast.models.Citation

Bases: BaseModel

One edge of /paper/{id}/citations: the citing paper plus contexts.

scholiast.models.Reference

Bases: BaseModel

One edge of /paper/{id}/references: the cited paper plus contexts.

scholiast.models.PaperMatch

Bases: BaseModel

The single best title match of /paper/search/match.

The API returns matchScore next to the paper fields.

from_record(record) classmethod

Build one match from the raw API record.

The API nests nothing: the record is the paper itself with matchScore beside it.

scholiast.models.AutocompletePaper

Bases: BaseModel

One candidate of /paper/autocomplete (minimal record).

scholiast.models.SnippetSearchResult

Bases: BaseModel

The envelope of /snippet/search.

scholiast.models.Patent

Bases: BaseModel

A patent record from the Academic Graph patent routes.

Like papers, patents answer ucid (plus title on some routes) even without fields; the other fields appear only when asked for in fields. Party names (inventors, assignees, applicants) are lists of strings. claims is the text of the claims, which only the detail route answers.

scholiast.models.Release

Bases: BaseModel

One dated release of the Academic Graph datasets.

release_id is the date string (for example 2026-11-24); the release listing route answers plain id strings without metadata.

scholiast.models.DatasetMetadata

Bases: BaseModel

One dataset of one release, with its pre-signed file URLs.

files holds temporary download links; this route needs an API key and answers HTTP 401 without one.

scholiast.models.DatasetDiffList

Bases: BaseModel

The diffs that bring one dataset from one release to another.

Unwrapper

scholiast.ScholiastUnwrapper

Extracts results, totals, and metadata from Semantic Scholar JSON.

item(body)

Return the record itself; single-entity routes are unwrapped.

meta(body)

Return the envelope minus the result list.

Keeps offset, next, token, total, retrievalVersion and any other envelope extras the API adds.

next_cursor(body)

Return the continuation for a follow-up request.

Offset-paged envelopes carry next (the next offset value); bulk search carries token. Both are returned as strings. On the last page the key is absent or null.

results(body)

Return the data records (or matches), in order.

A body without either key (a single record, a plain release-id list) yields no results; those routes read the body directly.

total(body)

Return total of a search envelope, or None when absent.

The published schema types total as a string, so a numeric string is read as the number it holds.