DEVELOPER DOCUMENTATION / OPENAPI 3.0
Build on your registry.
Automate registries, scopes, packages, publisher keys, and customer download access with a straightforward JSON API.
GET STARTED
Your first request
Generate a management API key in Settings → API keys, grant it npm:package:read, and send it as a bearer token. The key acts within the organization that created it.
curl https://privatenpm.com/api/v1/registries \ -H "Authorization: Bearer $API_KEY"The JSON response includes your private registries and the shared registry. Save the returned IDs for operations that target a registry.
01 / ACCESS
Authentication
Every management endpoint requires an organization API key in the Authorization: Bearer header. Give each integration only the permissions shown on the operations it calls. A 401 means the key is missing or invalid; a 403 means it lacks permission.
Management API keys call this API. Publisher keys authenticate npm publish and package maintenance. Download keys grant registry read access to customers. Treat all three as secrets; issued publisher and download key values appear only once.
02 / CONVENTIONS
Requests and responses
JSON over HTTPS
Use https://privatenpm.com/api/v1 as the base URL. Send Content-Type: application/json when there is a request body. Omit optional properties you are not setting.
Pagination
List endpoints that return nextPageToken can be paged by sending that value as pageToken. Continue until no token is returned.
Safe retries
Operations marked “Idempotency-Key supported” accept a unique Idempotency-Key header. Reuse the same key when retrying the same request.
Errors
Failures return JSON with a stable code and readable message. Handle 429 with backoff; 409 indicates a conflict or stale update.
{ "code": "permission_denied", "message": "This API key cannot perform this action." }03 / WORKFLOWS
What you can build
Publish from CI
- Create package metadata and record the package ID.
- Issue a publisher key limited to the registry or package, with publish permission.
- Store the one-time secret in your CI secret store and publish the tarball with npm.
Deliver customer access
- Issue a download key for the purchased package IDs.
- Show the one-time secret to the customer over a secure channel.
- Rotate or revoke the key when access changes.
API REFERENCE
Registries
Registries
List registries
/api/v1/registriesIncludes the shared registry and your private registries.
npm:package:read Response 200 RegistryList
View response fields
registriesRegistry[] Registries
Create a private registry
/api/v1/registriesSave the DNS verification challenge returned here.
npm:registry:manage JSON request body CreateRegistry
displayNamestring requiredhostnamestring requiredResponse 201 Registry
View response fields
createdAtdate-time displayNamestring formatstring hostnamestring idstring kindshared | private tenantIdstring verificationChallengestring verificationExpiresAtdate-time Registries
Delete an empty private registry
/api/v1/registries/{id}A registry with packages, scopes, domains or credentials cannot be deleted.
npm:registry:manage Parameters
idpathstringResponse 204
No response body.
API REFERENCE
Scopes
Scopes
List registry scopes
/api/v1/registries/{registryId}/scopesnpm:package:read Parameters
registryIdpathstringResponse 200 ScopeList
View response fields
scopesScope[] Scopes
Create a scope in a private registry
/api/v1/registries/{registryId}/scopesnpm:scope:manage Parameters
registryIdpathstringJSON request body ScopeName
namestring requiredWith or without the leading @.
Response 201 Scope
View response fields
createdAtdate-time idstring namestring registryIdstring Scopes
Delete an unused scope
/api/v1/scopes/{id}npm:scope:manage Parameters
idpathstringResponse 204
No response body.
API REFERENCE
Packages
Packages
List packages
/api/v1/packagesFollow nextPageToken until empty.
npm:package:read Parameters
registryIdquerystringqueryquerystringpageSizequeryint32pageTokenquerystringResponse 200 PackageList
View response fields
nextPageTokenstring packagesPackage[] Packages
Create package metadata
/api/v1/packagesPublish a tarball with npm using a publisher key. Supports Idempotency-Key.
npm:package:create Idempotency-Key supportedJSON request body CreatePackage
descriptionstring namestring requiredregistryIdstring requiredvisibilityprivate | public Response 201 Package
View response fields
createdAtdate-time descriptionstring etagstring idstring namestring readmestring registryIdstring updatedAtdate-time visibilityprivate | public Packages
Delete an empty package
/api/v1/packages/{id}npm:package:delete Parameters
idpathstringResponse 204
No response body.
Packages
Get package
/api/v1/packages/{id}npm:package:read Parameters
idpathstringResponse 200 Package
View response fields
createdAtdate-time descriptionstring etagstring idstring namestring readmestring registryIdstring updatedAtdate-time visibilityprivate | public Packages
Update package metadata
/api/v1/packages/{id}Send the latest etag to reject stale edits.
npm:package:update Parameters
idpathstringJSON request body UpdatePackage
descriptionstring etagstring readmestring visibilityprivate | public Response 200 Package
View response fields
createdAtdate-time descriptionstring etagstring idstring namestring readmestring registryIdstring updatedAtdate-time visibilityprivate | public Packages
Remove a dist tag
/api/v1/packages/{packageId}/dist-tags/{tag}npm:package:update Parameters
packageIdpathstringtagpathstringResponse 204
No response body.
Packages
Set a dist tag
/api/v1/packages/{packageId}/dist-tags/{tag}npm:package:update Parameters
packageIdpathstringtagpathstringJSON request body TagVersion
versionstring requiredResponse 200 DistTag
View response fields
tagstring versionstring Packages
List versions and dist tags
/api/v1/packages/{packageId}/versionsnpm:package:read Parameters
packageIdpathstringResponse 200 VersionList
View response fields
distTagsDistTag[] versionsPackageVersion[] Packages
Unpublish a version
/api/v1/versions/{id}npm:package:delete Parameters
idpathstringResponse 204
No response body.
Packages
Deprecate or undeprecate a version
/api/v1/versions/{id}/deprecationSet message to an empty string to clear deprecation.
npm:package:update Parameters
idpathstringJSON request body Deprecation
messagestring requiredResponse 204
No response body.
API REFERENCE
Publisher keys
Publisher keys
List publisher keys
/api/v1/publisher-keysregistry:credential:manage Parameters
pageSizequeryint32pageTokenquerystringResponse 200 PublisherKeyList
View response fields
keysPublisherKey[] nextPageTokenstring Publisher keys
Issue a publisher key
/api/v1/publisher-keysThe secret is shown once. Not idempotent; a retry issues a new key.
registry:credential:manage JSON request body IssuePublisherKey
allPackagesboolean expiresAtdate-time namestring requiredpackageIdsstring[] permissionsmetadata:read | tarball:read | identity:read | package:publish | dist-tag:write | package:unpublish[] requiredregistryIdsstring[] requiredscopeIdsstring[] userIdstring Omit for the caller.
Response 201 IssuedPublisherKey
View response fields
keyPublisherKey secretstring Shown once.
Publisher keys
Revoke a publisher key
/api/v1/publisher-keys/{id}registry:credential:manage Parameters
idpathstringResponse 204
No response body.
Publisher keys
Get publisher key metadata
/api/v1/publisher-keys/{id}The secret is never returned here.
registry:credential:manage Parameters
idpathstringResponse 200 PublisherKey
View response fields
allPackagesboolean createdAtdate-time displayPrefixstring expiresAtdate-time idstring lastUsedAtdate-time namestring packageIdsstring[] permissionsstring[] registryIdsstring[] revokedboolean scopeIdsstring[] subjectKindstring Always publisher.
userIdstring Publisher keys
Rotate a publisher key
/api/v1/publisher-keys/{id}/rotateSave the new secret; the old one stops working. Not idempotent; a retry rotates again.
registry:credential:manage Parameters
idpathstringResponse 200 IssuedPublisherKey
View response fields
keyPublisherKey secretstring Shown once.
API REFERENCE
Download keys
Download keys
List download keys
/api/v1/download-keysregistry:download_key:manage Parameters
pageSizequeryint32pageTokenquerystringResponse 200 DownloadKeyList
View response fields
keysDownloadKey[] nextPageTokenstring Download keys
Issue a customer download key
/api/v1/download-keysThe secret is shown once. Not idempotent; a retry issues a new key.
registry:download_key:manage JSON request body IssueDownloadKey
allPackagesboolean expiresAtdate-time externalRefstring namestring requiredpackageIdsstring[] recipientstring requiredregistryIdstring requiredscopeIdstring Response 201 IssuedDownloadKey
View response fields
keyDownloadKey secretstring Shown once.
Download keys
Revoke a download key
/api/v1/download-keys/{id}registry:download_key:manage Parameters
idpathstringResponse 200 DownloadKey
View response fields
allPackagesboolean createdAtdate-time credentialVersionstring displayPrefixstring expiresAtdate-time externalRefstring idstring lastUsedAtdate-time namestring packageIdsstring[] recipientstring registryIdstring revokedAtdate-time scopeIdstring Download keys
Get download key metadata
/api/v1/download-keys/{id}registry:download_key:manage Parameters
idpathstringResponse 200 DownloadKey
View response fields
allPackagesboolean createdAtdate-time credentialVersionstring displayPrefixstring expiresAtdate-time externalRefstring idstring lastUsedAtdate-time namestring packageIdsstring[] recipientstring registryIdstring revokedAtdate-time scopeIdstring Download keys
Change download access
/api/v1/download-keys/{id}Supply exactly one of allPackages, scopeId or packageIds.
registry:download_key:manage Parameters
idpathstringJSON request body DownloadAccess
allPackagesboolean packageIdsstring[] scopeIdstring Response 200 DownloadKey
View response fields
allPackagesboolean createdAtdate-time credentialVersionstring displayPrefixstring expiresAtdate-time externalRefstring idstring lastUsedAtdate-time namestring packageIdsstring[] recipientstring registryIdstring revokedAtdate-time scopeIdstring Download keys
Rotate a download key
/api/v1/download-keys/{id}/rotateSave the new secret. Not idempotent; a retry rotates again.
registry:download_key:manage Parameters
idpathstringResponse 200 IssuedDownloadKey
View response fields
keyDownloadKey secretstring Shown once.
Ready to build?
Create a management key with the permissions your integration needs, or import the OpenAPI file into your client tooling.
Create an API key ↗Download OpenAPI YAML ↗