API
Everything the web UI and CLI do goes through this API. Routes accept either an Authorization: Bearer <key> (a scoped managed key or the bootstrap ARTIFACTS_API_KEY) or a valid admin session cookie. /mcp is bearer-only.
Publish
curl -X POST https://artifacts.example.com/api/artifacts \
-H "Authorization: Bearer $ARTIFACTS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "<h1>hello</h1>", "type": "html", "slug": "hello"}'
{ "slug": "hello", "url": "https://artifacts.example.com/a/hello" }
type is one of html, jsx, tsx, or md. A POST to an existing slug returns 409; use PUT to update.
Endpoints
| Method | Path | Purpose | Min scope |
|---|---|---|---|
POST |
/api/artifacts |
Publish {content, type, slug?, title?, tags?, project?, expiresAt?, frame?, visibility?, password?} |
publish |
POST |
/api/artifacts/zip |
Deploy a raw zip body as a static site under /a/{slug}/ |
publish |
PUT |
/api/artifacts/:slug |
Replace an artifact’s content | publish |
PATCH |
/api/artifacts/:slug |
Rename, disable, retag, reproject, set expiry/frame/visibility | publish |
GET |
/api/artifacts |
List (filter with ?tag= and/or ?project=) |
read |
DELETE |
/api/artifacts/:slug |
Delete | full |
Reads of the rendered artifact live outside the API at GET /a/:slug (add ?raw=1 for the bare page, /source for the original upload). Body limits: 10 MB JSON, 50 MB zip.
Zip sites
POST /api/artifacts/zip with the raw zip as the body deploys a multi-file static site. The archive must contain index.html at the root; only static-hostable file types are allowed; path traversal, absolute paths, and symlinks are rejected. Limits: 50 MB zip, 100 MB uncompressed, 2000 files.
Visibility
Set visibility on any write: public (default), private (operator only; the unlock prompt takes the admin password), or password (a shared password you hand out). The gate is enforced on every serve path, so ?raw=1, /source, and zip sub-assets never leak a locked artifact.
Errors
Disabled artifacts return 404; expired ones return 410. Both keep their content; re-enable or extend the expiry to serve again.