Conan v2 API
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
Version history
-
Introduced in GitLab 17.11 with a flag named
conan_package_revisions_support
. Disabled by default.
The availability of this feature is controlled by a feature flag. For more information, see the history.
For Conan v1 operations, see Conan v1 API.
Use this API to interact with the Conan v2 package manager. For more information, see Conan packages in the package registry or Conan 2 package manager client.
Generally, these endpoints are used by the Conan 2 package manager client and are not meant for manual consumption.
-
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.
-
The Conan registry is not FIPS compliant and is disabled when FIPS mode is enabled. These endpoints all return
404 Not Found
.
Create an authentication token
Creates a JSON Web Token (JWT) for use as a Bearer header in other requests using the Conan v1 /authenticate
endpoint.
Verify authentication credentials
Verifies the validity of Basic Auth credentials or a Conan JWT generated from the Conan v1 /authenticate
endpoint.
GET /projects/:id/packages/conan/v2/users/check_credentials
Attribute | Type | Required | Description |
---|---|---|---|
id |
string | yes | The project ID or full project path. |
curl --request GET \
--header "Authorization: Bearer <authenticate_token>" \
--url "https://gitlab.example.com/api/v4/projects/<project_id>/packages/conan/v2/users/check_credentials"
Example response:
ok
Search for a Conan package
Searches the project for a Conan package with a specified name.
GET /projects/:id/packages/conan/v2/conans/search?q=:query
Attribute | Type | Required | Description |
---|---|---|---|
id |
string | yes | The project ID or full project path. |
query |
string | yes | Search query. You can use * as a wildcard. |
curl --request GET \
--header "Authorization: Bearer <authenticate_token>" \
--url "https://gitlab.example.com/api/v4/projects/9/packages/conan/v2/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"
]
}
Get latest recipe revision
Gets the revision hash and creation date of the latest package recipe.
GET /projects/:id/packages/conan/v2/conans/:package_name/:package_version/:package_username/:package_channel/latest
Attribute | Type | Required | Description |
---|---|---|---|
id |
string | yes | The project ID or full project path. |
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. |
curl --request GET \
--header "Authorization: Bearer <authenticate_token>" \
--url "https://gitlab.example.com/api/v4/projects/9/packages/conan/v2/conans/my-package/1.0/my-group+my-project/stable/latest"
Example response:
{
"revision" : "75151329520e7685dcf5da49ded2fec0",
"time" : "2024-12-17T09:16:40.334+0000"
}
List all recipe revisions
Lists all revisions for a package recipe.
GET /projects/:id/packages/conan/v2/conans/:package_name/:package_version/:package_username/:package_channel/revisions
Attribute | Type | Required | Description |
---|---|---|---|
id |
string | yes | The project ID or full project path. |
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. |
curl --request GET \
--header "Authorization: Bearer <authenticate_token>" \
--url "https://gitlab.example.com/api/v4/projects/<project_id>/packages/conan/v2/users/check_credentials"
```0
Example response:
```shell
curl --request GET \
--header "Authorization: Bearer <authenticate_token>" \
--url "https://gitlab.example.com/api/v4/projects/<project_id>/packages/conan/v2/users/check_credentials"
```1
## List all recipe files
Lists all recipe files from the package registry.
```shell
curl --request GET \
--header "Authorization: Bearer <authenticate_token>" \
--url "https://gitlab.example.com/api/v4/projects/<project_id>/packages/conan/v2/users/check_credentials"
```2
| Attribute | Type | Required | Description |
| ------------------ | ------ | -------- | ------------------------------------------------------------------------------------------- |
| `id` | string | yes | The project ID or full project path. |
| `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. Does not accept a value of `0`. |
```shell
curl --request GET \
--header "Authorization: Bearer <authenticate_token>" \
--url "https://gitlab.example.com/api/v4/projects/<project_id>/packages/conan/v2/users/check_credentials"
```3
Example response:
```shell
curl --request GET \
--header "Authorization: Bearer <authenticate_token>" \
--url "https://gitlab.example.com/api/v4/projects/<project_id>/packages/conan/v2/users/check_credentials"
```4
## Get a recipe file
Gets a recipe file from the package regitry.
```shell
curl --request GET \
--header "Authorization: Bearer <authenticate_token>" \
--url "https://gitlab.example.com/api/v4/projects/<project_id>/packages/conan/v2/users/check_credentials"
```5
| Attribute | Type | Required | Description |
| ------------------ | ------ | -------- | ------------------------------------------------------------------------------------------- |
| `id` | string | yes | The project ID or full project path. |
| `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. Does not accept a value of `0`. |
| `file_name` | string | yes | The name and file extension of the requested file. |
```shell
curl --request GET \
--header "Authorization: Bearer <authenticate_token>" \
--url "https://gitlab.example.com/api/v4/projects/<project_id>/packages/conan/v2/users/check_credentials"
```6
You can also write the output to a file by using:
```shell
curl --request GET \
--header "Authorization: Bearer <authenticate_token>" \
--url "https://gitlab.example.com/api/v4/projects/<project_id>/packages/conan/v2/users/check_credentials"
```7
This example writes to `conanfile.py` in the current directory.
## Upload a recipe file
Uploads a recipe file to the package registry.
```shell
curl --request GET \
--header "Authorization: Bearer <authenticate_token>" \
--url "https://gitlab.example.com/api/v4/projects/<project_id>/packages/conan/v2/users/check_credentials"
```8
| Attribute | Type | Required | Description |
| ------------------ | ------ | -------- | ------------------------------------------------------------------------------------------- |
| `id` | string | yes | The project ID or full project path. |
| `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. Does not accept a value of `0`. |
| `file_name` | string | yes | The name and file extension of the requested file. |
```shell
curl --request GET \
--header "Authorization: Bearer <authenticate_token>" \
--url "https://gitlab.example.com/api/v4/projects/<project_id>/packages/conan/v2/users/check_credentials"
```9
Example response:
```plaintext
ok
```0
## Upload a package file
Uploads a package file to the package registry.
```plaintext
ok
```1
| Attribute | Type | Required | Description |
| ------------------------- | ------ | -------- | ------------------------------------------------------------------------------------------- |
| `id` | string | yes | The project ID or full project path. |
| `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. Does not accept a value of `0`. |
| `conan_package_reference` | string | yes | Reference hash of a Conan package. Conan generates this value. |
| `package_revision` | string | yes | Revision of the package. Does not accept a value of `0`. |
| `file_name` | string | yes | The name and file extension of the requested file. |
Provide the file context in the request body:
```plaintext
ok
```2
Example response:
```plaintext
ok
```3