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
| Mutation | Description |
|---|---|
artifactRegistryActivate | Activate the registry |
artifactRegistryRepositoryCreate | Create a repository |
artifactRegistryRepositoryUpdate | Update a repository |
artifactRegistryRepositoryDelete | Delete a repository 1 |
artifactRegistryRoleGrant | Grant a role |
artifactRegistryRoleRevoke | Revoke a role |
artifactRegistryRoleBulkGrant | Grant roles in bulk |
artifactRegistryRoleBulkRevoke | Revoke roles in bulk |
Footnotes:
artifactRegistryRepositoryDeletesucceeds even if the repository is already deleted.
Queries
The registry queries are fields on the organization type:
| Query | Description |
|---|---|
organization.artifactRegistry | Fetch the registry, including the namespace ID (id) used as resourceId in role mutations |
organization.artifactRegistryRepository | Fetch 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:
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-IDheader. See Things to know. resourceIdstakes resource UUIDs, such as the namespaceidfromorganization.artifactRegistry, not global IDs.- A page holds at most 100 assignments. When
hasNextPageistrue, passendCursorasafterto get the next page. - Without
resourceIdsorassigneeIds, it lists the whole organization. Only an organization administrator can run the query this way. resourceIdslimits the list to those resources, androlesto those roles.assigneeIdslists 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 withresourceIds.- 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
artifactRegistryRoleAssignmentsquery and role mutations act on the organization in theX-GitLab-Organization-IDheader. Without the header, they use your user’s own organization. If that organization has no registry, role mutations returnArtifact 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
artifactRegistryRepositoriesandartifactRegistryRepositoryreturn null whenartifact_registry_uiis disabled. They raise a resource-not-available error when the organization isn’t activated.artifactRegistryreturns 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
| Resource | Operations |
|---|---|
| Container images, tags, and manifests | List and read. Delete one at a time or in a batch. |
| Maven and npm packages, versions, and files | List and read. Delete one at a time or in a batch. |
| npm dist-tags | List, read, and delete. |
| Statistics | Read 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
Linkheader with the next and previous pages. - Lists return no total count. A container image’s manifests list takes the
created_afterandcreated_beforedate filters, and.../manifests/countreturns how many manifests match, up to 1,000. A Maven or npm package’s versions list takes the same date filters and asearchon the version text, and.../versions/countreturns how many versions match, up to 1,000. - Every response carries an
X-Request-IDheader. 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-Versionheader with the Artifact Central version, for example3.200.0. - An error body is a JSON object with an
errorkey. The key holdscode,message, andrequest_id. Some errors also add adetailsobject. - A
401status code is the exception. It returns an empty body with aWWW-Authenticateheader.
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.