REST API
The OwnStack control plane exposes a REST API that the CLI and dashboard both use. You can hit it directly for automation that doesn't fit either tool.
Base URL
Hosted: https://api.ownstack.org. Self-hosted: whatever you've configured for your control plane (the URL stored in your active CLI profile).
Authentication
Authorization: Bearer <token>
Use any of:
- Your account token from
~/.ownstack/profiles/<name>. - An app token from
./.ownstack-config(scoped to one app). - A deploy token (CI; scoped to one app's git endpoint).
Discoverable endpoints
| Endpoint | Purpose |
|---|---|
GET /api/apps | List apps. |
POST /api/apps | Create an app. |
GET /api/apps/:id | App detail. |
PATCH /api/apps/:id | Update app config (name, build_type, etc.). |
DELETE /api/apps/:id | Destroy app. |
POST /api/apps/:id/deploy | Trigger a deploy. |
GET /api/apps/:id/data/export?stack_id=N | Stream a Postgres/MySQL dump. |
POST /api/apps/:id/repair_postgres_link | Run the postgres link repair flow. |
GET /api/stacks | List stacks. |
POST /api/stacks | Create / provision a stack. |
Example: dump a database from CI
curl -sSL -H "Authorization: Bearer $OWNSTACK_TOKEN" \
-o backup-$(date +%Y%m%d).dump \
"$OWNSTACK_API_URL/api/apps/$APP_ID/data/export?stack_id=$STACK_ID"
API stability
The API is not yet versioned. We add endpoints frequently and try to avoid breaking changes; check the changelog for the running list of changes. If you depend on the API for production automation, pin to specific endpoints and expect to update when major versions ship.
Read next
- CLI reference — the CLI is the easiest API client.
- Profiles & tokens