Skip to content

Data API: `data.nemar.org`

Public HTTPS access to every published NEMAR dataset, BIDS-shaped. No nemar-cli, no git-annex, no NEMAR account.

The same handlers are reachable at three URL forms (pick whichever is most convenient for your client):

https://data.nemar.org/<datasetId>/<version>/<path> # canonical
https://api.nemar.org/data/<datasetId>/<version>/<path> # API-hostname alias
https://<workers-dev-host>/data/<datasetId>/<version>/<path> # dev/testing

This document describes the canonical form.

/<datasetId>/<version>/<path>
  • <datasetId> – one of nm, xx, on followed by six digits (e.g. nm000103).
  • <version> – latest or an explicit vX.Y.Z tag. latest resolves to the most recently DOI’d version recorded in the catalog.
  • <path> – BIDS-relative file or directory path. Trailing slashes accepted. Path traversal segments (.., absolute paths) return 404.

If <bids-path> matches a file in the requested version’s manifest, the data plane resolves that path to the file bytes. The route checks that the dataset is published, the version resolves, and the exact path appears in that version’s manifest before resolving storage. A plain annex object may redirect to its backing object; chunked content is resolved behind the same data-plane route. Clients should treat the data.nemar.org URL as canonical and should not persist a storage URL from a redirect.

Annex-backed files support one byte range per request. A satisfiable Range request returns 206; an unsatisfiable range returns 416. Malformed or multiple ranges, and an If-Range value that does not match, fall back to a full response. Preserve the Range header if your client follows a redirect. Git-tracked files are served as full bodies and do not advertise Accept-Ranges, so clients must not assume every manifest entry can be resumed. This behavior is the same for plain and chunked annex content.

If <bids-path> is a directory (i.e. one or more manifest entries start with <bids-path>/), responds 200 OK with an Apache-style HTML directory listing.

If neither, responds 404.

File responses and redirects may be cached for at most 300 seconds. This is also the upper bound for reusing a cached visibility decision: an edge cache must not serve a response or redirect beyond that window. HTML indexes use max-age=60.

File responses and redirects carry Last-Modified (the version’s publication timestamp in RFC 1123 format) and ETag (the content checksum, quoted per RFC 7232 – "sha256:<hex>" for git-annex files, "git:<sha>" for inline git content). Content-Length is intentionally omitted from a 302 (per RFC 9110 §8.6 it describes the empty message body, not the redirect target) – use HEAD if you need the size without following the redirect.

Returns 200 with Content-Length, Last-Modified, ETag, and Cache-Control: public, max-age=300 headers and an empty body. Used by rclone sync and other HTTP-backend mirroring tools to detect file changes without transferring the file body.

For directory paths, returns 200 with Content-Type: text/html and an empty body.

For paths that don’t exist in the requested version, returns 404 with an empty body. The tombstone walk (used on GET to surface a last_seen_* hint) is intentionally skipped on HEAD – a sync against a divergent local copy fans out many HEAD requests, and the per-HEAD walk would amplify them into many S3 round-trips.

Responds 200 with a JSON array describing every file in the requested version:

[
{
"path": "dataset_description.json",
"size": 480,
"checksum_algorithm": "git",
"checksum": "abc123...",
"bytes_url": "https://data.nemar.org/nm000103/v1.0.0/dataset_description.json",
"url": "https://data.nemar.org/nm000103/v1.0.0/dataset_description.json"
},
{
"path": "sub-01/eeg/sub-01_task-rest_eeg.edf",
"size": 12345678,
"checksum_algorithm": "sha256",
"checksum": "deadbeef...",
"bytes_url": "https://data.nemar.org/nm000103/v1.0.0/sub-01/eeg/sub-01_task-rest_eeg.edf",
"url": "https://data.nemar.org/nm000103/v1.0.0/sub-01/eeg/sub-01_task-rest_eeg.edf"
}
]

checksum_algorithm is sha256 (default for annex-backed files), md5 when the dataset uses an MD5E backend, or git for files stored directly in the git tree (where the checksum is the blob SHA, not a content hash).

For every entry, url is the stable, public data-plane URL and equals bytes_url. Both resolve through GET /<datasetId>/<version>/<bids-path> above. They do not expose an S3 key, a GitHub raw URL, or an expiring credential. Clients may use either field for downloads; bytes_url remains available to existing clients.

