REST API Reference

Deploy and manage containers programmatically with the SnapDeploy API.

Authentication

All API requests require authentication using an API key. Get your API key from the dashboard.

Authentication Methods

Header (Recommended):

X-API-Key: your-api-key

Authorization Header:

Authorization: ApiKey your-api-key

Query Parameter (not recommended for production):

?api_key=your-api-key

Base URL

https://snapdeploy.dev/api

Containers

GET /api/containers

List all containers for the authenticated user.

Response:

[
  {
    "containerId": "abc123",
    "containerName": "my-app",
    "status": "RUNNING",
    "imageName": "nginx:latest",
    "port": 80,
    "url": "https://my-app.containers.snapdeploy.dev",
    "createdAt": "2025-01-15T10:30:00Z"
  }
]
GET /api/containers/{containerId}

Get details of a specific container.

POST /api/containers/deploy

Deploy a new container from a Docker image.

Request Body:

{
  "containerName": "my-app",
  "imageName": "nginx:latest",
  "port": 80,
  "cpu": 256,
  "memory": 512,
  "environmentVariables": {
    "NODE_ENV": "production"
  }
}
POST /api/containers/{containerId}/start

Start a stopped container.

POST /api/containers/{containerId}/stop

Stop a running container.

POST /api/containers/{containerId}/restart

Restart a container.

DELETE /api/containers/{containerId}

Delete a container.

Deployments

POST /api/deployments/github

Deploy from a GitHub repository.

Request Body:

{
  "containerId": "abc123",
  "repoUrl": "https://github.com/user/repo",
  "branch": "main",
  "rootDirectory": "/",
  "port": 3000
}
GET /api/deployments/{deploymentId}

Get deployment status and details.

GET /api/deployments?containerId={containerId}

List deployment history for a container.

Error Codes

Code Description
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid or missing API key
403 Forbidden - Insufficient permissions
404 Not Found - Resource doesn't exist
429 Rate Limited - Too many requests
500 Internal Server Error