DOI Validation in Node.js — Digital Object Identifier Lookup
Every scholarly article, dataset, and software release can carry a DOI — a persistent identifier that resolves to the resource's landing page regardless of where it moves. Here's how DOIs are structured, why validation matters, and how to validate and resolve any DOI in your Node.js application.
In this guide
1. What is a DOI?
DOI stands for Digital Object Identifier. It is a persistent, unique identifier assigned to scholarly articles, research datasets, software packages, and other digital objects. DOIs are managed by the International DOI Foundation (IDF) and resolved through the Handle System.
Unlike URLs, which can break when a publisher restructures their website, a DOI is permanent. The identifier 10.1038/nature12373 will always resolve to the correct resource, even if the underlying URL changes. This makes DOIs the backbone of modern citation systems.
DOIs are used by publishers (Elsevier, Springer Nature, Wiley), preprint servers (arXiv, bioRxiv), data repositories (Zenodo, Figshare, Dryad), and software archives (e.g. DOIs minted by Zenodo for GitHub releases).
2. DOI structure
A DOI consists of two parts separated by a forward slash: a prefix and a suffix. The prefix identifies the registrant (publisher or organisation), while the suffix identifies the specific resource.
DOI anatomy
Prefix breakdown
| Prefix | Registrant | Example DOI |
|---|---|---|
| 10.1038 | Springer Nature | 10.1038/nature12373 |
| 10.1016 | Elsevier | 10.1016/j.cell.2023.01.001 |
| 10.1126 | AAAS (Science) | 10.1126/science.abn7950 |
| 10.5281 | Zenodo | 10.5281/zenodo.1234567 |
10. followed by a registrant code of four or more digits. The suffix can contain any printable character including dots, hyphens, underscores, and parentheses. There is no fixed length limit.3. Why DOI validation matters
DOIs are critical infrastructure for academic publishing and data management. Invalid or malformed DOIs cause real problems in production systems:
Citation systems
Reference managers (Zotero, Mendeley, EndNote) rely on DOIs to fetch metadata automatically. A malformed DOI means broken citations, missing author lists, and incorrect bibliographies. In automated publishing pipelines, a single bad DOI can cascade into hundreds of broken cross-references.
Academic databases
Institutional repositories, CRIS systems, and indexing services (CrossRef, DataCite, PubMed) use DOIs as primary keys for deduplication and linking. Importing records with invalid DOIs pollutes the database and breaks inter-system integrations.
Link rot prevention
DOIs exist precisely to prevent link rot — but only if the DOI itself is valid. Storing a truncated or garbled DOI defeats the purpose of using persistent identifiers. Validating DOIs at the point of entry ensures that every reference in your system can be resolved years later.
Data provenance
Research data management plans increasingly require DOIs for datasets and software. Funding agencies (NIH, NSF, ERC) mandate proper DOI citation. Validating DOIs ensures compliance and traceability.
4. Basic validation vs metadata lookup
The IsValid DOI API offers two modes of validation. Basic validation checks the DOI format, extracts the prefix, suffix, and registrant information, and returns the resolved URL. Metadata lookup goes further and retrieves the full bibliographic record from the DOI registry.
Basic (default)
- Format validation
- Prefix and suffix extraction
- Registrant code and name
- Resolved URL
With lookup=true
- Everything from basic, plus:
- Title, authors, publisher
- Resource type (journal-article, dataset, etc.)
- Publication date
5. The right solution
The IsValid DOI API handles format validation, prefix parsing, registrant identification, URL resolution, and optional metadata retrieval in a single call.
Full parameter reference and response schema: DOI Validation API docs →
6. Node.js code example
import { createClient } from '@isvalid-dev/sdk'; const iv = createClient({ apiKey: process.env.ISVALID_API_KEY }); // ── Basic validation ──────────────────────────────────────────────────────── const result = await iv.doi('10.1038/nature12373'); console.log(result.valid); // true console.log(result.prefix); // '10.1038' console.log(result.registrant); // 'Springer Nature' // ── With metadata lookup ──────────────────────────────────────────────────── const lookup = await iv.doi('10.1038/nature12373', { lookup: true }); console.log(lookup.metadata.title); // 'Genomic....' console.log(lookup.metadata.publisher); // 'Springer Science...'
In a reference import pipeline:
// Validate DOIs before inserting into a citation database async function importReferences(rows) { const results = []; for (const row of rows) { if (!row.doi) { results.push({ ...row, doiStatus: 'missing' }); continue; } const check = await iv.doi(row.doi, { lookup: true }); if (!check.valid) { results.push({ ...row, doiStatus: 'invalid' }); continue; } results.push({ ...row, doi: check.doi, title: check.metadata?.title, authors: check.metadata?.authors, publisher: check.metadata?.publisher, doiStatus: 'valid', }); } return results; }
10.1038/nature12373) rather than the full URL. You can construct the URL at display time by prepending https://doi.org/.7. cURL example
Basic DOI validation:
curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.isvalid.dev/v0/doi?value=10.1038/nature12373"
With metadata lookup:
curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.isvalid.dev/v0/doi?value=10.1038/nature12373&lookup=true"
DOI with special characters (URL-encoded):
curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.isvalid.dev/v0/doi?value=10.1002/(SICI)1097-0258(19980815)17:15%3C1661::AID-SIM968%3E3.0.CO;2-2"
Invalid DOI:
curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.isvalid.dev/v0/doi?value=11.1234/invalid"
8. Understanding the response
Basic validation (valid DOI):
{ "valid": true, "doi": "10.1038/nature12373", "prefix": "10.1038", "suffix": "nature12373", "registrantCode": "1038", "registrant": "Springer Nature", "url": "https://doi.org/10.1038/nature12373" }
With metadata lookup:
{ "valid": true, "doi": "10.1038/nature12373", "prefix": "10.1038", "suffix": "nature12373", "registrantCode": "1038", "registrant": "Springer Nature", "url": "https://doi.org/10.1038/nature12373", "metadata": { "title": "Genomic...", "authors": ["Author A", "Author B"], "publisher": "Springer Science and Business Media LLC", "type": "journal-article", "issued": "2013-09-01" } }
Invalid DOI:
{ "valid": false }
| Field | Type | Description |
|---|---|---|
| valid | boolean | Whether the DOI has a valid format |
| doi | string | The canonical DOI string |
| prefix | string | DOI prefix (e.g. 10.1038) |
| suffix | string | DOI suffix — the resource identifier after the slash |
| registrantCode | string | The numeric registrant code from the prefix |
| registrant | string | Human-readable name of the registrant organisation |
| url | string | Resolved URL (https://doi.org/...) |
| metadata | object | Only present when lookup=true. Contains title, authors, publisher, type, and issued date |
9. Edge cases
(a) URL-encoded DOIs
Some DOIs contain characters that must be URL-encoded when passed as query parameters — parentheses, angle brackets, semicolons, and other special characters. The API accepts both raw and URL-encoded forms. When storing DOIs, always store the decoded form.
// DOI with special characters const result = await iv.doi('10.1002/(SICI)1097-0258(19980815)17:15<1661::AID-SIM968>3.0.CO;2-2'); console.log(result.valid); // true
(b) Old-style handles
Some older systems store DOIs with the Handle System prefix doi: or the full resolver URL https://doi.org/. Strip these prefixes before passing the DOI to the API — only the 10.xxxx/suffix portion is the actual identifier.
// Strip common prefixes before validation function normaliseDoi(raw) { return raw .replace(/^https?:\/\/(dx\.)?doi\.org\//i, '') .replace(/^doi:/i, '') .trim(); } const doi = normaliseDoi('https://doi.org/10.1038/nature12373'); const result = await iv.doi(doi); console.log(result.valid); // true
(c) shortDOI
The shortDOI service (shortdoi.org) provides abbreviated aliases like 10/drvj. These are not standard DOIs and will not pass format validation. If your system accepts shortDOIs, resolve them to the full DOI first using the shortDOI API before validating.
(d) Case sensitivity
DOIs are case-insensitive according to the DOI specification. However, the conventional practice is to use lowercase. The API normalises DOIs to their canonical form in the response. When comparing DOIs in your database, always perform case-insensitive comparisons or normalise to lowercase at insertion time.
10. Summary
See also
Validate DOIs instantly
Free tier includes 100 API calls per day. No credit card required. Supports basic validation and full metadata lookup.