Package Server API FHIRsmith Package Server API: Search and download FHIR NPM packages
Machine-readable description (OpenAPI 3.1.0): openapi.json · openapi.yaml
A registry of FHIR packages, built by crawling the package feeds listed in the FHIR package registry. It implements the parts of the npm registry protocol that FHIR tooling uses (package documents and tarball downloads), plus FHIR-specific search by canonical URL, FHIR version and dependency.
Content negotiation. Most endpoints return JSON. If the request's Accept
header contains text/html, they return a browsable HTML page instead. The JSON
form is the contract; the HTML form is for people and may change at any time.
Query parameters are strict. An unknown parameter, a repeated parameter, a
value that is too long, or one that does not match the documented pattern is
rejected with a 400 Error response rather than being ignored.
See also: FHIR NPM package specification
/packages/catalog — Search packagesReturns the packages matching all of the supplied criteria. With no criteria, returns every package.
Unless name contains a #version, each package appears once, described by
its current version, and count gives its total download count. When name
contains #, every matching version is returned and count is omitted.
Results are ordered by publication date unless sort is given.
| Name | In | Schema | Description |
|---|---|---|---|
name | query | string matching ^[a-zA-Z0-9._#-]*$ max 100 chars | Packages whose id contains this text. Append |
dependson | query | string matching ^[a-zA-Z0-9._#|@-]*$ max 100 chars | Packages with a dependency whose |
pkgcanonical | query | string matching ^[a-zA-Z0-9._:/-]*%?$ max 200 chars | The package's canonical URL. Matched exactly, or as a prefix if the value ends
with |
canonical | query | string matching ^[a-zA-Z0-9._:/-]*$ max 200 chars | Packages containing a resource whose canonical URL starts with this value. |
fhirversion | query | string one of R2, R2B, R3, R4, R4B, R5, R6 max 10 chars | Packages for this FHIR release: R2 (1.0.x), R2B (1.4.x), R3 (3.0.x), R4 (4.0.x), R4B (4.3.x), R5 (5.0.x) or R6 (6.0.x, including ballots). |
dependency | query | string matching ^[a-zA-Z0-9._#|@-]*$ max 100 chars | Packages that depend on this package. Either |
sort | query | string pattern^-?(name|version|date|count|fhirversion|kind|canonical)$ | Sort field; prefix with |
objWrapper | query | string one of true, false max 10 chars |
|
prerelease | query | string one of true, false max 5 chars | Sent by the HL7 Java package client. Accepted for compatibility; it has no effect, since searches already include pre-release versions. |
| Status | Description | Content |
|---|---|---|
| 200 | The matching packages | application/json: array of PackageSummary or WrappedSearchResulttext/html: string |
| 400 | A parameter was unknown, repeated, too long or badly formed | application/json: Error |
| 500 | The server failed to process the request | application/json: Error |
/packages/-/v1/search — Search packages (npm registry search API)The npm registry search API, so npm search --registry works against this
server. It takes npm's text, size and from parameters as well as the FHIR
search parameters of /catalog, and returns npm's result shape.
Differences from the npm registry:
text terms match the package id or description; every term must match.
npm qualifiers (keywords:, author:, scope:, not:, is: ...) are
ignored.quality, popularity and maintenance are
accepted and ignored, and every score is 1. Unless sort is given, a
package whose id is the whole of text comes first (as on npm), then the
rest in publication order.size, every result is returned (npm defaults to 20, but npm's own
clients always send size).keywords and maintainers are always empty, and there is no publisher.| Name | In | Schema | Description |
|---|---|---|---|
text | query | string matching ^[a-zA-Z0-9._:@/#| -]*$ max 200 chars | Space-separated search terms. |
size | query | string matching ^\d{1,3}$ max 3 chars | Maximum number of results to return (at most 250). |
from | query | string matching ^\d{1,6}$ max 6 chars default 0 | Offset of the first result to return. |
quality | query | string matching ^(\d+(\.\d+)?)?$ max 10 chars | npm ranking weight. Ignored. |
popularity | query | string matching ^(\d+(\.\d+)?)?$ max 10 chars | npm ranking weight. Ignored. |
maintenance | query | string matching ^(\d+(\.\d+)?)?$ max 10 chars | npm ranking weight. Ignored. |
name | query | string matching ^[a-zA-Z0-9._#-]*$ max 100 chars | Packages whose id contains this text. Append |
dependson | query | string matching ^[a-zA-Z0-9._#|@-]*$ max 100 chars | Packages with a dependency whose |
pkgcanonical | query | string matching ^[a-zA-Z0-9._:/-]*%?$ max 200 chars | The package's canonical URL. Matched exactly, or as a prefix if the value ends
with |
canonical | query | string matching ^[a-zA-Z0-9._:/-]*$ max 200 chars | Packages containing a resource whose canonical URL starts with this value. |
fhirversion | query | string one of R2, R2B, R3, R4, R4B, R5, R6 max 10 chars | Packages for this FHIR release: R2 (1.0.x), R2B (1.4.x), R3 (3.0.x), R4 (4.0.x), R4B (4.3.x), R5 (5.0.x) or R6 (6.0.x, including ballots). |
dependency | query | string matching ^[a-zA-Z0-9._#|@-]*$ max 100 chars | Packages that depend on this package. Either |
sort | query | string pattern^-?(name|version|date|count|fhirversion|kind|canonical)$ | Sort field; prefix with |
objWrapper | query | string one of true, false max 10 chars |
|
prerelease | query | string one of true, false max 5 chars | Sent by the HL7 Java package client. Accepted for compatibility; it has no effect, since searches already include pre-release versions. |
| Status | Description | Content |
|---|---|---|
| 200 | The matching packages | application/json: NpmSearchResulttext/html: string |
| 400 | A parameter was unknown, repeated, too long or badly formed | application/json: Error |
| 500 | The server failed to process the request | application/json: Error |
/packages/-/fhir/v1/signatures/{spec} — The publisher's signature of a package versionThe signature a package's publisher made of it (its {package}.tgz.sigstore.json,
linked from the publisher's feed by fhir:signature), exactly as this registry fetched
and checked it. It is a Sigstore bundle: an ECDSA P-256 signature of an in-toto
statement naming the package (pkg:npm/{name}@{version}) and the sha512 of the
.tgz. The keys a feed may sign with are listed in the FHIR package registry's
package-feeds.json; a client can check the signature against them itself.
Each version's dist.fhir-signature in the package document links this, with what
the registry made of it (confirmed or rejected). It isn't dist.attestations:
npm would try to verify it as a Sigstore attestation, which it isn't (it has no
transparency log entry, and the publisher's key isn't the registry's).
| Name | In | Schema | Description |
|---|---|---|---|
spec required | path | string |
|
| Status | Description | Content |
|---|---|---|
| 200 | The signature bundle, as fetched | application/json: object |
| 400 | A parameter was unknown, repeated, too long or badly formed | application/json: Error |
| 404 | No signature is held for this package version | application/json: Error |
| 500 | The server failed to process the request | application/json: Error |
/packages/-/npm/v1/keys — The registry's signing keys (npm registry signatures)The public keys this registry signs package versions with, in the npm registry's
format, so npm audit signatures can check packages installed from here. Each
version's dist.signatures holds the signature of {id}@{version}:{dist.integrity}
(ECDSA P-256, SHA-256, base64 DER).
A signature says this registry served that tarball. It is the registry's, not the publisher's: this registry signs every version it holds, wherever it was crawled from.
A 404 means the registry doesn't sign, which npm accepts. It is also the answer while the registry is still signing versions it stored before it signed, since npm reports an unsigned version from a registry with keys as an error.
| Status | Description | Content |
|---|---|---|
| 200 | The keys | application/json: SigningKeys |
| 404 | This registry doesn't sign packages (or hasn't finished signing them) | application/json: Error |
/packages/updates — Package versions published since a dateLists every package version published on or after a date, most recent first.
The date is either relative (daysValue days ago, the default) or absolute
(dateValue).
| Name | In | Schema | Description |
|---|---|---|---|
dateType | query | string one of relative, absolute max 10 chars default relative | Whether the cut-off is relative to today or an absolute date. |
daysValue | query | string matching ^\d{1,3}$ max 3 chars default 10 | With |
dateValue | query | string (date) matching ^\d{4}-\d{2}-\d{2}$ max 10 chars | With |
| Status | Description | Content |
|---|---|---|
| 200 | The package versions published since the cut-off | application/json: array of PackageUpdatetext/html: string |
| 400 | A parameter was unknown, repeated, too long or badly formed | application/json: Error |
| 500 | The server failed to process the request | application/json: Error |
/packages/broken — Package versions with unresolvable dependenciesReports every package version that declares a dependency on a package
version this registry does not hold. Dependencies are matched on package id
and major.minor version, so a dependency on 1.1.0 is satisfied by 1.1.2.
| Name | In | Schema | Description |
|---|---|---|---|
filter | query | string matching ^[a-zA-Z0-9._-]*$ max 100 chars | Only report package versions whose |
| Status | Description | Content |
|---|---|---|
| 200 | The broken dependencies, keyed by the package version that declares them | application/json: BrokenDependenciestext/html: string |
| 400 | A parameter was unknown, repeated, too long or badly formed | application/json: Error |
| 500 | The server failed to process the request | application/json: Error |
/packages/npm-check — Check a registry against the npm registry protocolRuns the npm registry protocol checks against any registry, the way an npm client uses it: search for the package by name, read its package document, read the version's document, and download the version's tarball. Returns a report of each check, pass or fail, with the reason for each failure and the requests it was based on. The same checks run, as a control, against registry.npmjs.org once a day.
With Accept: text/html and no parameters, this is a form for running the checks.
If the registry lists signing keys (/-/npm/v1/keys), it also checks that every
version of the package is signed with one of them, as npm audit signatures does.
A run makes about ten requests, each limited in time and size, and only to public
addresses. Runs are rate limited per client address, and the server runs only a
few at once. A server can turn the check off (npmCheck.enabled in its
configuration), and then this returns 404.
| Name | In | Schema | Description |
|---|---|---|---|
registry required | query | string matching ^https?:\/\/[^\s<>"'`]+$ max 500 chars | The registry's base URL, as given to |
package required | query | string matching ^(@[a-z0-9._-]+\/)?[a-zA-Z0-9._-]+$ max 100 chars | A package the registry holds. |
version required | query | string matching ^[a-zA-Z0-9._-]+$ max 50 chars | A version of that package the registry holds. |
| Status | Description | Content |
|---|---|---|
| 200 | The report | application/json: NpmCheckReporttext/html: string |
| 400 | A parameter was unknown, repeated, too long or badly formed | application/json: Error |
| 404 | The check is turned off on this server | application/json: Error |
| 429 | Too many runs from this client address; try again later | application/json: Error |
| 500 | The server failed to process the request | application/json: Error |
| 503 | The server is already running as many checks as it allows; try again shortly | application/json: Error |
/packages/feed-check — Check a package feed the way the crawler reads itReads a package feed (RSS, as listed in the FHIR package registry's package-feeds.json) the way this registry's crawler does, and reports what it finds, without storing anything: for each item, its package (downloaded, unpacked and checked as the crawler checks it before storing), whether the registry's package-restrictions allow it from this feed, its signature (against the keys the registry lists for the feed), and whether this registry already holds it. Next pages are followed, up to an item limit.
A check runs in the background: this starts one and returns 202 with its id
(303 to its report page, for a browser). Poll /feed-check/{run} for the report.
With Accept: text/html and no url, this is a form.
Every request a check makes goes only to public addresses. Only one check runs at a
time, across all users. A server can turn the check off (feedCheck.enabled), and then
this returns 404.
| Name | In | Schema | Description |
|---|---|---|---|
url required | query | string matching ^https?:\/\/[^\s<>"'`]+$ max 500 chars | The feed's URL. |
signing | query | string matching ^[^<>`]*$ max 5000 chars | The feed's signing keys, as JSON: its |
| Status | Description | Content |
|---|---|---|
| 202 | The check has started | application/json: object |
| 303 | For a browser: the report page | |
| 400 | A parameter was unknown, repeated, too long or badly formed | application/json: Error |
| 404 | The check is turned off on this server | application/json: Error |
| 500 | The server failed to process the request | application/json: Error |
| 503 | A check is already running (one at a time); try again shortly | application/json: Error |
/packages/feed-check/{run} — A feed check's reportThe report of a check started with /feed-check: state is running (the report so
far), done or failed. Reports are kept for a while (an hour, by default) after the
check finishes. A browser gets a page that reloads until the check is done.
| Name | In | Schema | Description |
|---|---|---|---|
run required | path | string | The check's id, as |
| Status | Description | Content |
|---|---|---|
| 200 | The check and its report | application/json: objecttext/html: string |
| 404 | No such check (or its report has been discarded) | application/json: Error |
| 500 | The server failed to process the request | application/json: Error |
/packages/{id} — Package document (npm registry format)The npm registry document for a package: every version this registry holds,
with its metadata, dependencies and tarball URL. dist-tags.latest is the most
recently published version.
| Name | In | Schema | Description |
|---|---|---|---|
id required | path | string | The package id, e.g. |
| Status | Description | Content |
|---|---|---|
| 200 | The package document | application/json: PackageDocumenttext/html: string |
| 404 | No package with this id is known | application/json: Error |
| 500 | The server failed to process the request | application/json: Error |
/packages/{id}/{version} — Download a package tarball, or get a version's documentReturns the package tarball (.tgz) - or, when the request's Accept header
prefers JSON, the version's npm document: the same object as that version's entry
in the package document. Preferring JSON means ranking application/json (or npm's
application/vnd.npm.install-v1+json) above any */*, application/* or tarball
type by q-value: application/json alone does, but application/json, text/plain, */*
(axios's default, which SUSHI sends) does not. The response varies on Accept and
FHIR-Package-Download.
A request with a FHIR-Package-Download header always gets the tarball. The
HL7 Java tools send it; a client that downloads tarballs from this URL while
asking for JSON should send it too.
latest in place of a version (npm's dist-tag) means the version in the package
document's dist-tags.latest.
If no version matches exactly, the most recently published pre-release of that
version ({version}-*) is returned instead, so 1.0.0 will find 1.0.0-ballot
when there is no 1.0.0.
If the server is configured to serve packages from bucket storage, this redirects to the tarball there.
| Name | In | Schema | Description |
|---|---|---|---|
id required | path | string matching ^(@[a-z0-9._-]+\/)?[a-zA-Z0-9._-]+$ max 100 chars | The package id. A scoped id ( |
version required | path | string matching ^[a-zA-Z0-9._-]+$ max 50 chars | The package version. |
FHIR-Package-Download | header | string | Present (with any value, conventionally |
| Status | Description | Content |
|---|---|---|
| 200 | The package tarball, or the version document | application/tar+gzip: stringapplication/json: PackageVersion |
| 302 | Redirect to the tarball in bucket storage | |
| 400 | A parameter was unknown, repeated, too long or badly formed | application/json: Error |
| 404 | No such package version is known | text/plain: stringapplication/json: Error |
| 500 | The server failed to process the request | application/json: Error |
FhirVersionThe FHIR version(s) the package is for, e.g. 4.0.1. Packages for more than
one version list them separated by , .
string
PackageKindstring one of fhir.core, fhir.ig, fhir.template
PackageSummaryA package version, as returned by search.
| Property | Schema | Description |
|---|---|---|
name required | string | Package id |
version required | string | |
fhirVersion required | FhirVersion | |
canonical | string (uri) | The package's canonical URL |
kind required | PackageKind | |
url required | string (uri) | Where to download the tarball |
date | string (date-time) | Publication date |
count | integer | Total downloads of the package (all versions). Omitted for versioned searches. |
description | string |
WrappedSearchResult| Property | Schema | Description |
|---|---|---|
objects required | array of object |
NpmSearchResultThe npm registry search result shape.
| Property | Schema | Description |
|---|---|---|
objects required | array of object | |
total required | integer | Number of matches before size/from are applied |
time required | string | When the search ran |
PackageUpdateA package version published since the requested date.
| Property | Schema | Description |
|---|---|---|
name required | string | |
version required | string | |
date required | string (date-time) | |
fhirVersion required | FhirVersion | |
canonical | string (uri) | |
kind required | PackageKind | |
url required | string (uri) | |
description | string |
PackageDocumentAn npm registry package document.
| Property | Schema | Description |
|---|---|---|
_id required | string | |
name required | string | |
description | string | |
dist-tags required | object | |
versions required | map of PackageVersion | Every version this registry holds, keyed by version. |
time | object | Publication time of each version, keyed by version, plus |
PackageVersion| Property | Schema | Description |
|---|---|---|
name required | string | |
_id | string |
|
version required | string | |
date required | string (date-time) | |
fhirVersion required | FhirVersion | |
kind required | PackageKind | |
count required | integer | Downloads of this version |
canonical | string (uri) | |
url required | string (uri) | |
homepage | string | |
license | string | |
author | object | |
description | string | |
dependencies | map of string | Package id to version. |
dist required | object |
SigningKeys| Property | Schema | Description |
|---|---|---|
keys required | array of object |
BrokenDependenciesKeys are id#version of the package versions with broken dependencies; each
value lists the unresolvable dependencies as id@version. date is when the
report was generated.
| Property | Schema | Description |
|---|---|---|
date required | string (date-time) |
Other properties: array of string
NpmCheckReportThe result of running the npm registry protocol checks against a registry.
| Property | Schema | Description |
|---|---|---|
registry required | string (uri) | |
package required | string | |
version required | string | |
started required | string (date-time) | |
finished required | string (date-time) | |
passed required | integer | Checks that passed |
failed required | integer | Checks that failed |
steps required | array of object | |
requests required | map of object | Every request the checks made, by name. |
Error| Property | Schema | Description |
|---|---|---|
error required | string | |
message | string | |
parameter | string | The offending parameter |