Last Updated: 2026-01-26
The full OpenAPI specs are maintained in the muxi repository:
- Server API:
muxi/schemas/api/server-api-v1.yaml - Formation API:
muxi/schemas/api/formation-api-v1.yaml
This document covers CLI-specific implementation details.
| Item | Value |
|---|---|
| Default Port | 7890 |
| Auth Type | HMAC-SHA256 |
| Management API | /rpc/* |
| Formation Proxy | /api/{id}/* |
| File | Purpose |
|---|---|
~/.muxi/profiles.yaml |
Server profiles |
~/.muxi/server/credentials.json |
Auto-generated local credentials |
~/.muxi/server/config.yaml |
Server configuration |
All /rpc/* endpoints require HMAC authentication.
func GenerateHMACSignature(keyID, secretKey, method, path, timestamp, body string) string {
// Build canonical string
canonical := fmt.Sprintf("%s\n%s\n%s\n%s", method, path, timestamp, body)
// HMAC-SHA256
mac := hmac.New(sha256.New, []byte(secretKey))
mac.Write([]byte(canonical))
signature := base64.StdEncoding.EncodeToString(mac.Sum(nil))
return signature
}headers := map[string]string{
"X-MUXI-Key-ID": keyID,
"X-MUXI-Timestamp": timestamp, // RFC3339 format
"X-MUXI-Signature": signature,
"Content-Type": "application/json",
}# Generate timestamp
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
# Test HMAC auth
curl -X GET http://localhost:7890/rpc/formations \
-H "X-MUXI-Key-ID: $KEY_ID" \
-H "X-MUXI-Timestamp: $TIMESTAMP" \
-H "X-MUXI-Signature: $SIGNATURE"GET /health → {"status": "healthy"}
GET /ping → {"message": "pong"}
| Method | Endpoint | Description |
|---|---|---|
| POST | /rpc/formations/deploy |
Deploy new formation |
| GET | /rpc/formations |
List formations |
| GET | /rpc/formations/{id} |
Get formation details |
| PUT | /rpc/formations/{id} |
Update formation |
| DELETE | /rpc/formations/{id} |
Delete formation |
| POST | /rpc/formations/{id}/stop |
Stop formation |
| POST | /rpc/formations/{id}/start |
Start formation |
| POST | /rpc/formations/{id}/restart |
Restart formation |
| POST | /rpc/formations/{id}/rollback |
Rollback version |
| GET | /rpc/formations/{id}/logs |
Get logs |
| GET | /rpc/formations/{id}/download |
Download as zip (?db=true includes memory.db) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /rpc/server/status |
Server status |
| GET | /rpc/server/logs |
Audit logs |
Deploy, start, restart, and rollback operations support SSE streaming for real-time progress.
POST /rpc/formations/deploy
Accept: text/event-stream
event: progress
data: {"stage":"extracting","message":"Extracting bundle..."}
event: progress
data: {"stage":"validating","message":"Validating formation.yaml"}
event: progress
data: {"stage":"downloading_sif","message":"Downloading runtime","progress":45.5}
event: complete
data: {"formation_id":"my-app","status":"running","port":8001}
Deploy (new):
extracting- Extracting bundlevalidating- Validating formation.yamlresolving_runtime- Resolving runtime versiondownloading_sif- Downloading SIF (with progress %)pulling_runner- Pulling Docker imagespawning- Starting processhealth_check- Health check (with countdown)
Update (existing):
extracting- Extract to stagingvalidating- Validate formationresolving_runtime- Resolve runtimedownloading_sif- Download SIFpulling_runner- Pull runnerspawning_staging- Start staging versionhealth_check- Staging health checkswapping- Atomic switchstopping_old- Stop old version
Local server credentials (~/.muxi/server/credentials.json):
{
"key_id": "MUXI_LOCAL_abc123",
"secret_key": "base64-encoded-secret-key",
"server_id": "hostname-sha256hash",
"created_at": "2025-10-24T12:00:00Z"
}CLI auto-reads this for localhost profile.
{
"error": {
"code": "FORMATION_NOT_FOUND",
"message": "Formation 'my-app' not found",
"details": {}
}
}| Code | HTTP | Description |
|---|---|---|
UNAUTHORIZED |
401 | Invalid HMAC signature |
FORBIDDEN |
403 | Insufficient permissions |
FORMATION_NOT_FOUND |
404 | Formation doesn't exist |
FORMATION_ALREADY_EXISTS |
409 | Formation ID taken |
FORMATION_NOT_RUNNING |
409 | Can't stop stopped formation |
VERSION_NOT_HIGHER |
409 | Update requires higher version |
# Check server health (no auth)
curl http://localhost:7890/health
# Test with wrong auth (should return 401)
curl -X GET http://localhost:7890/rpc/formations \
-H "X-MUXI-Key-ID: wrong" \
-H "X-MUXI-Timestamp: $(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
-H "X-MUXI-Signature: wrong"- architecture.md - CLI architecture
- streaming-events.md - SSE event types