Use this API to manage the packages stored in a project or a group.

Download the maven package file for a group

GET /api/v4/groups/{id}/-/packages/maven/{path}/{file_name}

This feature was introduced in GitLab 11.7

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the group
file_name
Path, required
StringPackage file name
Example: mypkg-1.0-SNAPSHOT.jar
path
Path, required
StringPackage path
Example: foo/bar/mypkg/1.0-SNAPSHOT

Responses

CodeDescriptionSchema
200OK—
302Found—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

List all packages for a group

GET /api/v4/groups/{id}/packages

Lists all packages for a specified group. When accessed without authentication, only packages of public projects are returned. By default, packages with default, deprecated, and error status are returned. Use the status parameter to view other packages. Packages of non-public projects are returned only for projects where you have at least the Reporter role. Packages with processing status can contain malformed data or be broken. In the response, creator_id is the ID of the user who created the package, and is null when a deploy token created the package. For a Conan package, name contains the recipe, and conan_package_name contains the package name. Other package types do not have this field. In _links, web_path is the path to the package details page in GitLab, returned only if the package has status default or deprecated, and delete_api_path is the API path to delete the package, returned only if you have permission to delete it.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the group
exclude_subgroups
Query
BooleanIf true, excludes packages from subgroup projects
Default: false
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items to list per page
Default: 20
Example: 20
order_by
Query
StringSort results by the specified field
Allowed values: created_at, name, version, type, project_path
Default: created_at
sort
Query
StringSort results in ascending or descending order
Allowed values: asc, desc
Default: asc
package_type
Query
StringFilter packages by type
Allowed values: maven, npm, conan, nuget, pypi, composer, generic, golang, debian, rubygems, helm, terraform_module, rpm, ml_model, cargo, swift
package_name
Query
StringFilter packages by name, using a fuzzy search
package_version
Query
StringFilter packages by version. When used together with include_versionless, versionless packages are not returned
include_versionless
Query
BooleanIf true, includes versionless packages in the response
status
Query
StringFilter packages by status
Allowed values: default, hidden, processing, error, pending_destruction, deprecated

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesPackage
400Bad Request—
401Unauthorized—
404Group Not Found—

Download the maven package file for the instance

GET /api/v4/packages/maven/{path}/{file_name}

This feature was introduced in GitLab 11.6

Parameters

NameTypeDescription
file_name
Path, required
StringPackage file name
Example: mypkg-1.0-SNAPSHOT.jar
path
Path, required
StringPackage path
Example: foo/bar/mypkg/1.0-SNAPSHOT

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

List all packages for a project

GET /api/v4/projects/{id}/packages

Lists all packages for a specified project. All package types are included in results. Unauthenticated requests return only packages of public projects. By default, packages with default, deprecated, and error status are returned. Use the status parameter to view other packages. Packages with processing status can contain malformed data or be broken.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items to list per page
Default: 20
Example: 20
order_by
Query
StringSort results by the specified field
Allowed values: created_at, name, version, type
Default: created_at
sort
Query
StringSort results in ascending or descending order
Allowed values: asc, desc
Default: asc
package_type
Query
StringFilter packages by type
Allowed values: maven, npm, conan, nuget, pypi, composer, generic, golang, debian, rubygems, helm, terraform_module, rpm, ml_model, cargo, swift
package_name
Query
StringFilter packages by name, using a fuzzy search
package_version
Query
StringFilter packages by version. When used together with include_versionless, versionless packages are not returned
include_versionless
Query
BooleanIf true, includes versionless packages in the response
status
Query
StringFilter packages by status
Allowed values: default, hidden, processing, error, pending_destruction, deprecated

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesPackage
400Bad Request—
403Forbidden—
404Project Not Found—

Download package file

GET /api/v4/projects/{id}/packages/generic/{package_name}/{package_version}/{file_name}