The manifest response and file route may be cached for no more than 300 seconds. That limit also bounds how long an edge cache may reuse a prior visibility decision. The link itself does not expire, but the route continues to enforce publication visibility and can return 404 if the dataset, version, or path is no longer available.

Dataset-level neuroschema v0.4.1 dataset document combining the enrichment catalog (authors, MeSH keywords, license, DOI, etc.), the full version list, and a derived BIDS subject / session / modality / task / run tree from the latest version’s manifest. Designed for external indexers like eegdash-viewer that need to resolve dataset -> subjects/tasks/runs -> files in one fetch.

Wire format mirrors the core schema at neuroschema/schema/core/dataset.schema.json. NEMAR-specific aggregates (version list, derived BIDS index, pipeline stage) live under extensions.nemar per neuroschema/schema/extensions/nemar.schema.json.

{
"schema_version": "0.4.1",
"doc_type": "dataset",
"dataset_id": "nm000103",
"name": "...",
"description": "...",
"source": "nemar",
"recording_modality": ["EEG"],
"license": "CC0-1.0",
"authors": [
{
"name": "Doe, Jane",
"name_type": "Personal",
"orcid": "https://orcid.org/0000-0001-2345-6789",
"affiliations": [{ "name": "Acme University", "identifier": "https://ror.org/...", "scheme": "ROR" }]
}
],
"keywords": [
{ "term": "Electroencephalography", "subject_scheme": "MeSH", "classification_code": "D004569" }
],
"related_identifiers": [...],
"data_papers": [
{ "doi": "10.1038/s41597-019-0027-4", "title": "...", "year": 2019, "venue": "Scientific Data", "judge_model": "claude-sonnet-5-5" }
],
"contributors": [...],
"dates": [...],
"rights": [...],
"funding": [...],
"tasks": ["rest", "go-nogo"],
"datatypes": ["eeg"],
"sessions": ["baseline"],
"sessions_count": 1,
"demographics": { "subjects_count": 50, "age_min": 18, "age_max": 65 },
"data_summary": { "total_files": 1234, "size_bytes": 1234567890, "size_human": "1.15 GB" },
"provenance": { "latest_snapshot": "v1.0.0", "publish_date": "2025-12-01T10:00:00Z" },
"external_links": {
"dataset_doi": "10.82901/NEMAR.nm000103",
"github_url": "https://github.com/nemarDatasets/nm000103"
},
"extensions": {
"nemar": {
"versions": [
{
"version": "v1.0.0",
"doi": "10.82901/NEMAR.nm000103.v1.0.0",
"created_at": "2025-12-01T10:00:00Z",
"manifest_url": "/nm000103/v1.0.0/manifest.json"
}
],
"bids_index": {
"version": "v1.0.0",
"subjects": {
"sub-01": {
"sessions": ["baseline"],
"modalities": {
"eeg": { "tasks": { "rest": { "runs": ["01", "02"] } } }
}
}
}
},
"pipeline_stage": "validated"
}
}
}

related_identifiers lists every paper and record a dataset points at, each with a DataCite relation type. Those relation types are hints, not verdicts: a data paper is sometimes tagged References, and a methods paper is sometimes tagged IsDescribedBy. data_papers answers the narrower question of which of those papers is this dataset’s own data paper.

  • What is listed. A paper appears only when the NEMAR citation pipeline’s judge classified it as the dataset’s data paper. That is the same verdict that decides whose citations count toward the dataset. The dataset’s own DOI is not listed (it is external_links.dataset_doi). Standards, software and pipeline papers such as BIDS, MNE and EEGLAB are never listed.
  • Deposits. An entry can be a deposit of the same data, such as a figshare or Zenodo record, rather than a journal article. There is no type field, so use venue or the DOI prefix to tell them apart.
  • Absent versus empty. A missing data_papers key means no statement: the dataset has not been judged yet. An empty array means the dataset was judged and has no data paper. Do not treat the two alike.
  • Fields. doi is always present, without a https://doi.org/ prefix, in lowercase; compare DOIs case-insensitively. title, year, venue and judge_model are null when unknown. A dataset lists at most 10 papers.
  • Freshness. The list is refreshed once a day from the citation pipeline’s nightly run, so it can trail a change to related_identifiers by a day or more.

