Docs/ API Reference/ Quick Start

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.

Note
The API is served by your sh0 panel, on its domain once you have set one, otherwise on port 9000 of the server. Every path starts with /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:

Terminal
export SH0_TOKEN="sh0_..."
Warning
Treat the key like a password: keep it in a secret store or an environment variable, never in a repository. Revoke it from Settings → API Keys as soon as it may have leaked.

Step 2: List Your Apps

List your applications. Any access level can do this:

Terminal
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:

Terminal
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:

Success Format
{
  "data": { ... }
}

List responses with pagination:

List Format
{
  "data": [ ... ],
  "total": 42,
  "page": 1,
  "per_page": 20,
  "pages": 3
}

Error responses:

Error Format
{
  "error": {
    "code": "NOT_FOUND",
    "message": "App with id 'app_xyz' not found"
  }
}

Pagination

List endpoints support pagination with two query parameters:

ParameterDefaultDescription
page1Page number (1-indexed)
per_page20Items per page (max 100)
Terminal
# 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:

StatusMeaning
200Success
201Resource created
400Bad request (invalid parameters)
401Unauthorized (missing or invalid token)
403Forbidden (insufficient permissions)
404Resource not found
409Conflict (duplicate name, etc.)
422Validation error
429Rate limited
500Internal server error
Tip
Always check the 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:

sh0 API explorer showing available endpoint categories