Conan v2 API

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

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.

"Authorization: Bearer <authenticate_token>

The Conan 2 package manager client automatically uses this token.

GET /projects/:id/packages/conan/v2/users/authenticate
AttributeTypeRequiredDescription
idstringConditionallyThe project ID or full project path. Required only for the project endpoint.

Generate a base64-encoded Basic Auth token:

echo -n "<username>:<your_access_token>"|base64

Use the base64-encoded Basic Auth token to get a JWT token:

curl --request GET \
     --header 'Authorization: Basic <base64_encoded_token>' \
     --url "https://gitlab.example.com/api/v4/packages/conan/v2/users/authenticate"

Example response:

eyJhbGciOiJIUzI1NiIiheR5cCI6IkpXVCJ9.eyJhY2Nlc3NfdG9rZW4iOjMyMTQyMzAsqaVzZXJfaWQiOjQwNTkyNTQsImp0aSI6IjdlNzBiZTNjLWFlNWQtNDEyOC1hMmIyLWZiOThhZWM0MWM2OSIsImlhd3r1MTYxNjYyMzQzNSwibmJmIjoxNjE2NjIzNDMwLCJleHAiOjE2MTY2MjcwMzV9.QF0Q3ZIB2GW5zNKyMSIe0HIFOITjEsZEioR-27Rtu7E

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
AttributeTypeRequiredDescription
idstringyesThe 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
AttributeTypeRequiredDescription
idstringyesThe project ID or full project path.
querystringyesSearch 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
AttributeTypeRequiredDescription
idstringyesThe project ID or full project path.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
curl --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
AttributeTypeRequiredDescription
idstringyesThe project ID or full project path.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
curl --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/revisions"

Example response:

{
  "reference": "my-package/1.0@my-group+my-project/stable",
  "revisions": [
    {
      "revision": "75151329520e7685dcf5da49ded2fec0",
      "time": "2024-12-17T09:16:40.334+0000"
    },
    {
      "revision": "df28fd816be3a119de5ce4d374436b25",
      "time": "2024-12-17T09:15:30.123+0000"
    }
  ]
}

Delete a recipe revision

Delete the recipe revision from the registry. If the package has only one recipe revision, the package is deleted as well.

DELETE /projects/:id/packages/conan/conans/:package_name/package_version/:package_username/:package_channel/revisions/:recipe_revision
AttributeTypeRequiredDescription
idstringyesThe project ID or full project path.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
recipe_revisionstringyesRevision hash of the recipe revision to delete.
curl --request DELETE \
     --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/revisions/2be19f5a69b2cb02ab576755252319b9"

List all recipe files

Lists all recipe files from the package registry.

GET /projects/:id/packages/conan/v2/conans/:package_name/:package_version/:package_username/:package_channel/revisions/:recipe_revision/files
AttributeTypeRequiredDescription
idstringyesThe project ID or full project path.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
recipe_revisionstringyesRevision of the recipe. Does not accept a value of 0.
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/projects/9/packages/conan/v2/conans/my-package/1.0/my-username/stable/revisions/df28fd816be3a119de5ce4d374436b25/files"

Example response:

{
  "files": {
    "conan_sources.tgz": {},
    "conanfile.py": {},
    "conanmanifest.txt": {}
  }
}

Get a recipe file

Gets a recipe file from the package regitry.

GET /projects/:id/packages/conan/v2/conans/:package_name/:package_version/:package_username/:package_channel/revisions/:recipe_revision/files/:file_name
AttributeTypeRequiredDescription
idstringyesThe project ID or full project path.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
recipe_revisionstringyesRevision of the recipe. Does not accept a value of 0.
file_namestringyesThe name and file extension of the requested file.
curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/projects/9/packages/conan/v2/conans/my-package/1.0/my-username/stable/revisions/df28fd816be3a119de5ce4d374436b25/files/conanfile.py"

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

curl --header "Authorization: Bearer <authenticate_token>" \
     --url "https://gitlab.example.com/api/v4/projects/9/packages/conan/v2/conans/my-package/1.0/my-username/stable/revisions/df28fd816be3a119de5ce4d374436b25/files/conanfile.py" \
     >> conanfile.py

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