Partial payloads, never 500s. When the metadata pipeline hasn’t run yet, enrichment-derived fields (authors, keywords, license, related_identifiers, etc.) are returned as empty arrays or null, and data_papers is omitted. When no versions are minted yet, extensions.nemar.versions is [] and bids_index is null. When the latest version’s manifest cannot be fetched, bids_index is null but the catalog and version list still return normally. Corrupt enrichment_json is logged and treated as missing.

bids_index reflects only the latest version. A per-version index endpoint at /<datasetId>/<version>/index.json may follow in a later phase.

Cache-Control: public, max-age=60.

GET /<datasetId>/page-bundle.json?v=<version>

Section titled “GET /<datasetId>/page-bundle.json?v=<version>”

Returns landing + metadata + summary + catalog row in one JSON payload so SSR consumers can render the dataset detail page from a single HTTP fetch instead of fanning out 4 parallel requests + 2 deferred client fetches.

Query parameter v is optional; absent or unknown values fall back to landing.latest rather than returning 404 (the consumer can render a “version not found, showing latest” UI from the bundle’s own version field).

{
"dataset_id": "on005505",
"version": "1.0.0",
"served_at": "2026-05-26T18:30:00.000Z",
"complete": true,
"landing": { "ok": true, "data": { "latest": "v1.0.0", "versions": [...] } },
"metadata": { "ok": true, "data": { /* same shape as /metadata.json */ } },
"enrichment_degraded": false,
"summary": { "ok": true, "data": { /* same shape as /<v>/summary.json */ } },
"catalog_row": {
"ok": true,
"data": {
"dataset_id": "on005505",
"name": "...",
"description": "...",
"license": "CC-BY-SA 4.0",
"modalities": "eeg",
"tasks": "rest,RestingState",
"authors": "...",
"concept_doi": "10.82901/nemar.on005505",
"github_repo": "nemarDatasets/on005505"
}
}
}

Component wrapping. Each upstream is returned as a tagged union:

  • { ok: true, data: ... } — fetched successfully (or, for summary on an unpublished dataset, { ok: true, data: null } by design).
  • { ok: false, error: "<message>" } — that upstream failed; the bundle still ships so the consumer can render whichever components succeeded.

complete flag and cache policy. When all four components are ok AND (no version is published OR the summary fetch returned non-null), complete: true and the response carries Cache-Control: public, max-age=60, s-maxage=300, stale-while-revalidate=86400. Otherwise complete: false and the response is Cache-Control: no-store so a transient upstream blip is not pinned at the CF edge for 24 h. The truth table is pinned by isBundleComplete in backend/src/services/page-bundle.ts and verified by test/page-bundle.unit.test.ts.

enrichment_degraded flag. True when enrichment_json existed but couldn’t be parsed (LLM pipeline corruption); metadata is still present using the row’s deterministic columns, but enriched fields like description, authors, related_identifiers may be incomplete. Consumers can surface a “metadata may be incomplete” indicator.

Not included in the bundle: the BIDS tree (HTML). Consumers render that progressively from summary.paths to keep the bundle small. The full bids_index is still served by /<datasetId>/metadata.json for consumers that need the structured form.

Dataset landing page. Content-negotiated: HTML for browsers, JSON for machine clients (default when no Accept is sent). The query parameter ?format=json or ?format=html overrides the Accept header.

JSON shape:

{
"dataset_id": "nm000103",
"latest": "v1.0.0",
"metadata_url": "/nm000103/metadata.json",
"versions": [
{
"version": "v1.0.0",
"doi": "10.82901/NEMAR.nm000103.v1.0.0",
"created_at": "2025-12-01T10:00:00Z",
"mirror": false,
"manifest_url": "/nm000103/v1.0.0/manifest.json",
"browse_url": "/nm000103/v1.0.0/"
}
]
}

Versions are newest-first. latest is null when the dataset row exists but no version has been minted yet (the page still returns 200, with a “no published versions yet” notice in the HTML form).

HTML rendering lists every version with its DOI, publication date, browse URL, and manifest URL.

Cache-Control: public, max-age=60.

Each entry of versions carries mirror, which says whether that version is a mirror of one OpenNeuro snapshot. The numbering rule behind it is described in Versions of an OpenNeuro mirror. The flag has three values, and null is not false:

Value Meaning
true The version is N.0.0 of an OpenNeuro dataset (an on identifier), and NEMAR has recorded which upstream snapshot it mirrors.
false Any other case: a dataset that is not an OpenNeuro mirror, or a version that is not N.0.0, such as a NEMAR correction 1.0.1.
null The version is N.0.0 of an OpenNeuro dataset, but NEMAR could not establish which snapshot it mirrors, or has not examined the version yet.

