Skip to content

Query

client.query wraps GET https://export.arxiv.org/api/query, the one read route of the arXiv API. Every result is one paper version as an ArxivEntry.

search() takes the arXiv search syntax as query: field prefixes such as ti: (title), au: (author), abs: (abstract), cat: (category), and all:, combined with AND, OR, and ANDNOT.

page = await client.query.search(
    "au:maldacena AND cat:hep-th",
    sort_by="submittedDate",
    sort_order="descending",
    start=0,
    page_size=50,
)
page.total  # opensearch:totalResults

sort_by takes relevance, lastUpdatedDate, or submittedDate, and sort_order takes ascending or descending. start is the 0-based offset and page_size the max_results value. The documentation caps one request at 2000 results and one query at 30,000, and the client raises ConfigurationError beyond either cap.

ids restricts the page to arXiv ids, with or without a version. One search() call takes at most 100 ids (bibliofabric.arxiv.BATCH_SIZE); batch_get() and iterate() chunk longer lists. Blank values ("", " ", "arXiv:") are dropped, and ids that all normalize to nothing raise ConfigurationError before any request.

Iterate

iterate() pages through a query up to limit or 30,000 results, one request per page. It stops at the first short or empty page, so it never sends a wasted trailing request. limit=0 yields nothing without a request, a negative limit raises ConfigurationError, and page_size is checked against the 2000 cap even when limit is smaller. At the default pace of one request every three seconds, pages of 100 to 2000 results keep a long harvest short.

async for record in client.query.iterate("cat:q-bio.PE", page_size=500, limit=5000):
    record.arxiv_id, record.doi

Ids passed to iterate() go out in chunks of 100, and each chunk is paged from start 0. limit counts across all chunks.

Errors

arXiv answers a malformed query with HTTP 400 and an Atom error feed that names the problem (for example incorrect id format for ...). The client parses that feed instead of stopping at the status and raises ConfigurationError with the response attached, so error.response.status_code is 400. An error feed on HTTP 200, which a malformed id produces, raises ConfigurationError too. A 400 body that is not an error feed, an HTML maintenance page, or any other body that is not XML or not an Atom feed raises APIError with the response attached.

Look up papers by id

get() returns one paper. It accepts new-style ids (1706.03762), old-style ids (hep-th/9711200), versions (1706.03762v1), and the arXiv: and https://arxiv.org/abs/ forms. Without a version the API answers the newest one. An unknown id raises NotFoundError.

batch_get() sends id_list requests of 100 ids and returns a dict keyed by the requested id. An id without a version maps to the newest version of the paper (the highest version the feed lists), and an id with a version maps to that version. Blank ids are dropped, and unknown ids are absent. on_error="skip" drops entries that fail validation and records them, with the raw record, in the failures list you pass in.

found = await client.query.batch_get(["1706.03762v1", "hep-th/9711200", "2501.99999"])
sorted(found)  # ["1706.03762v1", "hep-th/9711200"]

arXiv answers HTTP 500 for an old-style id with a version (hep-th/9711200v1), so the client raises ConfigurationError for such ids before it sends the request.

Building query strings

clause(), date_range(), and combine() assemble search_query values without hand-built syntax:

combine(
    clause("cat", "cs.CL"),
    date_range("submittedDate", date(2026, 1, 1), date(2026, 6, 30)),
)
# 'cat:cs.CL AND submittedDate:[202601010000 TO 202606302359]'

clause(prefix, value) strips the value, wraps a value with whitespace in double quotes, and raises ConfigurationError for an empty value or a double quote. date_range(field, start, end) formats date bounds as midnight and 23:59 GMT and converts datetime bounds to UTC. A missing bound is filled with a concrete date the API accepts (1991-01-01 for the start, 2099-12-31 for the end), because arXiv answers HTTP 500 for an open * bound. combine(*clauses, operator="AND") joins clauses with AND, OR, or ANDNOT.

The entry model

Field Content
id The abstract URL of this version, such as http://arxiv.org/abs/1706.03762v7
title, summary Title (line breaks collapsed) and abstract
published, updated Date of version 1 and of this version
authors ArxivAuthor with name and affiliations
categories, primary_category arXiv category terms
comment, journal_ref, doi Author comment, journal reference, and DOI when given
links ArxivLink with href, rel, type, and title

The properties arxiv_id, versioned_id, version, pdf_url, and author_names derive from these fields.