The Cloud implements a secure, multi-tenant authentication system using API Keys. This ensures resource isolation, meaning users can only access resources (instances, VPCs, volumes, etc.) that they have created.
Before using the API, you must register a new account.
POST /auth/register
{
"email": "user@example.com",
"password": "securepassword123",
"name": "John Doe"
}{
"message": "user created successfully",
"user_id": "550e8400-e29b-41d4-a716-446655440000"
}After registering, log in to obtain your API Key. This key must be included in all subsequent API requests.
POST /auth/login
{
"email": "user@example.com",
"password": "securepassword123"
}{
"token": "apk_123456789...",
"expires_in": 86400
}Note: The token field contains your API Key.
All protected API endpoints require the X-API-Key header.
X-API-Key: apk_123456789...
curl -H "X-API-Key: apk_123456789..." http://localhost:8080/instancesIf the key is missing or invalid, the API will return 401 Unauthorized.
For WebSocket connections (e.g., real-time metrics), the API Key is passed as a query parameter.
ws://localhost:8080/ws?api_key=apk_123456789...
You can list and manage your keys via the /auth/keys endpoints.
- List Keys:
GET /auth/keys - Revoke Key:
DELETE /auth/keys/:id - Rotate Key:
POST /auth/keys/rotate
- Keep your API Key secret: Do not commit it to version control or share it publicly.
- Use HTTPS: In production, ensure all API traffic is encrypted.
- Rotate Keys Regularly: Periodically rotate your keys using the rotation endpoint to minimize risk.
- Revoke Immediately: If a key is compromised, revoke it immediately via the API.