This feature was introduced in GitLab 13.5

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
package_name
Path, required
StringPackage name
Pattern: ^[A-Za-z0-9._\-+]+$
file_name
Path, required
StringPackage file name
Pattern: ^(?!~)(?!@)[A-Za-z0-9._\-+~@]+(?<!~)(?<!@)$
package_version
Path, required
StringPackage version
Pattern: ^(?!(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\n\uD800-\uDFFF])*\.\.)[\w+.\-]+$
download_mode
Query
StringRequested download transfer mode (proxy or direct). Only honored when allowed by the object storage configuration
Allowed values: proxy, direct

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Upload package file

PUT /api/v4/projects/{id}/packages/generic/{package_name}/{package_version}/{file_name}

This feature was introduced in GitLab 13.5

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
package_name
Path, required
StringPackage name
Pattern: ^[A-Za-z0-9._\-+]+$
file_name
Path, required
StringPackage file name
Pattern: ^(?!~)(?!@)[A-Za-z0-9._\-+~@]+(?<!~)(?<!@)$
package_version
Path, required
StringPackage version
Pattern: ^(?!(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\n\uD800-\uDFFF])*\.\.)[\w+.\-]+$

Request body (multipart/form-data)

PropertyTypeDescription
file
Required
String (binary)The package file to publish (generated by Multipart middleware)
selectStringResponse format selector. If set to “package_file”, returns the created package file object in the response
Allowed values: package_file
statusStringPackage status
Allowed values: default, hidden

Responses

CodeDescriptionSchema
200OK—
201Created—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Workhorse authorize generic package file

PUT /api/v4/projects/{id}/packages/generic/{package_name}/{package_version}/{file_name}/authorize

This feature was introduced in GitLab 13.5

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
package_name
Path, required
StringPackage name
Pattern: ^[A-Za-z0-9._\-+]+$
file_name
Path, required
StringPackage file name
Pattern: ^(?!~)(?!@)[A-Za-z0-9._\-+~@]+(?<!~)(?<!@)$
package_version
Path, required
StringPackage version
Pattern: ^(?!(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\n\uD800-\uDFFF])*\.\.)[\w+.\-]+$

Request body (application/json)

PropertyTypeDescription
statusStringPackage status
Allowed values: default, hidden

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Download package file

GET /api/v4/projects/{id}/packages/generic/{package_name}/{package_version}/{path}/{file_name}

This feature was introduced in GitLab 13.5

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
package_name
Path, required
StringPackage name
Pattern: ^[A-Za-z0-9._\-+]+$
file_name
Path, required
StringPackage file name
Pattern: ^(?!~)(?!@)[A-Za-z0-9._\-+~@]+(?<!~)(?<!@)$
package_version
Path, required
StringPackage version
Pattern: ^(?!(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\n\uD800-\uDFFF])*\.\.)[\w+.\-]+$
path
Path, required
StringFile directory path
download_mode
Query
StringRequested download transfer mode (proxy or direct). Only honored when allowed by the object storage configuration
Allowed values: proxy, direct

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Upload package file

PUT /api/v4/projects/{id}/packages/generic/{package_name}/{package_version}/{path}/{file_name}

This feature was introduced in GitLab 13.5

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
package_name
Path, required
StringPackage name
Pattern: ^[A-Za-z0-9._\-+]+$
file_name
Path, required
StringPackage file name
Pattern: ^(?!~)(?!@)[A-Za-z0-9._\-+~@]+(?<!~)(?<!@)$
package_version
Path, required
StringPackage version
Pattern: ^(?!(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\n\uD800-\uDFFF])*\.\.)[\w+.\-]+$
path
Path, required
StringFile directory path

Request body (multipart/form-data)

PropertyTypeDescription
file
Required
String (binary)The package file to publish (generated by Multipart middleware)
selectStringResponse format selector. If set to “package_file”, returns the created package file object in the response
Allowed values: package_file
statusStringPackage status
Allowed values: default, hidden

Responses

CodeDescriptionSchema
200OK—
201Created—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Workhorse authorize generic package file

PUT /api/v4/projects/{id}/packages/generic/{package_name}/{package_version}/{path}/{file_name}/authorize

