API Reference
REST API for programmatic deployment and management.
Authentication
All API requests require a Bearer token. Create tokens in your dashboard at gethatch.eu/dashboard/tokens.
Authorization: Bearer <your-api-token>Base URL
https://api.hatch.sh/v1POST /deploy
Trigger a new deployment for an existing app. Typically deployments are triggered by git push hatch main, but you can also trigger them via the API.
POST https://api.hatch.sh/v1/deploy
Authorization: Bearer <token>
Content-Type: application/json
{
"project": "myapp",
"branch": "main",
"env": {
"DATABASE_URL": "postgres://...",
"API_KEY": "sk-..."
}
}Response:
{
"id": "deploy_abc123",
"status": "building",
"url": "https://my-app.hatch.sh",
"preview_url": "https://my-app-abc123.hatch.sh",
"created_at": "2025-01-15T10:30:00Z"
}GET /deployments
List all deployments for your account.
GET https://api.hatch.sh/v1/deployments
Authorization: Bearer <token>Query parameters:
projectFilter by project namestatusFilter by status: building, live, failedlimitNumber of results (default: 20, max: 100)GET /deployments/:id
Get details of a specific deployment.
GET https://api.hatch.sh/v1/deployments/deploy_abc123
Authorization: Bearer <token>DELETE /deployments/:id
Delete a deployment and remove it from your project.
DELETE https://api.hatch.sh/v1/deployments/deploy_abc123
Authorization: Bearer <token>GET /deployments/:id/logs
Retrieve build and runtime logs for a deployment.
GET https://api.hatch.sh/v1/deployments/deploy_abc123/logs
Authorization: Bearer <token>Query parameters:
typebuild or runtime (default: both)sinceISO 8601 timestamp to filter logs after