REST API
The REST API mirrors the CLI publish flow: create a version, upload files using the returned policy, then finalize.
Static spaces can be anonymous. Create a static space without auth to get a one-time claimToken, then send that token as x-stattic-claim-token for later publishes until the space is claimed:
curl -sS https://api.stattic.net/v1/spaces \
-H 'Content-Type: application/json' \
-d '{"title":"Agent publish"}'
Use one of these credentials for space-scoped version operations:
Authorization: Bearer st_...for account or team access tokens.x-stattic-claim-token: ...for anonymous spaces returned by the first publish or space creation.
curl -sS https://api.stattic.net/v1/spaces/prj_123/versions \
-H 'x-stattic-claim-token: claim-token-from-space-create' \
-H 'Content-Type: application/json' \
-d '{
"sourceKind": "direct_upload",
"files": [
{
"path": "index.html",
"size": 15,
"contentType": "text/html"
}
]
}'
The response returns a versionId and an uploads array. For each upload with "kind": "single", send the file bytes to the returned URL with the returned method and headers:
curl -X PUT 'https://upload-url.example/index.html' \
-H 'content-type: text/html' \
--data-binary @index.html
Then finalize the version:
curl -sS https://api.stattic.net/v1/spaces/prj_123/versions/ver_123/finalize \
-H 'x-stattic-claim-token: claim-token-from-space-create' \
-H 'Content-Type: application/json' \
-d '{}'
For updates, include sha256 on each manifest entry so the API can skip unchanged files. Large files can return multipart upload instructions with parts, complete, and abort actions; use the returned URLs and headers exactly.