This feature was introduced in GitLab 13.5

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
package_name
Path, required
StringPackage name
Pattern: ^[A-Za-z0-9._\-+]+$
file_name
Path, required
StringPackage file name
Pattern: ^(?!~)(?!@)[A-Za-z0-9._\-+~@]+(?<!~)(?<!@)$
package_version
Path, required
StringPackage version
Pattern: ^(?!(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\n\uD800-\uDFFF])*\.\.)[\w+.\-]+$
path
Path, required
——

Request body (application/json)

PropertyTypeDescription
statusStringPackage status
Allowed values: default, hidden

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

List

GET /api/v4/projects/{id}/packages/go/{module_name}/@v/list

Get all tagged versions for a given Go module. Returns the versions as plain text, one per line. See go help goproxy, GET $GOPROXY/<module>/@v/list. This endpoint is used by the go command and is not meant for manual consumption. It does not follow the standard API authentication methods. Undocumented authentication methods might be removed in the future. This feature was introduced in GitLab 13.1.

Parameters

NameTypeDescription
id
Path, required
String or integerThe project ID or full path of a project
module_name
Path, required
StringThe name of the Go module

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
404Not Found—

Version metadata

GET /api/v4/projects/{id}/packages/go/{module_name}/@v/{module_version}.info

Get the metadata of a given Go module version. See go help goproxy, GET $GOPROXY/<module>/@v/<version>.info. This endpoint is used by the go command and is not meant for manual consumption. It does not follow the standard API authentication methods. Undocumented authentication methods might be removed in the future. This feature was introduced in GitLab 13.1.

Parameters

NameTypeDescription
id
Path, required
String or integerThe project ID or full path of a project
module_name
Path, required
StringThe name of the Go module
module_version
Path, required
StringThe version of the Go module

Responses

CodeDescriptionSchema
200OKAPIEntitiesGoModuleVersion
400Bad Request—
404Not Found—

Download module file

GET /api/v4/projects/{id}/packages/go/{module_name}/@v/{module_version}.mod

Get the module file of a given module version. See go help goproxy, GET $GOPROXY/<module>/@v/<version>.mod. This endpoint is used by the go command and is not meant for manual consumption. It does not follow the standard API authentication methods. Undocumented authentication methods might be removed in the future. This feature was introduced in GitLab 13.1.

Parameters

NameTypeDescription
id
Path, required
String or integerThe project ID or full path of a project
module_name
Path, required
StringThe name of the Go module
module_version
Path, required
StringThe version of the Go module

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
404Not Found—

Download module source

GET /api/v4/projects/{id}/packages/go/{module_name}/@v/{module_version}.zip

Get a zip of the source of the given module version. See go help goproxy, GET $GOPROXY/<module>/@v/<version>.zip. This endpoint is used by the go command and is not meant for manual consumption. It does not follow the standard API authentication methods. Undocumented authentication methods might be removed in the future. This feature was introduced in GitLab 13.1.

Parameters

NameTypeDescription
id
Path, required
String or integerThe project ID or full path of a project
module_name
Path, required
StringThe name of the Go module
module_version
Path, required
StringThe version of the Go module

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
404Not Found—

Download the maven package file for a project

GET /api/v4/projects/{id}/packages/maven/{path}/{file_name}

This feature was introduced in GitLab 11.3

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
file_name
Path, required
StringPackage file name
Example: mypkg-1.0-SNAPSHOT.jar
path
Path, required
StringPackage path
Example: foo/bar/mypkg/1.0-SNAPSHOT

Responses

CodeDescriptionSchema
200OK—
302Found—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Upload the maven package file

PUT /api/v4/projects/{id}/packages/maven/{path}/{file_name}

This feature was introduced in GitLab 11.3

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
path
Path, required
StringPackage path
Example: foo/bar/mypkg/1.0-SNAPSHOT
file_name
Path, required
StringPackage file name
Pattern: ^[A-Za-z0-9._\-+]+$
Example: mypkg-1.0-SNAPSHOT.pom

