curl --request GET \
--url https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256} \
--header 'Authorization: Bearer <token>'import requests
url = "https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"spdxVersion": "SPDX-2.2",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT",
"name": "numpy-1.21.2-py39hd8d4704_0.conda",
"documentNamespace": "https://repo.anaconda.com/spdx/main/linux-64/numpy-1.21.2-py39hd8d4704_0.conda",
"creationInfo": {
"creators": [
"Organization: Anaconda, Inc."
],
"created": "2024-05-07T20:09:26Z"
},
"packages": [
"..."
],
"files": [
"..."
],
"relationships": [
"..."
]
}{
"status": 400,
"code": "bad-request",
"message": "Invalid channel name. Only 'main' and 'main-x' are supported."
}{
"status": 401,
"code": "unauthorized",
"message": "Authentication required."
}{
"status": 403,
"code": "forbidden",
"message": "User does not have an active premium subscription!"
}{
"status": 404,
"code": "artifact-not-found-by-sha256",
"message": "No artifact found with the given SHA256 hash."
}Get SBOM by SHA256
Returns the SBOM that Anaconda has on file for the package with the given SHA256 hash.
curl --request GET \
--url https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256} \
--header 'Authorization: Bearer <token>'import requests
url = "https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://repo.anaconda.cloud/repo/{channel_name}/sboms/sha256/{package_sha256}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"spdxVersion": "SPDX-2.2",
"dataLicense": "CC0-1.0",
"SPDXID": "SPDXRef-DOCUMENT",
"name": "numpy-1.21.2-py39hd8d4704_0.conda",
"documentNamespace": "https://repo.anaconda.com/spdx/main/linux-64/numpy-1.21.2-py39hd8d4704_0.conda",
"creationInfo": {
"creators": [
"Organization: Anaconda, Inc."
],
"created": "2024-05-07T20:09:26Z"
},
"packages": [
"..."
],
"files": [
"..."
],
"relationships": [
"..."
]
}{
"status": 400,
"code": "bad-request",
"message": "Invalid channel name. Only 'main' and 'main-x' are supported."
}{
"status": 401,
"code": "unauthorized",
"message": "Authentication required."
}{
"status": 403,
"code": "forbidden",
"message": "User does not have an active premium subscription!"
}{
"status": 404,
"code": "artifact-not-found-by-sha256",
"message": "No artifact found with the given SHA256 hash."
}repodata.json. The conda search --info command displays an MD5 hash but does not include the SHA256 value.404 response can mean one of two things: either no package with that SHA256 hash exists on the requested channel, or the package exists but Anaconda does not have an SBOM on file for it. Check the response message field to distinguish between them.Authorizations
Bearer token authentication with your Anaconda API key. Create a key in your account settings or with the anaconda auth api-key command.
See the Getting started page for the full authentication flow.
Path Parameters
The channel that contains the package. The SBOM API serves the main and main-x channels only.
main, main-x The SHA256 hash of the package artifact. You can find this value in the channel's repodata.json under the package entry.
^[0-9a-f]{64}$Query Parameters
Use view to receive the SBOM as JSON in the response body. Use download to receive the SBOM as a byte stream with a Content-Disposition header that provides the SBOM's filename.
view, download Response
The package's SBOM. The response is JSON in view mode and a byte stream in download mode.
An SPDX 2.2.1 JSON document.
Was this page helpful?