Server Home  |  Packages Home  |  Updates  |  Broken  |  Crawler Log  |  Feed Check  |  API

FHIRsmith Logo 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

Endpoints

GET /packages/catalog — Search packages

Returns 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.

Parameters
NameInSchemaDescription
namequerystring matching ^[a-zA-Z0-9._#-]*$ max 100 chars

Packages whose id contains this text. Append #version to search specific versions (every version containing that text is then returned, not just the current one). Matched with SQL LIKE, so _ matches any single character.

dependsonquerystring matching ^[a-zA-Z0-9._#|@-]*$ max 100 chars

Packages with a dependency whose id@version contains this text. # or | may be used in place of @.

pkgcanonicalquerystring matching ^[a-zA-Z0-9._:/-]*%?$ max 200 chars

The package's canonical URL. Matched exactly, or as a prefix if the value ends with %.

canonicalquerystring matching ^[a-zA-Z0-9._:/-]*$ max 200 chars

Packages containing a resource whose canonical URL starts with this value.

fhirversionquerystring 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).

dependencyquerystring matching ^[a-zA-Z0-9._#|@-]*$ max 100 chars

Packages that depend on this package. Either id (any version), or id#version, id|version or id@version; a version is matched as a prefix.

sortquerystring
pattern^-?(name|version|date|count|fhirversion|kind|canonical)$
max 20 chars

Sort field; prefix with - for descending order. Versions sort semver-style, with a pre-release (1.0.0-ballot) before its release. Without sort, results are in publication order.

objWrapperquerystring one of true, false max 10 chars

true wraps the results as {"objects": [{"package": ...}]}, the core of the npm search result shape. Retained for older clients; new clients wanting the npm shape should use /-/v1/search.

prereleasequerystring 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.

Responses
StatusDescriptionContent
200

The matching packages

application/json: array of PackageSummary or WrappedSearchResult
text/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
Try it

GET /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.
  • There is no relevance ranking: 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.
  • Without 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.
Parameters
NameInSchemaDescription
textquerystring matching ^[a-zA-Z0-9._:@/#| -]*$ max 200 chars

Space-separated search terms.

sizequerystring matching ^\d{1,3}$ max 3 chars

Maximum number of results to return (at most 250).

fromquerystring matching ^\d{1,6}$ max 6 chars default 0

Offset of the first result to return.

qualityquerystring matching ^(\d+(\.\d+)?)?$ max 10 chars

npm ranking weight. Ignored.

popularityquerystring matching ^(\d+(\.\d+)?)?$ max 10 chars

npm ranking weight. Ignored.

maintenancequerystring matching ^(\d+(\.\d+)?)?$ max 10 chars

npm ranking weight. Ignored.

namequerystring matching ^[a-zA-Z0-9._#-]*$ max 100 chars

Packages whose id contains this text. Append #version to search specific versions (every version containing that text is then returned, not just the current one). Matched with SQL LIKE, so _ matches any single character.

dependsonquerystring matching ^[a-zA-Z0-9._#|@-]*$ max 100 chars

Packages with a dependency whose id@version contains this text. # or | may be used in place of @.

pkgcanonicalquerystring matching ^[a-zA-Z0-9._:/-]*%?$ max 200 chars

The package's canonical URL. Matched exactly, or as a prefix if the value ends with %.

canonicalquerystring matching ^[a-zA-Z0-9._:/-]*$ max 200 chars

Packages containing a resource whose canonical URL starts with this value.

fhirversionquerystring 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).

dependencyquerystring matching ^[a-zA-Z0-9._#|@-]*$ max 100 chars

Packages that depend on this package. Either id (any version), or id#version, id|version or id@version; a version is matched as a prefix.

sortquerystring
pattern^-?(name|version|date|count|fhirversion|kind|canonical)$
max 20 chars

Sort field; prefix with - for descending order. Versions sort semver-style, with a pre-release (1.0.0-ballot) before its release. Without sort, results are in publication order.

objWrapperquerystring one of true, false max 10 chars

true wraps the results as {"objects": [{"package": ...}]}, the core of the npm search result shape. Retained for older clients; new clients wanting the npm shape should use /-/v1/search.

prereleasequerystring 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.

Responses
StatusDescriptionContent
200

The matching packages

application/json: NpmSearchResult
text/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
Try it

GET /packages/-/fhir/v1/signatures/{spec} — The publisher's signature of a package version

The 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).

Parameters
NameInSchemaDescription
spec requiredpathstring

{name}@{version}, as npm writes it (a scope's / escaped).

Responses
StatusDescriptionContent
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
Try it

GET /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.

Responses
StatusDescriptionContent
200

The keys

application/json: SigningKeys
404

This registry doesn't sign packages (or hasn't finished signing them)

application/json: Error
Try it

GET /packages/updates — Package versions published since a date

Lists 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).

Parameters
NameInSchemaDescription
dateTypequerystring one of relative, absolute max 10 chars default relative

Whether the cut-off is relative to today or an absolute date.

daysValuequerystring matching ^\d{1,3}$ max 3 chars default 10

With dateType=relative, how many days back to go.

dateValuequerystring (date) matching ^\d{4}-\d{2}-\d{2}$ max 10 chars

With dateType=absolute, the cut-off date. Defaults to today.

Responses
StatusDescriptionContent
200

The package versions published since the cut-off

application/json: array of PackageUpdate
text/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
Try it

GET /packages/broken — Package versions with unresolvable dependencies

Reports 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.

Parameters
NameInSchemaDescription
filterquerystring matching ^[a-zA-Z0-9._-]*$ max 100 chars

Only report package versions whose id#version contains this text.

Responses
StatusDescriptionContent
200

The broken dependencies, keyed by the package version that declares them

application/json: BrokenDependencies
text/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
Try it

GET /packages/npm-check — Check a registry against the npm registry protocol

Runs 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.

Parameters
NameInSchemaDescription
registry requiredquerystring matching ^https?:\/\/[^\s<>"'`]+$ max 500 chars

The registry's base URL, as given to npm --registry.

package requiredquerystring matching ^(@[a-z0-9._-]+\/)?[a-zA-Z0-9._-]+$ max 100 chars

A package the registry holds.

version requiredquerystring matching ^[a-zA-Z0-9._-]+$ max 50 chars

A version of that package the registry holds.

Responses
StatusDescriptionContent
200

The report

application/json: NpmCheckReport
text/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
Try it

GET /packages/feed-check — Check a package feed the way the crawler reads it

Reads 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.

Parameters
NameInSchemaDescription
url requiredquerystring matching ^https?:\/\/[^\s<>"'`]+$ max 500 chars

The feed's URL.

signingquerystring matching ^[^<>`]*$ max 5000 chars

The feed's signing keys, as JSON: its signing block as it would be in package-feeds.json ({"required": false, "keys": [{"keyid": ..., "key": ..., "expires": null}]}), or the feed's whole entry. Signatures are checked against these instead of the keys the registry lists for the feed.

Responses
StatusDescriptionContent
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
Try it

GET /packages/feed-check/{run} — A feed check's report

The 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.

Parameters
NameInSchemaDescription
run requiredpathstring

The check's id, as /feed-check returned it.

Responses
StatusDescriptionContent
200

The check and its report

application/json: object
text/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
Try it

GET /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.

Parameters
NameInSchemaDescription
id requiredpathstring

The package id, e.g. hl7.fhir.r4.core.

Responses
StatusDescriptionContent
200

The package document

application/json: PackageDocument
text/html: string
404

No package with this id is known

application/json: Error
500

The server failed to process the request

application/json: Error
Try it

GET /packages/{id}/{version} — Download a package tarball, or get a version's document

Returns 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.

Parameters
NameInSchemaDescription
id requiredpathstring matching ^(@[a-z0-9._-]+\/)?[a-zA-Z0-9._-]+$ max 100 chars

The package id. A scoped id (@scope/name) must have its / encoded as %2F.

version requiredpathstring matching ^[a-zA-Z0-9._-]+$ max 50 chars

The package version.

FHIR-Package-Downloadheaderstring

Present (with any value, conventionally tarball), the tarball is returned whatever Accept says.

Responses
StatusDescriptionContent
200

The package tarball, or the version document

application/tar+gzip: string
application/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: string
application/json: Error
500

The server failed to process the request

application/json: Error
Try it

Schemas

FhirVersion

The FHIR version(s) the package is for, e.g. 4.0.1. Packages for more than one version list them separated by , .

string

PackageKind

string one of fhir.core, fhir.ig, fhir.template

PackageSummary

A package version, as returned by search.

PropertySchemaDescription
name requiredstring

Package id

version requiredstring
fhirVersion requiredFhirVersion
canonicalstring (uri)

The package's canonical URL

kind requiredPackageKind
url requiredstring (uri)

Where to download the tarball

datestring (date-time)

Publication date

countinteger

Total downloads of the package (all versions). Omitted for versioned searches.

descriptionstring

WrappedSearchResult

PropertySchemaDescription
objects requiredarray of object

NpmSearchResult

The npm registry search result shape.

PropertySchemaDescription
objects requiredarray of object
total requiredinteger

Number of matches before size/from are applied

time requiredstring

When the search ran

PackageUpdate

A package version published since the requested date.

PropertySchemaDescription
name requiredstring
version requiredstring
date requiredstring (date-time)
fhirVersion requiredFhirVersion
canonicalstring (uri)
kind requiredPackageKind
url requiredstring (uri)
descriptionstring

PackageDocument

An npm registry package document.

PropertySchemaDescription
_id requiredstring
name requiredstring
descriptionstring
dist-tags requiredobject
versions requiredmap of PackageVersion

Every version this registry holds, keyed by version.

timeobject

Publication time of each version, keyed by version, plus created (the earliest) and modified (the latest), as in npm's package document.

PackageVersion

PropertySchemaDescription
name requiredstring
_idstring

{id}@{version}

version requiredstring
date requiredstring (date-time)
fhirVersion requiredFhirVersion
kind requiredPackageKind
count requiredinteger

Downloads of this version

canonicalstring (uri)
url requiredstring (uri)
homepagestring
licensestring
authorobject
descriptionstring
dependenciesmap of string

Package id to version.

dist requiredobject

SigningKeys

PropertySchemaDescription
keys requiredarray of object

BrokenDependencies

Keys 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.

PropertySchemaDescription
date requiredstring (date-time)

Other properties: array of string

NpmCheckReport

The result of running the npm registry protocol checks against a registry.

PropertySchemaDescription
registry requiredstring (uri)
package requiredstring
version requiredstring
started requiredstring (date-time)
finished requiredstring (date-time)
passed requiredinteger

Checks that passed

failed requiredinteger

Checks that failed

steps requiredarray of object
requests requiredmap of object

Every request the checks made, by name.

Error

PropertySchemaDescription
error requiredstring
messagestring
parameterstring

The offending parameter