Request body (multipart/form-data)

PropertyTypeDescription
file
Required
String (binary)The package file to be published (generated by Multipart middleware)

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—
422Unprocessable Entity—

Workhorse authorize the maven package file upload

PUT /api/v4/projects/{id}/packages/maven/{path}/{file_name}/authorize

This feature was introduced in GitLab 11.3

Parameters

NameTypeDescription
id
Path, required
String or integerThe ID or URL-encoded path of the project
path
Path, required
StringPackage path
Example: foo/bar/mypkg/1.0-SNAPSHOT
file_name
Path, required
StringPackage file name
Pattern: ^[A-Za-z0-9._\-+]+$
Example: mypkg-1.0-SNAPSHOT.pom

Responses

CodeDescriptionSchema
200OK—
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Retrieve a project package

GET /api/v4/projects/{id}/packages/{package_id}

Retrieves a specified project package. Only packages with status default or deprecated are returned. In the response, creator_id is the ID of the user who created the package, and is null when a deploy token created the package. For a Conan package, name contains the recipe, and conan_package_name contains the package name. Other package types do not have this field. In _links, web_path is the path to the package details page in GitLab, and delete_api_path is the API path to delete the package, returned only if you have permission to delete it.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
package_id
Path, required
IntegerID of the package

Responses

CodeDescriptionSchema
200OKAPIEntitiesPackage
400Bad Request—
403Forbidden—
404Not Found—

Delete a project package

DELETE /api/v4/projects/{id}/packages/{package_id}

Deletes a specified project package. If request forwarding is enabled, deleting a package can introduce a dependency confusion risk. Deleting a package protected by a protection rule is forbidden. The protection check is behind a feature flag named packages_protected_packages_delete, disabled by default.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
package_id
Path, required
IntegerID of the package

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
403Forbidden—
404Not Found—

List all package files

GET /api/v4/projects/{id}/packages/{package_id}/package_files

Lists all package files for a specified package.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
package_id
Path, required
IntegerID of the package
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items to list per page
Default: 20
Example: 20
order_by
Query
StringSort results by the specified field
Allowed values: id, created_at, file_name
Default: id
sort
Query
StringSort results in ascending or descending order
Allowed values: asc, desc
Default: asc

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesPackageFile
400Bad Request—
404Not Found—

Delete a package file

DELETE /api/v4/projects/{id}/packages/{package_id}/package_files/{package_file_id}

Deletes a specified package file. Deleting a package file can corrupt the package, making it unusable or unpullable from your package manager client. Deleting a file of a package protected by a protection rule is forbidden. The protection check is behind a feature flag named packages_protected_packages_delete, disabled by default.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
package_id
Path, required
IntegerID of the package
package_file_id
Path, required
IntegerID of the package file

Responses

CodeDescriptionSchema
204No Content—
400Bad Request—
403Forbidden—
404Not found—

Download a package file

GET /api/v4/projects/{id}/packages/{package_id}/package_files/{package_file_id}/download

This feature was introduced in GitLab 18.4

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
package_id
Path, required
IntegerID of the package
package_file_id
Path, required
IntegerID of the package file
download_mode
Query
StringRequested download transfer mode (proxy or direct). Only honored when allowed by the object storage configuration
Allowed values: proxy, direct

Responses

CodeDescriptionSchema
200OKString (binary) (application/octet-stream)
400Bad Request—
401Unauthorized—
403Forbidden—
404Not found—

List all package pipelines

GET /api/v4/projects/{id}/packages/{package_id}/pipelines

Lists all pipelines for a specified package. The results are sorted by id in descending order. The results are paginated and return up to 20 records per page. This feature was introduced in GitLab 16.1.

Parameters

NameTypeDescription
id
Path, required
String or integerID or URL-encoded path of the project
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Maximum: 20
Minimum: 1
Example: 20
package_id
Path, required
IntegerID of the package
cursor
Query
StringCursor for obtaining the next set of records

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesPackagePipeline
400Bad Request—
401Unauthorized—
403Forbidden—
404Not Found—