Upload a recipe file

Uploads a recipe file to the package registry.

PUT /projects/:id/packages/conan/v2/conans/:package_name/:package_version/:package_username/:package_channel/revisions/:recipe_revision/files/:file_name
AttributeTypeRequiredDescription
idstringyesThe project ID or full project path.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
recipe_revisionstringyesRevision of the recipe. Does not accept a value of 0.
file_namestringyesThe name and file extension of the requested file.
curl --request PUT \
     --header "Authorization: Bearer <authenticate_token>" \
     --upload-file path/to/conanfile.py \
     --url "https://gitlab.example.com/api/v4/projects/9/packages/conan/v2/conans/upload-v2-package/1.0.0/user/stable/revisions/123456789012345678901234567890ab/files/conanfile.py"

Example response:

{
  "id": 38,
  "package_id": 28,
  "created_at": "2025-04-07T12:35:40.841Z",
  "updated_at": "2025-04-07T12:35:40.841Z",
  "size": 24,
  "file_store": 1,
  "file_md5": "131f806af123b497209a516f46d12ffd",
  "file_sha1": "01b992b2b1976a3f4c1e5294d0cab549cd438502",
  "file_name": "conanfile.py",
  "file": {
    "url": "/94/00/9400f1b21cb527d7fa3d3eabba93557a18ebe7a2ca4e471cfe5e4c5b4ca7f767/packages/28/files/38/conanfile.py"
  },
  "file_sha256": null,
  "verification_retry_at": null,
  "verified_at": null,
  "verification_failure": null,
  "verification_retry_count": null,
  "verification_checksum": null,
  "verification_state": 0,
  "verification_started_at": null,
  "status": "default",
  "file_final_path": null,
  "project_id": 9,
  "new_file_path": null
}

List all package revisions

Lists all package revisions for a specific recipe revision and package reference.

GET /projects/:id/packages/conan/v2/conans/:package_name/:package_version/:package_username/:package_channel/revisions/:recipe_revision/packages/:conan_package_reference/revisions
AttributeTypeRequiredDescription
idstringyesThe project ID or full project path.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
recipe_revisionstringyesRevision of the recipe. Does not accept a value of 0.
conan_package_referencestringyesReference hash of a Conan package. Conan generates this value.
curl --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/revisions/75151329520e7685dcf5da49ded2fec0/packages/103f6067a947f366ef91fc1b7da351c588d1827f/revisions"

Example response:

{
  "reference": "my-package/1.0@my-group+my-project/stable#75151329520e7685dcf5da49ded2fec0:103f6067a947f366ef91fc1b7da351c588d1827f",
  "revisions": [
    {
      "revision": "2bfb52659449d84ed11356c353bfbe86",
      "time": "2024-12-17T09:16:40.334+0000"
    },
    {
      "revision": "3bdd2d8c8e76c876ebd1ac0469a4e72c",
      "time": "2024-12-17T09:15:30.123+0000"
    }
  ]
}

Get latest package revision

Gets the revision hash and creation date of the latest package revision for a specific recipe revision and package reference.

GET /api/v4/projects/:id/packages/conan/v2/conans/:package_name/:package_version/:package_username/:package_channel/revisions/:recipe_revision/packages/:conan_package_reference/latest
AttributeTypeRequiredDescription
idstringyesThe project ID or full project path.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
recipe_revisionstringyesRevision of the recipe. Does not accept a value of 0.
conan_package_referencestringyesReference hash of a Conan package. Conan generates this value.
curl --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/revisions/75151329520e7685dcf5da49ded2fec0/packages/103f6067a947f366ef91fc1b7da351c588d1827f/latest"

Example response:

{
  "revision" : "3bdd2d8c8e76c876ebd1ac0469a4e72c",
  "time" : "2024-12-17T09:16:40.334+0000"
}

Get a package file

Gets a package file from the package registry.

