API Quick Start
Make your first API call to sh0 in a few minutes: create an API key, list your apps, redeploy one, and read the response formats.
/api/v1. The examples use https://panel.example.com: replace it with your own address.Create an API Key
In the dashboard, open Settings → API Keys, create a key with the access level you need, and copy it: it is shown only once. Access levels are explained in API Authentication. Then keep it in an environment variable:
export SH0_TOKEN="sh0_..."Step 2: List Your Apps
List your applications. Any access level can do this:
curl https://panel.example.com/api/v1/apps \
-H "Authorization: Bearer $SH0_TOKEN"Redeploy an App
Trigger a new deployment of an existing app, using its ID from the list. This needs the Deployment or Administration level. The body may be empty, but it must be valid JSON:
curl -X POST https://panel.example.com/api/v1/apps/APP_ID/deployments \
-H "Authorization: Bearer $SH0_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'To create an app from your own code, the shortest path is the CLI: sh0 push uploads your project directory as an archive and deploys it, with or without a Dockerfile.
Response Format
All sh0 API responses follow a consistent format:
Successful responses:
{
"data": { ... }
}List responses with pagination:
{
"data": [ ... ],
"total": 42,
"page": 1,
"per_page": 20,
"pages": 3
}Error responses:
{
"error": {
"code": "NOT_FOUND",
"message": "App with id 'app_xyz' not found"
}
}Pagination
List endpoints support pagination with two query parameters:
| Parameter | Default | Description |
|---|---|---|
page | 1 | Page number (1-indexed) |
per_page | 20 | Items per page (max 100) |
# Get page 2, 50 items per page
curl "https://panel.example.com/api/v1/apps/APP_ID/deployments?page=2&per_page=50" \
-H "Authorization: Bearer $SH0_TOKEN"Error Handling
The API uses standard HTTP status codes. Here are the most common ones:
| Status | Meaning |
|---|---|
| 200 | Success |
| 201 | Resource created |
| 400 | Bad request (invalid parameters) |
| 401 | Unauthorized (missing or invalid token) |
| 403 | Forbidden (insufficient permissions) |
| 404 | Resource not found |
| 409 | Conflict (duplicate name, etc.) |
| 422 | Validation error |
| 429 | Rate limited |
| 500 | Internal server error |
error.code field for programmatic error handling rather than parsing the message string, which may change between versions.Next Steps
Now that you can authenticate and make basic API calls, explore the full capabilities of the sh0 API:
- Full API Reference -- Interactive explorer with all 180+ endpoints
- Git Deploy -- Set up push-to-deploy workflows
- Scaling -- Scale apps via the API
- Monitoring -- Retrieve metrics and health data