Skip to content

Conan API

DETAILS: Tier: Free, Premium, Ultimate Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

This is the API documentation for Conan Packages.

WARNING: This API is used by the Conan package manager client and is generally not meant for manual consumption.

For instructions on how to upload and install Conan packages from the GitLab package registry, see the Conan package registry documentation.

NOTE: These endpoints do not adhere to the standard API authentication methods. See each route for details on how credentials are expected to be passed. Undocumented authentication methods might be removed in the future.

NOTE: The Conan registry is not FIPS compliant and is disabled when FIPS mode is enabled. These endpoints will all return 404 Not Found.

Route prefix

There are two sets of identical routes that each make requests in different scopes:

  • Use the instance-level prefix to make requests in the entire GitLab instance's scope.
  • Use the project-level prefix to make requests in a single project's scope.

The examples in this document all use the instance-level prefix.

Instance-level

/packages/conan/v1

When using the instance-level routes, be aware that there is a naming restriction for Conan recipes.

Project-level

/projects/:id/packages/conan/v1
Attribute Type Required Description
id string yes The project ID or full project path.

Ping

Ping the GitLab Conan repository to verify availability:

GET <route-prefix>/ping
curl "https://gitlab.example.com/api/v4/packages/conan/v1/ping"

Example response:

""

Search

Search the instance for Conan packages by name:

GET <route-prefix>/conans/search
Attribute Type Required Description
q string yes Search query. You can use * as a wildcard.
curl --user <username>:<personal_access_token> "https://gitlab.example.com/api/v4/packages/conan/v1/conans/search?q=Hello*"

Example response:

{
  "results": [
    "Hello/0.1@foo+conan_test_prod/beta",
    "Hello/0.1@foo+conan_test_prod/stable",
    "Hello/0.2@foo+conan_test_prod/beta",
    "Hello/0.3@foo+conan_test_prod/beta",
    "Hello/0.1@foo+conan-reference-test/stable",
    "HelloWorld/0.1@baz+conan-reference-test/beta"
    "hello-world/0.4@buz+conan-test/alpha"
  ]
}

Authenticate

Returns a JWT to be used for Conan requests in a Bearer header:

"Authorization: Bearer <token>

The Conan package manager client automatically uses this token.

