
Citation API: verify, generate and ground citations programmatically
What the three calls in a citation pipeline actually have to do, what the responses must contain, and where naive implementations quietly return references that do not exist.
If you are building anything that cites literature (a research assistant, a RAG pipeline, an editorial submission check), you eventually need three operations as HTTP calls rather than as human chores: confirm that a reference exists in a bibliographic registry, find a real source that supports a specific claim, and render the result in a citation style. This article covers what each call has to do, what the response needs to contain before you can trust the output, and where naive implementations fail quietly. The academic sources cited below came out of cytado's own corpus endpoint, which is the same one documented further down.
Verification is a metadata match, not a string lookup
The first mistake is treating verification as "does this title return a hit." A reference is four or five fields that have to agree with each other, and the interesting failures are the ones where each field is plausible on its own.
Chelli and colleagues measured this directly. Checking LLM-generated reference lists against real literature, they counted a paper as hallucinated when any two of title, first author, or year of publication were wrong (p. 1). That definition is worth copying into your test suite, because it names the actual failure mode. Across 471 references generated for systematic reviews, their hallucination rates were 39.6% for GPT-3.5, 28.6% for GPT-4 and 91.4% for Bard, with precision against the real reference lists at 9.4%, 13.4% and 0% respectively (p. 1). In the discussion they note that Bard tended toward a try-and-repeat pattern, emitting several variants of the same nonexistent paper with near-identical titles and journal names (p. 7).
So a verification call cannot answer true or false. It has to answer per field. Here is the difference in practice.
Before — what a model hands you:
Kowalski, A. (2019). Deep learning approaches to citation verification.
Journal of Information Science, 45(3), 301-318.
Nothing here looks wrong. The journal is real, the volume numbering fits the year, the page range is sane, and there is no DOI to check against. A string search for the title returns nothing, which your code will probably log as "not found" and move past.
After — the response shape you need in order to act on it:
{
"status": "unverified",
"matched": { "journal": true },
"unmatched": { "title": null, "authors": null, "doi": null },
"nearest": {
"title": "Automatic recognition of citations ...",
"doi": "10.xxxx/xxxxx",
"similarity": 0.61
}
}
The nearest block is what makes the result usable. A near miss means the model probably blended two real papers, and you can surface a candidate to the author. An empty nearest means the reference has no relative in the registry at all, which is a different editorial decision. Collapsing both into one boolean throws away the information you need to route the case. The field-level contract is documented in the citation verification API.
Which registry answers "exists" matters
"Exists" is only meaningful relative to an index, and that index is a design decision rather than a detail. Massari and colleagues, describing OpenCitations Meta, set out two problems that hit anyone assembling this from raw APIs. First, performance: their earlier services held only citation-level metadata and had to fetch titles, authors and page numbers on the fly through explicit API requests to Crossref, ORCID and DataCite (p. 3). Second, disambiguation: one work often carries several identifiers, so the same citation appears as a DOI-to-DOI edge from Crossref data and a PMID-to-PMID edge from PubMed data, which inflates in- and out-citation counts unless you deduplicate (p. 3).
That second point is the one that bites in production. If you verify against two registries and count a match in either, you will report two sources where there is one. The record you want back carries every known identifier for the resource (DOI, PMID, ISSN, ISBN), plus title, type, publication date, pages, venue, volume and issue, and the authors, editors and publishers with their own persistent identifiers where available (p. 4). Pages especially: if your pipeline emits in-text citations, the page range has to come from the record, not from the model.
For scale, the same paper notes that OpenAlex, which inherited the Microsoft Academic Graph metadata, held over 240 million works and was the most extensive bibliographic metadata set at the time of writing (p. 6). Coverage is good; it is not uniform, and a reference that misses in one index can be real in another.
Grounding: from a claim to a source that supports it
Verification tells you a reference exists. It says nothing about whether the sentence you attached it to is supported by it, and that is the second call.
The mechanism is retrieval before generation. Ślusarek and colleagues, in a systematic review of retrieval-augmented generation, describe the architecture plainly: the model runs a retriever over external knowledge sources first, and the documents it returns become context for the generator, so the output is grounded in retrieved text rather than in parameters (p. 2). The useful consequence for a citation pipeline is that you can keep the retrieved passage and the citation together, rather than generating a citation and hoping it fits.
Concretely, two calls. First, make sure a corpus exists for the topic:
curl -s -X POST https://cytado.com/api/ext/corpus \
-H "Authorization: Bearer $CYTADO_SERVICE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"topic":"citation hallucination in large language models",
"langs":["pl","en"],"minCoverage":5,"async":true}'
{ "jobId": null, "coverage": 32, "coverageVerified": 23, "corpusReady": true }
A jobId of null means the corpus is already there. Otherwise you poll with the job id until harvesting finishes, which can take 20 to 30 minutes on a topic nobody has asked for before. Then pull passages:
curl -s -X POST https://cytado.com/api/ext/chapter-sources \
-H "Authorization: Bearer $CYTADO_SERVICE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"topic":"citation hallucination in large language models",
"langs":["pl","en"],"limit":8}'
Each entry comes back with url, title, authors, year, publisher, docType, a tier, and a text field split by === STRONA X === markers that carry the printed page numbers. There is also a wsparcie field with three values, and it is the one to branch on: wprost means the passage itself states the claim, posrednie means it bears on the claim with context, brak means the passage does not support it even though the source is topically relevant. Hanging an assertion on a brak passage is how a pipeline produces a citation that verifies but does not hold. The passage-plus-metadata contract lives in the evidence API.
Why this belongs in the pipeline and not in review
The cost of skipping the check has moved. Resnik and Hosseini argue that a hallucinated citation can amount to provable research misconduct under US federal regulations when three conditions hold together: a generative tool produced a nonexistent citation, the citations function as data because they directly support the findings (as in a review article or a bibliometric study), and the researcher showed indifference to the risk of fabrication by never checking the output for accuracy (p. 1).
The published record backs the concern. They list a paper in which 19 of 29 citations were hallucinated, a retracted PLOS ONE study with 18 of 76, and a perspective piece with 12 of 14, alongside a study of GPT-4o citations in mental health where 56% contained errors and roughly one in five was hallucinated (p. 3). Their recommendation to publishers is explicit: invest in automated tools that detect hallucinated citations (p. 8).
Read as an engineering requirement, that is a gate. Verify at generation time, store the verdict with the reference, and fail the request rather than returning a citation you cannot vouch for. The expensive version of this check is the one that runs after publication. If you want the manual version of the same check first, how to check if a source exists walks through the DOI and Crossref lookups by hand.
Frequently asked
- Can I just query Crossref directly instead of using a citation API?
- You can, and for a single DOI lookup that is the right call. It gets harder once you need field-level verdicts rather than a hit or miss, deduplication across registries that assign different identifiers to the same work, and printed page numbers attached to the passage you are citing. Those are the parts you end up building on top of a raw registry query.
- What do I do with a reference that comes back unverified?
- Branch on whether there is a near match. A high-similarity nearest record usually means the model merged two real papers, so surface the candidate and let a human confirm. No near match at all means the reference has no relative in the index, and that should block the response rather than ship with a warning.
- Does verification tell me the source supports my sentence?
- No. Verification confirms the reference exists and the metadata agrees. Support is a separate retrieval step that returns the passage and its page number, so you can check the claim against the text. A citation can pass verification and still be attached to a sentence the source never makes.
- How long does provisioning a new topic take?
- If the corpus already exists, the call returns immediately with no job id. For a topic nobody has requested before, harvesting typically runs 20 to 30 minutes, so treat it as an async job and poll rather than blocking a user request on it.