SweatStack Pages API¶
SweatStack Pages lets you host a static site for your application without standing up infrastructure of your own. Each page belongs to one of your applications and is served at https://{slug}.pages.sweatstack.dev.
The CLI is the easiest way to deploy: sweatstack page deploy myapp ./dist. This page documents the underlying HTTP API for cases where the CLI doesn't fit (CI/CD pipelines using a different language, custom tooling, etc.).
Authentication¶
Pages endpoints authenticate as the principal user: the user who owns the application. They use your personal API key or an OAuth token issued to you, not an application token issued via OAuth2 to a third-party app.
All endpoints require the data:write scope (read uses data:read). Get an API key at app.sweatstack.no/settings/api.
Create a page¶
POST /api/v1/pages registers a new page slug for an application. The slug becomes the subdomain.
curl -X POST "https://app.sweatstack.no/api/v1/pages" \
-H "Authorization: Bearer {your_access_token}" \
-F "application_id={your_application_id}" \
-F "slug=myapp"
Returns:
{
"slug": "myapp",
"published": false,
"application": {
"id": "app_...",
"name": "My App",
"is_private": false
},
"url": "https://myapp.pages.sweatstack.dev"
}
The slug is lowercased and validated against reserved words. If it's taken or invalid, the response is 400. Pages start unpublished; deploying files publishes them.
Get a page¶
GET /api/v1/pages/{slug} returns the page metadata.
curl -X GET "https://app.sweatstack.no/api/v1/pages/myapp" \
-H "Authorization: Bearer {your_access_token}"
Same response shape as create.
Deploy files¶
PUT /api/v1/pages/{slug}/deploy uploads files to the page. This replaces all existing files; treat each deploy as an atomic snapshot, not an incremental update.
curl -X PUT "https://app.sweatstack.no/api/v1/pages/myapp/deploy" \
-H "Authorization: Bearer {your_access_token}" \
-F "files=@dist/index.html" \
-F "files=@dist/app.js" \
-F "files=@dist/styles.css"
Multiple files parts can be included in a single request. File paths in the upload are preserved relative to the deploy root, so dist/assets/logo.png lands at https://myapp.pages.sweatstack.dev/assets/logo.png.
Returns the page metadata (now with published: true).
Delete a page¶
DELETE /api/v1/pages/{slug} removes the page and all its assets.
curl -X DELETE "https://app.sweatstack.no/api/v1/pages/myapp" \
-H "Authorization: Bearer {your_access_token}"
Returns {"ok": true} on success. The slug becomes available for reuse.
Errors¶
| Status | Cause |
|---|---|
| 400 | Slug invalid, reserved, or already taken |
| 403 | Token doesn't belong to the application's owner |
| 404 | Page or application not found |
When to use the CLI vs. the API¶
- CLI: any time you're deploying from a developer machine or a standard CI runner.
sweatstack page deployhandles auth, multipart upload, and file collection in one command. - API: pipelines in languages where the CLI isn't installed, or when you need custom upload behavior (e.g. uploading from a serverless function, deploying as part of a larger orchestration).