This document provides comprehensive documentation for all API endpoints available in the Container Engine platform. The backend is built with Rust and the Axum framework, providing high-performance and memory-safe container orchestration.
http://localhost:3000
For production deployment: Replace with your actual domain.
Domain Suffix: vinhomes.co.uk (configured in environment)
All API endpoints (except registration and login) require authentication via API key in the Authorization header:
Authorization: Bearer <your-api-key>Register a new user account.
Endpoint: POST /v1/auth/register
Headers:
Content-Type: application/jsonRequest Body:
{
"username": "string",
"email": "string",
"password": "string",
"confirm_password": "string"
}Response (201 Created):
{
"access_token": "string",
"refresh_token": "string",
"expires_at": "2025-01-01T01:00:00Z",
"user": {
"id": "uuid",
"username": "string",
"email": "string"
}
}Error Responses:
400 Bad Request: Invalid input data409 Conflict: Username or email already exists
Authenticate a user and receive an access token.
Endpoint: POST /v1/auth/login
Headers:
Content-Type: application/jsonRequest Body:
{
"email": "string",
"password": "string"
}Response (200 OK):
{
"access_token": "string",
"refresh_token": "string",
"expires_at": "2025-01-01T01:00:00Z",
"user": {
"id": "uuid",
"username": "string",
"email": "string"
}
}Error Responses:
401 Unauthorized: Invalid credentials404 Not Found: User not found
Refresh an expired access token.
Endpoint: POST /v1/auth/refresh
Headers:
Content-Type: application/jsonRequest Body:
{
"refresh_token": "string"
}Response (200 OK):
{
"access_token": "string",
"expires_at": "2025-01-01T01:00:00Z"
}Invalidate user session and tokens.
Endpoint: POST /v1/auth/logout
Headers:
Authorization: Bearer <access-token>Response (200 OK):
{
"message": "Successfully logged out"
}Request a password reset link.
Endpoint: POST /v1/auth/forgot-password
Headers:
Content-Type: application/jsonRequest Body:
{
"email": "string"
}Response (200 OK):
{
"message": "If an account with that email exists, a password reset link has been sent."
}Reset password using a token.
Endpoint: POST /v1/auth/reset-password
Headers:
Content-Type: application/jsonRequest Body:
{
"token": "string",
"new_password": "string"
}Response (200 OK):
{
"message": "Password reset successfully"
}Generate a new API key for programmatic access.
Endpoint: POST /v1/api-keys
Headers:
Authorization: Bearer <access-token>
Content-Type: application/jsonRequest Body:
{
"name": "string",
"description": "string"
}Response (201 Created):
{
"id": "uuid",
"name": "string",
"key": "ce_dev_1234567890abcdef...",
"created_at": "2025-01-01T00:00:00Z"
}Get all API keys for the authenticated user.
Endpoint: GET /v1/api-keys
Headers:
Authorization: Bearer <access-token>Query Parameters:
page(optional): Page number (default: 1)limit(optional): Items per page (default: 10, max: 100)
Response (200 OK):
{
"api_keys": [
{
"id": "uuid",
"name": "string",
"description": "string",
"key_prefix": "ce_dev_",
"created_at": "2025-01-01T00:00:00Z",
"expires_at": "2025-12-31T23:59:59Z",
"last_used": "2025-01-01T12:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 1,
"total_pages": 1
}
}Revoke an API key (cannot be undone).
Endpoint: DELETE /v1/api-keys/{keyId}
Headers:
Authorization: Bearer <access-token>Response (200 OK):
{
"message": "API key revoked successfully"
}Get the authenticated user's profile information.
Endpoint: GET /v1/user/profile
Headers:
Authorization: Bearer <access-token>Response (200 OK):
{
"id": "uuid",
"username": "string",
"email": "string",
"created_at": "2025-01-01T00:00:00Z",
"last_login": "2025-01-01T12:00:00Z",
"is_active": true
}Update user profile information.
Endpoint: PUT /v1/user/profile
Headers:
Authorization: Bearer <access-token>
Content-Type: application/jsonRequest Body:
{
"username": "string", // optional
"email": "string" // optional
}Response (200 OK):
{
"id": "uuid",
"username": "string",
"email": "string",
"updated_at": "2025-01-01T12:00:00Z"
}Change user password.
Endpoint: PUT /v1/user/password
Headers:
Authorization: Bearer <access-token>
Content-Type: application/jsonRequest Body:
{
"current_password": "string",
"new_password": "string",
"confirm_new_password": "string"
}Response (200 OK):
{
"message": "Password updated successfully"
}Deploy a new container application.
Endpoint: POST /v1/deployments
Headers:
Authorization: Bearer <api-key>
Content-Type: application/jsonRequest Body:
{
"app_name": "string",
"image": "string",
"port": 80,
"env_vars": {
"ENV_VAR_NAME": "value"
},
"replicas": 1,
"resources": {
"cpu": "100m",
"memory": "128Mi"
},
"health_check": {
"path": "/health",
"initial_delay_seconds": 30,
"period_seconds": 10,
"timeout_seconds": 5,
"failure_threshold": 3
},
"registry_auth": {
"username": "string",
"password": "string"
}
}Response (201 Created):
{
"id": "uuid",
"app_name": "string",
"image": "string",
"status": "pending",
"url": null,
"created_at": "2025-01-01T00:00:00Z",
"message": "Deployment is being processed"
}Error Responses:
400 Bad Request: Invalid deployment configuration409 Conflict: App name already exists422 Unprocessable Entity: Invalid image or registry access
Get all deployments for the authenticated user.
Endpoint: GET /v1/deployments
Headers:
Authorization: Bearer <api-key>Query Parameters:
page(optional): Page number (default: 1)limit(optional): Items per page (default: 10, max: 100)status(optional): Filter by status (pending, running, stopped, failed)
Response (200 OK):
{
"deployments": [
{
"id": "uuid",
"app_name": "string",
"image": "string",
"status": "running",
"url": "https://app-name.vinhomes.co.uk",
"replicas": 1,
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-01T00:05:00Z"
}
],
"pagination": {
"page": 1,
"limit": 10,
"total": 1,
"total_pages": 1
}
}Get detailed information about a specific deployment.
Endpoint: GET /v1/deployments/{deploymentId}
Headers:
Authorization: Bearer <api-key>Response (200 OK):
{
"id": "uuid",
"user_id": "uuid",
"app_name": "string",
"image": "string",
"status": "running",
"url": "https://app-name.vinhomes.co.uk",
"port": 80,
"env_vars": {
"ENV_VAR_NAME": "value"
},
"replicas": 1,
"resources": {
"cpu": "100m",
"memory": "128Mi"
},
"health_check": {
"path": "/health",
"initial_delay_seconds": 30,
"period_seconds": 10,
"timeout_seconds": 5,
"failure_threshold": 3
},
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-01T00:05:00Z",
"deployed_at": "2025-01-01T00:05:00Z",
"error_message": null
}Update an existing deployment.
Endpoint: PUT /v1/deployments/{deploymentId}
Headers:
Authorization: Bearer <api-key>
Content-Type: application/jsonRequest Body:
{
"image": "string",
"env_vars": {
"ENV_VAR_NAME": "new_value"
},
"replicas": 2,
"resources": {
"cpu": "200m",
"memory": "256Mi"
}
}Response (200 OK):
{
"id": "uuid",
"status": "updating",
"message": "Deployment update in progress",
"updated_at": "2025-01-01T12:00:00Z"
}Scale the number of replicas for a deployment.
Endpoint: PATCH /v1/deployments/{deploymentId}/scale
Headers:
Authorization: Bearer <api-key>
Content-Type: application/jsonRequest Body:
{
"replicas": 5
}Response (200 OK):
{
"id": "uuid",
"replicas": 5,
"status": "running",
"message": "Deployment scaled successfully"
}Stop a running deployment.
Endpoint: POST /v1/deployments/{deploymentId}/stop
Headers:
Authorization: Bearer <api-key>Response (200 OK):
{
"id": "uuid",
"status": "stopped",
"message": "Deployment stopped successfully"
}Start a stopped deployment.
Endpoint: POST /v1/deployments/{deploymentId}/start
Headers:
Authorization: Bearer <api-key>Response (200 OK):
{
"id": "uuid",
"status": "running",
"replicas": 1,
"message": "Deployment started successfully"
}Permanently delete a deployment.
Endpoint: DELETE /v1/deployments/{deploymentId}
Headers:
Authorization: Bearer <api-key>Response (200 OK):
{
"message": "Deployment deleted successfully",
"deployment_id": "uuid",
"app_name": "string",
"namespace_deleted": true
}Map a custom domain to a deployment.
Endpoint: POST /v1/deployments/{deploymentId}/domains
Headers:
Authorization: Bearer <api-key>
Content-Type: application/jsonRequest Body:
{
"domain": "myapp.example.com"
}Response (500 Internal Server Error):
{
"error": {
"message": "Domain management not yet implemented"
}
}Get all custom domains for a deployment.
Endpoint: GET /v1/deployments/{deploymentId}/domains
Headers:
Authorization: Bearer <api-key>Response (200 OK):
{
"domains": []
}Remove a custom domain from a deployment.
Endpoint: DELETE /v1/deployments/{deploymentId}/domains/{domainId}
Headers:
Authorization: Bearer <api-key>Response (500 Internal Server Error):
{
"error": {
"message": "Domain management not yet implemented"
}
}Stream or fetch logs for a deployment.
Endpoint: GET /v1/deployments/{deploymentId}/logs
Headers:
Authorization: Bearer <api-key>Query Parameters:
tail(optional): Number of lines to return from the end (default: 100)follow(optional): Stream logs in real-time (default: false)
Response (200 OK):
{
"logs": [
{
"timestamp": "2025-01-01T12:00:00Z",
"level": "info",
"message": "Application started successfully",
"source": "app"
}
]
}WebSocket Endpoint for Real-time Logs:
ws://localhost:3000/v1/deployments/{deploymentId}/logs/stream
Get performance metrics for a deployment.
Endpoint: GET /v1/deployments/{deploymentId}/metrics
Headers:
Authorization: Bearer <api-key>Response (200 OK):
{
"metrics": {}
}Note: Metrics implementation is currently a stub.
Get the current status and health of a deployment.
Endpoint: GET /v1/deployments/{deploymentId}/status
Headers:
Authorization: Bearer <api-key>Response (200 OK):
{
"status": "running",
"health": "healthy",
"replicas": {
"desired": 2,
"ready": 2,
"available": 2
},
"last_health_check": "2025-01-01T12:00:00Z",
"uptime": "0s",
"restart_count": 0
}Check the overall health of the Container Engine API.
Endpoint: GET /health
Response (200 OK):
{
"status": "healthy",
"service": "container-engine",
"version": "0.1.0"
}Real-time notifications are available via WebSocket connection:
Connection URL:
ws://localhost:3000/v1/ws/notifications
Health Check URL:
ws://localhost:3000/v1/ws/health
Authentication: Include Authorization header with Bearer token when connecting.
Event Format:
{
"type": "deployment_status_changed",
"deployment_id": "uuid",
"timestamp": "2025-01-01T12:00:00Z",
"data": {
"status": "running",
"url": "https://app-name.vinhomes.co.uk"
}
}Trigger a test notification (for development).
Endpoint: GET /v1/notifications/test
Headers:
Authorization: Bearer <api-key>Get notification system statistics.
Endpoint: GET /v1/notifications/stats
Headers:
Authorization: Bearer <api-key>All API endpoints return consistent error responses:
Error Response Format:
{
"error": {
"message": "string",
"details": "string"
}
}Common HTTP Status Codes:
400 Bad Request: Invalid request parameters401 Unauthorized: Missing or invalid authentication403 Forbidden: Insufficient permissions404 Not Found: Resource not found409 Conflict: Resource conflict (e.g., duplicate app name)422 Unprocessable Entity: Invalid data format500 Internal Server Error: Server error
The API uses the following environment variables:
Required:
DATABASE_URL: PostgreSQL connection stringREDIS_URL: Redis connection stringJWT_SECRET: Secret key for JWT tokens
Optional:
PORT: Server port (default: 3000)DOMAIN_SUFFIX: Domain suffix for deployments (default: vinhomes.co.uk)WEBHOOK_URL: Webhook URL for deployment eventsKUBECONFIG_PATH: Path to Kubernetes config fileKUBERNETES_NAMESPACE: Default Kubernetes namespace
Email Configuration (Optional):
AWS_SES_SMTP_HOST: SMTP host for email serviceAWS_SES_SMTP_PORT: SMTP port (default: 587)AWS_SES_USERNAME: SMTP usernameAWS_SES_PASSWORD: SMTP passwordEMAIL_FROM: From email addressEMAIL_FROM_NAME: From email name
When enabled, the API sends webhook notifications for deployment events to the configured WEBHOOK_URL.
Webhook Payload:
{
"deployment_id": "uuid",
"status": "completed|failed|started",
"type": "deployment_completed|deployment_failed|deployment_started",
"timestamp": "2025-01-01T12:00:00Z",
"app_name": "string",
"user_id": "uuid",
"url": "https://app-name.vinhomes.co.uk"
}