Render null without a mirror marker, and never as a mirror: it says that NEMAR cannot tell, not that the version is not one. NEMAR never guesses an upstream tag from a date or from a version number.

  • Derived, not stored. The flag is computed when the response is built, from the version’s recorded upstream tag.
  • Where it appears. On every entry of versions in the JSON form of GET /<datasetId>, and in landing.data.versions of GET /<datasetId>/page-bundle.json. metadata.json does not carry it: the entries of extensions.nemar.versions keep the four keys shown above.
  • What it leaves out. The upstream tag, and how NEMAR knows it, are not on the public data plane. A dataset’s owner, its collaborators and administrators can read them from GET /datasets/:id/versions on api.nemar.org (Backend API), whose entries carry source_version, source_version_basis and mirror. source_version is the OpenNeuro tag, or null. source_version_basis says how NEMAR knows the tag: doi (the version’s own SourceDatasets entry in dataset_description.json declares it), lineage (NEMAR compared the tree with upstream’s), unknown (the version was examined and no tag was found) or null (the version was never examined).
  • Older servers. A response from a server that predates the flag has no mirror key. Read an absent key as “not stated”, not as false.

The decision behind the flag is recorded in Architecture Decision Record (ADR) 0111.

308 Permanent Redirect to /<datasetId>/<version>/ so the relative ../ link in the rendered index resolves correctly.

HTML directory listings include a version picker above the file table when the dataset has more than one published version. Each version is rendered as a sibling link that switches the version segment of the current URL while preserving the sub-path – so switching versions on a deeply-nested directory lands on the same directory in the chosen version (or a tombstone 404, see below, if the path doesn’t exist there).

When a file path 404s but the same path existed in an older published version, the response indicates the last version that contained it.

JSON shape:

{
"error": "File not found",
"reason": "removed",
"last_seen_version": "v1.0.0",
"last_seen_url": "https://data.nemar.org/nm000103/v1.0.0/sub-99/eeg/sub-99_task-rest_eeg.edf"
}

A 404 without a tombstone (no reason field) means the path never existed in any of the most recent versions.

The tombstone walk is capped at the 10 most recent older versions. Older datasets can still be browsed manually from /<datasetId>/ – the cap exists so a 404 on a long-removed path never fans out to dozens of manifest fetches. If a determined client needs deeper history, fetch /<datasetId>/metadata.json for the full version list and walk it explicitly.

The HTML form of the same 404 (sent when Accept: text/html) renders a friendly page with a clickable link to the last-seen URL.

Directory index pages compare their listing against the immediately prior published version. Names that existed in the prior version but are absent in the current one are rendered in a collapsible <details> footer with links to the prior version’s URL. The comparison is only against vN-1; older versions are not consulted (use metadata.json for full history).

Code When
200 Manifest JSON, HTML index, dataset landing page (HTML or JSON), HEAD on existing file or directory, or a file response served by the data plane
206 A file response to a supported byte-range request
416 An unsatisfiable byte range on an annex-backed file; includes Content-Range: bytes */<size> and Cache-Control: no-store
302 GET on a file path that redirects to a single backing object
308 /<datasetId>/<version> -> /<datasetId>/<version>/
404 Dataset not found, private, unpublished, version not minted, file not in manifest, path traversal attempt. Includes reason: "removed" + last_seen_* when the path existed in a recent prior version (GET only; HEAD returns bare 404)
502 Before response headers, a manifest-listed backing object is missing or its size/chunk layout does not match the manifest
503 Before response headers, storage could not be checked or served, including bounded chunk-listing or request-budget failures

These storage statuses describe failures detected before response headers are sent. If a storage read or byte-count check fails after streaming starts, the response may already be 200 or 206 and its body can end early; clients should verify the received length or checksum before treating a download as complete.

The route deliberately does not distinguish “not found” from “exists but private”. Private datasets are reached only via the existing nemar dataset clone / nemar dataset get flow.

Annex-backed file bytes are stored in S3 under git-annex content-addressed keys (for example, SHA256E-s12345--...edf). A plain object may be returned through a redirect; chunked content is resolved by the data plane. Clients should rely on the stable data-plane URL rather than the storage key or the shape of the current response.

  • Private and unpublished datasets. They stay on git-annex.
  • rclone-compatible delta sync. Phase 4 (#498), optional.