Skip to content

API Reference

vcpkg-harbor exposes a REST API compatible with vcpkg’s HTTP binary cache protocol.

http://localhost:15151

If authentication is enabled, include the appropriate header:

  • Token auth: Authorization: Bearer <token>
  • Basic auth: Authorization: Basic <base64(user:pass)>

Check if a package exists in the cache.

HEAD /{name}/{version}/{sha}

Parameters:

NameTypeDescription
namestringPackage name
versionstringPackage version
shastringPackage SHA hash

Responses:

StatusDescription
200Package exists
404Package not found

Example:

Terminal window
curl -I http://localhost:15151/zlib/1.2.13/abc123def456

Download a package from the cache.

GET /{name}/{version}/{sha}

Parameters:

NameTypeDescription
namestringPackage name
versionstringPackage version
shastringPackage SHA hash

Responses:

StatusDescription
200Binary package data (streaming)
404Package not found

Example:

Terminal window
curl -o package.zip http://localhost:15151/zlib/1.2.13/abc123def456

Upload a package to the cache.

PUT /{name}/{version}/{sha}

Parameters:

NameTypeDescription
namestringPackage name
versionstringPackage version
shastringPackage SHA hash

Request Body: Binary package data

Responses:

StatusDescription
200Upload successful
409Package already exists
403Server is read-only
500Upload failed

Example:

Terminal window
curl -X PUT --data-binary @package.zip \
http://localhost:15151/zlib/1.2.13/abc123def456

Response:

{
"status": "success",
"name": "zlib",
"version": "1.2.13",
"sha": "abc123def456",
"size": 1234567,
"etag": "d41d8cd98f00b204e9800998ecf8427e"
}

Delete a package from the cache.

DELETE /{name}/{version}/{sha}

Responses:

StatusDescription
200Package deleted
404Package not found
403Server is read-only

GET /health

Response:

{
"status": "healthy",
"version": "2.0.0",
"timestamp": "2024-01-15T10:30:00Z"
}

GET /health/live

Response:

{
"status": "alive",
"timestamp": "2024-01-15T10:30:00Z"
}

GET /health/ready

Responses:

StatusDescription
200Ready
503Not ready

GET /health/details

Response:

{
"status": "healthy",
"version": "2.0.0",
"uptime": "1d 2h 30m",
"storage": {
"healthy": true,
"backend": "minio",
"total_packages": 1234,
"total_size_bytes": 5678901234
},
"cache": {
"hits": 5000,
"misses": 500,
"hit_rate": "90.9%"
}
}

GET /metrics

Returns metrics in Prometheus text format.


Interactive API documentation is available at:

  • Swagger UI: http://localhost:15151/api/docs
  • ReDoc: http://localhost:15151/api/redoc
  • OpenAPI JSON: http://localhost:15151/api/openapi.json