GET /projects/:id/packages/conan/v2/conans/:package_name/:package_version/:package_username/:package_channel/revisions/:recipe_revision/packages/:conan_package_reference/revisions/:package_revision/files/:file_name
AttributeTypeRequiredDescription
idstringyesThe project ID or full project path.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
recipe_revisionstringyesRevision of the recipe. Does not accept a value of 0.
conan_package_referencestringyesReference hash of a Conan package. Conan generates this value.
package_revisionstringyesRevision of the package. Does not accept a value of 0.
file_namestringyesThe name and file extension of the requested file.
curl --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/revisions/75151329520e7685dcf5da49ded2fec0/packages/103f6067a947f366ef91fc1b7da351c588d1827f/revisions/3bdd2d8c8e76c876ebd1ac0469a4e72c/files/conaninfo.txt"

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

curl --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/revisions/75151329520e7685dcf5da49ded2fec0/packages/103f6067a947f366ef91fc1b7da351c588d1827f/revisions/3bdd2d8c8e76c876ebd1ac0469a4e72c/files/conaninfo.txt" \
     >> conaninfo.txt

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

Upload a package file

Uploads a package file to the package registry.

PUT /projects/:id/packages/conan/v2/conans/:package_name/:package_version/:package_username/:package_channel/revisions/:recipe_revision/packages/:conan_package_reference/revisions/:package_revision/files/:file_name
AttributeTypeRequiredDescription
idstringyesThe project ID or full project path.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
recipe_revisionstringyesRevision of the recipe. Does not accept a value of 0.
conan_package_referencestringyesReference hash of a Conan package. Conan generates this value.
package_revisionstringyesRevision of the package. Does not accept a value of 0.
file_namestringyesThe name and file extension of the requested file.

Provide the file context in the request body:

curl --request PUT \
     --header "Authorization: Bearer <authenticate_token>" \
     --upload-file path/to/conaninfo.txt \
     --url "https://gitlab.example.com/api/v4/projects/9/packages/conan/v2/conans/my-package/1.0/my-group+my-project/stable/revisions/75151329520e7685dcf5da49ded2fec0/packages/103f6067a947f366ef91fc1b7da351c588d1827f/revisions/3bdd2d8c8e76c876ebd1ac0469a4e72c/files/conaninfo.txt"

Example response:

{
  "id": 202,
  "package_id": 48,
  "created_at": "2025-03-19T10:06:53.626Z",
  "updated_at": "2025-03-19T10:06:53.626Z",
  "size": 208,
  "file_store": 1,
  "file_md5": "bf996313bbdd75944b58f8c673661d99",
  "file_sha1": "02c8adf14c94135fb95d472f96525063efe09ee8",
  "file_name": "conaninfo.txt",
  "file": {
      "url": "/94/00/9400f1b21cb527d7fa3d3eabba93557a18ebe7a2ca4e471cfe5e4c5b4ca7f767/packages/48/files/202/conaninfo.txt"
  },
  "file_sha256": null,
  "verification_retry_at": null,
  "verified_at": null,
  "verification_failure": null,
  "verification_retry_count": null,
  "verification_checksum": null,
  "verification_state": 0,
  "verification_started_at": null,
  "status": "default",
  "file_final_path": null,
  "project_id": 9,
  "new_file_path": null
}

Get package references metadata

Gets the metadata for all package references of a package.

GET /projects/:id/packages/conan/v2/conans/:package_name/:package_version/:package_username/:package_channel/search
AttributeTypeRequiredDescription
idstringyesThe project ID or full project path.
package_namestringyesName of a package.
package_versionstringyesVersion of a package.
package_usernamestringyesConan username of a package. This attribute is the +-separated full path of your project.
package_channelstringyesChannel of a package.
curl --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/search"

Example response:

{
  "103f6067a947f366ef91fc1b7da351c588d1827f": {
    "settings": {
      "arch": "x86_64",
      "build_type": "Release",
      "compiler": "gcc",
      "compiler.libcxx": "libstdc++",
      "compiler.version": "9",
      "os": "Linux"
    },
    "options": {
      "shared": "False"
    },
    "requires": {
      "zlib/1.2.11": null
    },
    "recipe_hash": "75151329520e7685dcf5da49ded2fec0"
  }
}

The response includes the following metadata for each package reference:

  • settings: The build settings used for the package.
  • options: The package options.
  • requires: The required dependencies for the package.
  • recipe_hash: The hash of the recipe.