GET <route-prefix>/users/authenticate
/projects/:id/packages/conan/v1
```0

Example response:

```plaintext
/projects/:id/packages/conan/v1
```1

## Check Credentials

Checks the validity of Basic Auth credentials or a Conan JWT generated from [`/authenticate`](#authenticate).

```plaintext
/projects/:id/packages/conan/v1
```2

```plaintext
/projects/:id/packages/conan/v1
```3

Example response:

```plaintext
/projects/:id/packages/conan/v1
```4

## Recipe Snapshot

This returns the snapshot of the recipe files for the specified Conan recipe. The snapshot is a list
of filenames with their associated md5 hash.

```plaintext
/projects/:id/packages/conan/v1
```5

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `package_name`      | string | yes | Name of a package. |
| `package_version`   | string | yes | Version of a package. |
| `package_username`  | string | yes | Conan username of a package. This attribute is the `+`-separated full path of your project. |
| `package_channel`   | string | yes | Channel of a package. |

```plaintext
/projects/:id/packages/conan/v1
```6

Example response:

```plaintext
/projects/:id/packages/conan/v1
```7

## Package Snapshot

This returns the snapshot of the package files for the specified Conan recipe with the specified
Conan reference. The snapshot is a list of filenames with their associated md5 hash.

```plaintext
/projects/:id/packages/conan/v1
```8

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `package_name`      | string | yes | Name of a package. |
| `package_version`   | string | yes | Version of a package. |
| `package_username`  | string | yes | Conan username of a package. This attribute is the `+`-separated full path of your project. |
| `package_channel`   | string | yes | Channel of a package. |
| `conan_package_reference` | string | yes | Reference hash of a Conan package. Conan generates this value. |

```plaintext
/projects/:id/packages/conan/v1
```9

Example response:

```plaintext
GET <route-prefix>/ping
```0

## Recipe Manifest

The manifest is a list of recipe filenames with their associated download URLs.

```plaintext
GET <route-prefix>/ping
```1

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `package_name`      | string | yes | Name of a package. |
| `package_version`   | string | yes | Version of a package. |
| `package_username`  | string | yes | Conan username of a package. This attribute is the `+`-separated full path of your project. |
| `package_channel`   | string | yes | Channel of a package. |

```plaintext
GET <route-prefix>/ping
```2

Example response:

```plaintext
GET <route-prefix>/ping
```3

The URLs in the response have the same route prefix used to request them. If you request them with
the project-level route, the returned URLs contain `/projects/:id`.

## Package Manifest

The manifest is a list of package filenames with their associated download URLs.

```plaintext
GET <route-prefix>/ping
```4

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `package_name`      | string | yes | Name of a package. |
| `package_version`   | string | yes | Version of a package. |
| `package_username`  | string | yes | Conan username of a package. This attribute is the `+`-separated full path of your project. |
| `package_channel`   | string | yes | Channel of a package. |
| `conan_package_reference` | string | yes | Reference hash of a Conan package. Conan generates this value. |

```plaintext
GET <route-prefix>/ping
```5

Example response:

```plaintext
GET <route-prefix>/ping
```6

The URLs in the response have the same route prefix used to request them. If you request them with
the project-level route, the returned URLs contain `/projects/:id`.

## Recipe Download URLs

Recipe download URLs return a list of recipe filenames with their associated download URLs.
This attribute is the same payload as the [recipe manifest](#recipe-manifest) endpoint.

```plaintext
GET <route-prefix>/ping
```7

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `package_name`      | string | yes | Name of a package. |
| `package_version`   | string | yes | Version of a package. |
| `package_username`  | string | yes | Conan username of a package. This attribute is the `+`-separated full path of your project. |
| `package_channel`   | string | yes | Channel of a package. |

```plaintext
GET <route-prefix>/ping
```8

Example response:

```plaintext
GET <route-prefix>/ping
```9

The URLs in the response have the same route prefix used to request them. If you request them with
the project-level route, the returned URLs contain `/projects/:id`.

## Package Download URLs

Package download URLs return a list of package filenames with their associated download URLs.
This URL is the same payload as the [package manifest](#package-manifest) endpoint.

```shell
curl "https://gitlab.example.com/api/v4/packages/conan/v1/ping"
```0

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `package_name`      | string | yes | Name of a package. |
| `package_version`   | string | yes | Version of a package. |
| `package_username`  | string | yes | Conan username of a package. This attribute is the `+`-separated full path of your project. |
| `package_channel`   | string | yes | Channel of a package. |
| `conan_package_reference` | string | yes | Reference hash of a Conan package. Conan generates this value. |

```shell
curl "https://gitlab.example.com/api/v4/packages/conan/v1/ping"
```1

Example response:

```shell
curl "https://gitlab.example.com/api/v4/packages/conan/v1/ping"
```2

The URLs in the response have the same route prefix used to request them. If you request them with
the project-level route, the returned URLs contain `/projects/:id`.

## Recipe Upload URLs

Given a list of recipe filenames and file sizes, a list of URLs to upload each file is returned.

```shell
curl "https://gitlab.example.com/api/v4/packages/conan/v1/ping"
```3

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `package_name`      | string | yes | Name of a package. |
| `package_version`   | string | yes | Version of a package. |
| `package_username`  | string | yes | Conan username of a package. This attribute is the `+`-separated full path of your project. |
| `package_channel`   | string | yes | Channel of a package. |

Example request JSON payload:

```shell
curl "https://gitlab.example.com/api/v4/packages/conan/v1/ping"
```4

```shell
curl "https://gitlab.example.com/api/v4/packages/conan/v1/ping"
```5

Example response:

```shell
curl "https://gitlab.example.com/api/v4/packages/conan/v1/ping"
```6

The URLs in the response have the same route prefix used to request them. If you request them with
the project-level route, the returned URLs contain `/projects/:id`.

## Package Upload URLs

Given a list of package filenames and file sizes, a list of URLs to upload each file is returned.

```shell
curl "https://gitlab.example.com/api/v4/packages/conan/v1/ping"
```7

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `package_name`      | string | yes | Name of a package. |
| `package_version`   | string | yes | Version of a package. |
| `package_username`  | string | yes | Conan username of a package. This attribute is the `+`-separated full path of your project. |
| `package_channel`   | string | yes | Channel of a package. |
| `conan_package_reference` | string | yes | Reference hash of a Conan package. Conan generates this value. |

Example request JSON payload:

```shell
curl "https://gitlab.example.com/api/v4/packages/conan/v1/ping"
```8

```shell
curl "https://gitlab.example.com/api/v4/packages/conan/v1/ping"
```9

Example response:

```json
""
```0

The URLs in the response have the same route prefix used to request them. If you request them with
the project-level route, the returned URLs contain `/projects/:id`.

## Download a Recipe file

Download a recipe file to the package registry. You must use a download URL that the
[recipe download URLs endpoint](#recipe-download-urls)
returned.

```json
""
```1

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `package_name`      | string | yes | Name of a package. |
| `package_version`   | string | yes | Version of a package. |
| `package_username`  | string | yes | Conan username of a package. This attribute is the `+`-separated full path of your project. |
| `package_channel`   | string | yes | Channel of a package. |
| `recipe_revision`   | string | yes | Revision of the recipe. GitLab does not yet support Conan revisions, so the default value of `0` is always used. |
| `file_name`         | string | yes | The name and file extension of the requested file. |

```json
""
```2

You can also write the output to a file by using:

```json
""
```3

This example writes to `conanfile.py` in the current directory.

## Upload a Recipe file

Upload a recipe file to the package registry. You must use an upload URL that the
[recipe upload URLs endpoint](#recipe-upload-urls)
returned.

```json
""
```4

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `package_name`      | string | yes | Name of a package. |
| `package_version`   | string | yes | Version of a package. |
| `package_username`  | string | yes | Conan username of a package. This attribute is the `+`-separated full path of your project. |
| `package_channel`   | string | yes | Channel of a package. |
| `recipe_revision`   | string | yes | Revision of the recipe. GitLab does not yet support Conan revisions, so the default value of `0` is always used. |
| `file_name`         | string | yes | The name and file extension of the requested file. |

Provide the file context in the request body:

```json
""
```5

## Download a Package file

Download a package file to the package registry. You must use a download URL that the
[package download URLs endpoint](#package-download-urls)
returned.

```json
""
```6

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `package_name`      | string | yes | Name of a package. |
| `package_version`   | string | yes | Version of a package. |
| `package_username`  | string | yes | Conan username of a package. This attribute is the `+`-separated full path of your project. |
| `package_channel`   | string | yes | Channel of a package. |
| `recipe_revision`   | string | yes | Revision of the recipe. GitLab does not yet support Conan revisions, so the default value of `0` is always used. |
| `conan_package_reference` | string | yes | Reference hash of a Conan package. Conan generates this value. |
| `package_revision`  | string | yes | Revision of the package. GitLab does not yet support Conan revisions, so the default value of `0` is always used. |
| `file_name`         | string | yes | The name and file extension of the requested file. |

```json
""
```7

You can also write the output to a file by using:

```json
""
```8

This example writes to `conaninfo.txt` in the current directory.

## Upload a Package file

Upload a package file to the package registry. You must use an upload URL that the
[package upload URLs endpoint](#package-upload-urls)
returned.

```json
""
```9

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `package_name`      | string | yes | Name of a package. |
| `package_version`   | string | yes | Version of a package. |
| `package_username`  | string | yes | Conan username of a package. This attribute is the `+`-separated full path of your project. |
| `package_channel`   | string | yes | Channel of a package. |
| `recipe_revision`   | string | yes | Revision of the recipe. GitLab does not yet support Conan revisions, so the default value of `0` is always used. |
| `conan_package_reference` | string | yes | Reference hash of a Conan package. Conan generates this value. |
| `package_revision`  | string | yes | Revision of the package. GitLab does not yet support Conan revisions, so the default value of `0` is always used. |
| `file_name`         | string | yes | The name and file extension of the requested file. |

Provide the file context in the request body:

```plaintext
GET <route-prefix>/conans/search
```0

## Delete a Package (delete a Conan recipe)

Delete the Conan recipe and package files from the registry:

```plaintext
GET <route-prefix>/conans/search
```1

| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `package_name`      | string | yes | Name of a package. |
| `package_version`   | string | yes | Version of a package. |
| `package_username`  | string | yes | Conan username of a package. This attribute is the `+`-separated full path of your project. |
| `package_channel`   | string | yes | Channel of a package. |

```plaintext
GET <route-prefix>/conans/search
```2

Example response:

```plaintext
GET <route-prefix>/conans/search
```3