Skip to content

Restore a deleted version by its id or version, while it can be (30 days after it was deleted), with the tags that still pointed to it.

POST/workspaces/{workspace}/packages/{package_type}/{package_name}/versions/{version_id}/restore

Takes the Admin role on the package. Returns the version.

Tags that pointed to it come back with it, unless one was moved to another version meanwhile.

  • Authentication: Required. Send an access token as Authorization: Bearer.
  • MCP tool: package with action restore_version, and the same inputs
  • Scope: An access token needs packages:delete.
Name Type Required Description
workspace string Yes The workspace’s slug, e.g. “flagon-io”.
package_type string Yes The registry: container (also docker), npm, cargo, maven, nuget, rubygems or composer. One of container, npm, cargo, maven, nuget, rubygems, composer.
package_name string Yes The package’s name without the workspace: web for g1t.sh/acme/web, web/worker for an image with more parts, group:artifact for Maven.
version_id string Yes The version’s id (ver_…), its version, its digest, or a tag that points to it.
curl -X POST https://api.g1t.sh/workspaces/acme/packages/npm/ui/versions/2.0.0-beta.1/restore \
-H "Authorization: Bearer $G1T_TOKEN"

A successful request answers 200 with:

{
"id": "ver_01kq9c7h9k1m3p5r7t9v1x3z5c",
"name": "2.0.0-beta.1",
"digest": "sha256:7d9f2a4c6e8b0d1f3a5c7e9b2d4f6a8c0e1b3d5f7a9c2e4b6d8f0a1c3e5b7d9f",
"size_in_bytes": 96880,
"download_count": 41,
"tags": [
"beta"
],
"media_type": null,
"artifact_type": null,
"subject": null,
"platforms": [],
"published_by": "bo",
"created_at": "2026-09-30T11:20:00.000Z",
"deprecated": null,
"deleted_at": null,
"deleted_by": null,
"purge_at": null
}

A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.

Status Code When
401 unauthenticated A token is required, or the one sent is not valid.
403 forbidden The token is valid but not allowed to do this, such as a member-only change or an agent token outside its repository.
404 not_found It does not exist, or you cannot see it.
409 conflict The request conflicts with the current state.
422 invalid The input is not valid. message says which field and why.