Skip to main content

Create or publish a package by slug

PUT 

/packages

Create a package, or publish a new revision of an existing one, in a single idempotent call keyed on nrn and slug.

  • When nrn has no package with that slug, creates the package and returns 201. name is required. To publish the first revision in the same call, send components with an explicit version; bump needs a prior revision, so it can't be used here.
  • Otherwise, applies the call to the existing package and returns 200: it publishes a new revision when you send components, and updates visible_to or default_revision_id when you send them. name is ignored on this path; rename a package with PATCH.

version (explicit semver) and bump (patch, minor or major, relative to the latest revision) are mutually exclusive, and either one must be paired with components. With merge_components (default true) the components overlay the current bill of materials by name; with false the body must list the complete new bill of materials. default: true promotes the published revision in the same call.

PUT or PATCH?

PUT is the pipeline-friendly call. It needs no package id, creates the package on the first run, and every later run publishes against the same nrn and slug, so re-running it is safe. Use PATCH /packages/{id} when you already have the id, or to rename the package.

ℹ️ Note: Publishing a bill of materials identical to the latest revision's doesn't create a new revision. Publishing an existing version with a different bill of materials fails with 409.

Request

Responses

The existing package after the call.