Git Archive lets you download a tar.gz of a repository at a specific ref or commit. It is built for cases where you need a snapshot without cloning the whole repo, like packaging docs, examples, or release artifacts.
You can filter the archive with include and exclude globs and optionally prefix paths inside the archive so the output is ready to unpack into a target directory. The response streams as a gzip file, so it fits into build pipelines without extra storage steps.
curl -X POST \
-H "Authorization: Bearer $REPO_READ_TOKEN" \
-H "Content-Type: application/json" \
https://code.storage/api/v1/repos/archive \
--output repo.tar.gz \
-d @- <<'JSON'
{
"ref": "main",
"include_globs": ["docs/**", "README.md"],
"exclude_globs": ["**/drafts/**"],
"archive": {
"prefix": "sdk-docs/"
}
}
JSON