Download a repository snapshot without cloning the repo. This is useful for packaging docs, examples, or release artefacts directly from a branch, tag, or commit.
JWT claims
Required scopes: git:read
Requires per repo scope: Yes
curl --request POST \
--url https://api.{cluster}.code.storage/api/repos/{repo_name}/archive \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"archive": {
"prefix": "sdk-docs/"
},
"exclude_globs": [
"**/drafts/**"
],
"include_globs": [
"docs/**",
"README.md"
],
"ref": "main"
}
'import requests
url = "https://api.{cluster}.code.storage/api/repos/{repo_name}/archive"
payload = {
"archive": { "prefix": "sdk-docs/" },
"exclude_globs": ["**/drafts/**"],
"include_globs": ["docs/**", "README.md"],
"ref": "main"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
archive: {prefix: 'sdk-docs/'},
exclude_globs: ['**/drafts/**'],
include_globs: ['docs/**', 'README.md'],
ref: 'main'
})
};
fetch('https://api.{cluster}.code.storage/api/repos/{repo_name}/archive', 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://api.{cluster}.code.storage/api/repos/{repo_name}/archive",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'archive' => [
'prefix' => 'sdk-docs/'
],
'exclude_globs' => [
'**/drafts/**'
],
'include_globs' => [
'docs/**',
'README.md'
],
'ref' => 'main'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.{cluster}.code.storage/api/repos/{repo_name}/archive"
payload := strings.NewReader("{\n \"archive\": {\n \"prefix\": \"sdk-docs/\"\n },\n \"exclude_globs\": [\n \"**/drafts/**\"\n ],\n \"include_globs\": [\n \"docs/**\",\n \"README.md\"\n ],\n \"ref\": \"main\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.{cluster}.code.storage/api/repos/{repo_name}/archive")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"archive\": {\n \"prefix\": \"sdk-docs/\"\n },\n \"exclude_globs\": [\n \"**/drafts/**\"\n ],\n \"include_globs\": [\n \"docs/**\",\n \"README.md\"\n ],\n \"ref\": \"main\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.{cluster}.code.storage/api/repos/{repo_name}/archive")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"archive\": {\n \"prefix\": \"sdk-docs/\"\n },\n \"exclude_globs\": [\n \"**/drafts/**\"\n ],\n \"include_globs\": [\n \"docs/**\",\n \"README.md\"\n ],\n \"ref\": \"main\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Repository name. Names that contain / or any other character that is not safe in a URL path segment must be URL encoded so the value occupies a single path segment. For example pierre/example is sent as pierre%2Fexample. Plain names such as example can be sent as-is. The server URL-decodes the value before resolving the repository.
Body
Request a .tar.gz snapshot of the repository at a branch, tag, or commit. Include and exclude globs let you shape the archive before it streams back.
Archive options describing the ref to snapshot and the include or exclude filters applied to the resulting tarball.
Branch, tag, or commit to archive. When omitted, the default branch or HEAD is used.
Optional archive output settings.
Show child attributes
Show child attributes
Exclude files matching these glob patterns after include filtering.
Glob pattern such as node_modules/**.
Only include files matching these glob patterns.
Glob pattern such as src/**/*.go.
Maximum blob size to include in the archive, in bytes.
Response
A streamed .tar.gz archive of the resolved revision.
Gzip-compressed tar archive stream.
curl --request POST \
--url https://api.{cluster}.code.storage/api/repos/{repo_name}/archive \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"archive": {
"prefix": "sdk-docs/"
},
"exclude_globs": [
"**/drafts/**"
],
"include_globs": [
"docs/**",
"README.md"
],
"ref": "main"
}
'import requests
url = "https://api.{cluster}.code.storage/api/repos/{repo_name}/archive"
payload = {
"archive": { "prefix": "sdk-docs/" },
"exclude_globs": ["**/drafts/**"],
"include_globs": ["docs/**", "README.md"],
"ref": "main"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
archive: {prefix: 'sdk-docs/'},
exclude_globs: ['**/drafts/**'],
include_globs: ['docs/**', 'README.md'],
ref: 'main'
})
};
fetch('https://api.{cluster}.code.storage/api/repos/{repo_name}/archive', 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://api.{cluster}.code.storage/api/repos/{repo_name}/archive",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'archive' => [
'prefix' => 'sdk-docs/'
],
'exclude_globs' => [
'**/drafts/**'
],
'include_globs' => [
'docs/**',
'README.md'
],
'ref' => 'main'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.{cluster}.code.storage/api/repos/{repo_name}/archive"
payload := strings.NewReader("{\n \"archive\": {\n \"prefix\": \"sdk-docs/\"\n },\n \"exclude_globs\": [\n \"**/drafts/**\"\n ],\n \"include_globs\": [\n \"docs/**\",\n \"README.md\"\n ],\n \"ref\": \"main\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.{cluster}.code.storage/api/repos/{repo_name}/archive")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"archive\": {\n \"prefix\": \"sdk-docs/\"\n },\n \"exclude_globs\": [\n \"**/drafts/**\"\n ],\n \"include_globs\": [\n \"docs/**\",\n \"README.md\"\n ],\n \"ref\": \"main\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.{cluster}.code.storage/api/repos/{repo_name}/archive")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"archive\": {\n \"prefix\": \"sdk-docs/\"\n },\n \"exclude_globs\": [\n \"**/drafts/**\"\n ],\n \"include_globs\": [\n \"docs/**\",\n \"README.md\"\n ],\n \"ref\": \"main\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}