Skip to content

Deployments API

List Deployments

GET /api/v1/deployments
Authorization: Bearer <token>

Response:

[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "My API",
"subdomain": "api",
"repo_url": "https://github.com/user/repo.git",
"branch": "main",
"dockerfile_path": "Dockerfile",
"status": "running",
"source_type": "git",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:00:00Z"
}
]

Get Deployment

GET /api/v1/deployments/{id}
Authorization: Bearer <token>

Response:

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "My API",
"subdomain": "api",
"repo_url": "https://github.com/user/repo.git",
"branch": "main",
"dockerfile_path": "Dockerfile",
"status": "running",
"source_type": "git",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:00:00Z"
}

Create Deployment

Git Deployment

POST /api/v1/deployments
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "My API",
"subdomain": "api",
"repo_url": "https://github.com/user/repo.git",
"branch": "main",
"dockerfile_path": "Dockerfile"
}

Archive Deployment

POST /api/v1/deployments
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "My App",
"subdomain": "myapp",
"source_type": "archive",
"dockerfile_path": "Dockerfile"
}

Response:

{
"id": "660e8400-e29b-41d4-a716-446655440000",
"name": "My App",
"subdomain": "myapp",
"status": "pending",
"source_type": "archive",
"created_at": "2024-01-25T10:00:00Z",
"updated_at": "2024-01-25T10:00:00Z"
}

Upload Source (Archive Deployments)

POST /api/v1/deployments/{id}/upload
Authorization: Bearer <token>
Content-Type: multipart/form-data
archive: <file.tar.gz>
dockerfile: <optional Dockerfile content>

Response:

{
"status": "uploaded",
"size": 1234567
}

Trigger Deploy

POST /api/v1/deployments/{id}/deploy
Authorization: Bearer <token>

Response:

{
"id": "770e8400-e29b-41d4-a716-446655440000",
"deployment_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "building",
"commit_sha": "abc123def456",
"started_at": "2024-01-25T10:00:00Z",
"finished_at": null
}

Stop Deployment

POST /api/v1/deployments/{id}/stop
Authorization: Bearer <token>

Response:

{
"message": "Deployment stopped"
}

Restart Deployment

POST /api/v1/deployments/{id}/restart
Authorization: Bearer <token>

Response:

{
"message": "Deployment restarted"
}

Delete Deployment

DELETE /api/v1/deployments/{id}
Authorization: Bearer <token>

Response:

HTTP/1.1 204 No Content

Rollback Deployment

POST /api/v1/deployments/{id}/rollback
Authorization: Bearer <token>
Content-Type: application/json
{
"build_id": "770e8400-e29b-41d4-a716-446655440000"
}

Response:

{
"message": "Rolled back to build 770e8400..."
}

Deployment Status Values

StatusDescription
pendingCreated, never deployed
buildingBuild in progress
runningContainer running
stoppedContainer stopped
failedBuild or startup failed

Error Responses

Subdomain Taken

HTTP/1.1 400 Bad Request
{
"error": "subdomain_taken",
"message": "Subdomain 'api' is already in use"
}

Deployment Not Found

HTTP/1.1 404 Not Found
{
"error": "not_found",
"message": "Deployment not found"
}

Build Failed

HTTP/1.1 500 Internal Server Error
{
"error": "build_failed",
"message": "Docker build failed: npm ERR! Missing script: build"
}