Schemas

Objects returned by the operations above and objects nested in their request bodies.

APIEntitiesCustomAttribute

PropertyTypeDescription
keyStringExample: foo
valueStringExample: bar

APIEntitiesGoModuleVersion

PropertyTypeDescription
TimeStringExample: 1617822312 -0600
VersionStringExample: v1.0.0

APIEntitiesPackage

PropertyTypeDescription
_linksObject—
_links.delete_api_pathString—
_links.web_pathString—
conan_package_nameString—
created_atString (date-time)Example: 2022-09-16T12:47:31.949Z
creator_idInteger (int64)ID of the user who created the package
Example: 1
idInteger (int64)Example: 1
last_downloaded_atString (date-time)Example: 2022-09-19T11:32:35.169Z
nameStringExample: @foo/bar
package_typeStringExample: npm
pipelineAPIEntitiesPackagePipeline—
pipelinesArray of APIEntitiesPackagePipeline—
project_idInteger (int64)Example: 2
project_pathStringExample: gitlab/foo/bar
statusStringExample: default
tagsString—
versionStringExample: 1.0.3
versionsArray of APIEntitiesPackageVersion—

APIEntitiesPackageFile

PropertyTypeDescription
created_atString (date-time)Example: 2018-11-07T15:25:52.199Z
file_md5StringExample: 58e6a45a629910c6ff99145a688971ac
file_nameStringExample: my-app-1.5-20181107.152550-1.jar
file_sha1StringExample: ebd193463d3915d7e22219f52740056dfd26cbfe
file_sha256StringExample: a903393463d3915d7e22219f52740056dfd26cbfeff321b
idInteger (int64)Example: 225
package_idInteger (int64)Example: 4
pipelinesArray of APIEntitiesPackagePipeline—
sizeIntegerExample: 2421

APIEntitiesPackagePipeline

PropertyTypeDescription
created_atString (date-time)Timestamp when the pipeline was created
Example: 2022-10-21T16:49:48.000+02:00
idInteger (int64)ID of the pipeline
Example: 1
iidIntegerInternal ID of the pipeline
Example: 2
project_idInteger (int64)ID of the project of the pipeline
Example: 3
refStringGit reference of the pipeline
Example: feature-branch
shaStringSHA of the commit the pipeline runs for
Example: 0ec9e58fdfca6cdd6652c083c9edb53abc0bad52
sourceStringSource that triggered the pipeline
Example: push
statusStringStatus of the pipeline
Example: success
updated_atString (date-time)Timestamp when the pipeline was last updated
Example: 2022-10-21T16:49:48.000+02:00
userAPIEntitiesUserBasic—
web_urlStringURL of the pipeline in the GitLab UI
Example: https://gitlab.example.com/gitlab-org/gitlab-foss/-/pipelines/61

APIEntitiesPackageVersion

PropertyTypeDescription
created_atString—
idString—
pipelineAPIEntitiesPackagePipeline—
tagsString—
versionString—

APIEntitiesUserBasic

PropertyTypeDescription
avatar_pathStringExample: /user/avatar/28/The-Big-Lebowski-400-400.png
avatar_urlStringURL of the user’s avatar
Example: https://gravatar.com/avatar/1
custom_attributesArray of APIEntitiesCustomAttribute—
idInteger (int64)ID of the user
Example: 1
lockedBooleanIf true, the user account is locked, and the user cannot sign in until the lock expires or an administrator unlocks the account
nameStringName of the user. For a bot user, **** if the current user cannot read the bot’s project or group
Example: Administrator
public_emailStringPublic email address of the user
Example: john@example.com
stateStringState of the user account. Possible values: active, blocked, ldap_blocked, blocked_pending_approval, banned, or deactivated
Example: active
usernameStringUsername of the user
Example: admin
web_urlStringURL of the user’s profile
Example: https://gitlab.example.com/root