Download Artifacts from CAS
curl --request GET \
--url https://cp.chainloop.dev/download/{digest} \
--header 'Authorization: Bearer <token>'import requests
url = "https://cp.chainloop.dev/download/{digest}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://cp.chainloop.dev/download/{digest}', 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://cp.chainloop.dev/download/{digest}",
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://cp.chainloop.dev/download/{digest}"
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://cp.chainloop.dev/download/{digest}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://cp.chainloop.dev/download/{digest}")
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_bodyYour download will begin shortly...Download Artifacts from CAS
Downloads artifacts stored in the Chainloop Content Addressable Storage (CAS).
The artifact is identified by its cryptographic digest, which serves as both the unique identifier and integrity verification mechanism. The endpoint behavior varies based on the client type detected via the Accept header.
Client-Specific Behavior:
- Browser clients (Accept contains “text/html”): Receives a user-friendly message with a 1-second delayed redirect using the Refresh header
- CLI/API clients (other Accept values): Receives immediate 302 redirect via Location header
GET
/
download
/
{digest}
Download Artifacts from CAS
curl --request GET \
--url https://cp.chainloop.dev/download/{digest} \
--header 'Authorization: Bearer <token>'import requests
url = "https://cp.chainloop.dev/download/{digest}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://cp.chainloop.dev/download/{digest}', 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://cp.chainloop.dev/download/{digest}",
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://cp.chainloop.dev/download/{digest}"
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://cp.chainloop.dev/download/{digest}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://cp.chainloop.dev/download/{digest}")
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_bodyYour download will begin shortly...Headers
Path Parameters
Response
302 - text/plain
Successful redirect to artifact download URL. Response behavior depends on the Accept header:
For browsers (Accept contains "text/html"):
- Uses
Refreshheader with 1-second delay - Returns user-friendly message in response body
- Provides better UX for browser downloads
For CLI tools (other Accept values):
- Uses standard
Locationheader for immediate redirect - Empty response body
- Suitable for automated tools like curl
The response is of type string.
Example:
"Your download will begin shortly..."
