Artifact Central API

  • Tier: Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed
  • Status: Beta

Artifact Central has two API surfaces. Use the GitLab GraphQL API to manage the registry and its repositories, for anything you would otherwise do in the UI. Use the Artifact Central management API to read and delete the artifacts inside a repository. The Artifact Central service serves the management API, not GitLab.

During beta, role assignment is available through the GitLab GraphQL API only. There is no UI for it yet.

Manage the registry with the GraphQL API

During beta, use the GitLab GraphQL API to manage the registry and its repositories. It’s the only supported way to assign roles.

Common tasks

MutationDescription
artifactRegistryActivateActivate the registry
artifactRegistryRepositoryCreateCreate a repository
artifactRegistryRepositoryUpdateUpdate a repository
artifactRegistryRepositoryDeleteDelete a repository 1
artifactRegistryRoleGrantGrant a role
artifactRegistryRoleRevokeRevoke a role
artifactRegistryRoleBulkGrantGrant roles in bulk
artifactRegistryRoleBulkRevokeRevoke roles in bulk

Footnotes:

  1. artifactRegistryRepositoryDelete succeeds even if the repository is already deleted.

Queries

The registry queries are fields on the organization type:

QueryDescription
organization.artifactRegistryFetch the registry, including the namespace ID (id) used as resourceId in role mutations
organization.artifactRegistryRepositoryFetch one repository by name, including the repository ID (id) used as resourceId in role mutations

Pass the organization as a global ID, for example gid://gitlab/Organizations::Organization/123.

List role assignments

The top-level artifactRegistryRoleAssignments query lists direct role assignments:

graphql
query {
  artifactRegistryRoleAssignments(
    resourceIds: ["<namespace-id>"]
    first: 100
  ) {
    nodes {
      resourceId
      role
      assignee { username }
      createdAt
    }
    pageInfo { hasNextPage endCursor }
  }
}
  • To choose the organization, send the X-GitLab-Organization-ID header. See Things to know.
  • resourceIds takes resource UUIDs, such as the namespace id from organization.artifactRegistry, not global IDs.
  • A page holds at most 100 assignments. When hasNextPage is true, pass endCursor as after to get the next page.
  • Without resourceIds or assigneeIds, it lists the whole organization. Only an organization administrator can run the query this way.
  • resourceIds limits the list to those resources, and roles to those roles.
  • assigneeIds lists those users’ assignments on repositories, for at most 20 users. Only organization administrators and registry-level Artifact Admins can use it. You can’t combine it with resourceIds.
  • An organization administrator’s automatic role appears with role: null.

For all fields, arguments, and return types, see the GraphQL API reference.

Things to know

  • Every Artifact Central query and mutation is an experiment. Names and arguments can change.
  • The artifactRegistryRoleAssignments query and role mutations act on the organization in the X-GitLab-Organization-ID header. Without the header, they use your user’s own organization. If that organization has no registry, role mutations return Artifact Central is not available for this organization.
  • The whole GraphQL surface, queries and mutations, sits behind a feature flag named artifact_registry_ui. From GitLab 19.6, it’s enabled by default on GitLab Self-Managed. On GitLab.com, GitLab turns it on for your organization after you sign up to request access to the beta.
  • The queries artifactRegistryRepositories and artifactRegistryRepository return null when artifact_registry_ui is disabled. They raise a resource-not-available error when the organization isn’t activated. artifactRegistry returns null in both cases.

Management API

The Artifact Central service serves this API, not GitLab. It uses its own credentials, separate from the GitLab API. Routes are anchored at the registry handle, under /api/v1/:handle/. No GitLab feature flag applies to it.

Repository create, read, update, and delete operations also live here. During beta, the GraphQL API is the supported route for those operations.

Artifacts

ResourceOperations
Container images, tags, and manifestsList and read. Delete one at a time or in a batch.
Maven and npm packages, versions, and filesList and read. Delete one at a time or in a batch.
npm dist-tagsList, read, and delete.
StatisticsRead figures for the registry, one format, one repository, or one version.

On a hosted repository, an artifact delete is permanent and can’t be undone.

Conventions

  • Lists use keyset pagination. A request returns 20 items by default and at most 100 items. The response carries a Link header with the next and previous pages.
  • Lists return no total count. A container image’s manifests list takes the created_after and created_before date filters, and .../manifests/count returns how many manifests match, up to 1,000. A Maven or npm package’s versions list takes the same date filters and a search on the version text, and .../versions/count returns how many versions match, up to 1,000.
  • Every response carries an X-Request-ID header. The same value appears in the error body. Quote the value when you report a problem.
  • Every response to an authenticated request carries an X-Artifact-Central-Version header with the Artifact Central version, for example 3.200.0.
  • An error body is a JSON object with an error key. The key holds code, message, and request_id. Some errors also add a details object.
  • A 401 status code is the exception. It returns an empty body with a WWW-Authenticate header.

The full endpoint reference, including request and response schemas, is published from the Artifact Registry project’s OpenAPI document. For more information, see the Artifact Registry project.

Lifecycle and retention policies are not available during beta, through either API surface.