REST API Reference Guide
This document describes the REST API endpoints exposed by the PowerMind ComputeAI Controller. This API can be integrated into custom dashboard applications, automated CI/CD runners, or scripts.
1. API Base & Interactive Documentation
- API Base Path:
https://<computeai-controller-host>/api - OpenAPI JSON Spec:
https://<computeai-controller-host>/api/swagger.json - Interactive Swagger UI:
https://<computeai-controller-host>/api/docs
2. Authentication Models
The client API uses two authentication mechanisms depending on the route category:
2.1 JSON Web Token (JWT)
Most platform management operations (files, jobs, deployments) require a Bearer token in the request header:
* Header name: Authorization
* Value format: Bearer <JWT_TOKEN>
2.2 Inference Key
Executing live model inference uses a deployment-scoped API access key:
* Header name: X-API-Key
* Value format: sk_xxxxxxxxxxxxxxxx
3. Route Reference Table
3.1 Authentication & Sessions
| Method | Endpoint Path | Authentication | Description |
|---|---|---|---|
| POST | /api/auth/register |
Public | Register a new user account |
| POST | /api/auth/login |
Public | Login and fetch JWT token |
| GET | /api/auth/sessions |
JWT | List active login sessions |
| DELETE | /api/auth/sessions/<uuid:session_id> |
JWT | Terminate/revoke a specific login session |
3.2 User & Quota Management (Admin Only)
| Method | Endpoint Path | Authentication | Description |
|---|---|---|---|
| GET | /api/users |
JWT (Admin) | List all registered user profiles and quotas |
| POST | /api/users/create |
JWT (Admin) | Create a new user account with quotas |
| GET | /api/users/me |
JWT | Retrieve current user's profile and active quotas |
| POST | /api/users/<username>/password |
JWT | Reset password for a user |
| DELETE | /api/users/<username> |
JWT (Admin) | Delete a user account |
| POST | /api/users/<username>/toggle |
JWT (Admin) | Enable or disable user account access |
| GET | /api/users/default-quotas |
JWT (Admin) | Retrieve global default quotas |
| PUT | /api/users/default-quotas |
JWT (Admin) | Update global default quotas |
| PUT | /api/users/<username>/limits |
JWT (Admin) | Customize quotas/limits for a specific user |
| GET | /api/admin/audit-logs |
JWT (Admin) | Retrieve administrator audit logs |
3.3 Dataset & File Workspace
| Method | Endpoint Path | Authentication | Description |
|---|---|---|---|
| POST | /api/files/upload |
JWT | Upload a file to the workspace (supports --extract flag) |
| GET | /api/files/list |
JWT | List files in user workspace (supports type filter) |
| GET | /api/files/<uuid:file_id>/download |
JWT | Download workspace file by Database ID |
| DELETE | /api/files/<uuid:file_id> |
JWT | Delete a file |
| GET | /api/workspace/browse |
JWT | Browse folders and files recursively |
| GET | /api/files/download/path |
JWT | Download file via workspace relative path |
3.4 Job & Training Execution
| Method | Endpoint Path | Authentication | Description |
|---|---|---|---|
| POST | /api/jobs/submit |
JWT | Submit a new Python training run |
| GET | /api/jobs |
JWT | List training runs (supports optional status filter) |
| GET | /api/jobs/<uuid:job_id> |
JWT | Fetch detailed job metadata & metrics |
| GET | /api/jobs/<uuid:job_id>/logs |
JWT | Get stdout/stderr terminal log strings |
| GET | /api/jobs/<uuid:job_id>/checkpoints |
JWT | List checkpoints created for the job |
| POST | /api/jobs/<uuid:job_id>/cancel |
JWT | Cancel executing job |
| POST | /api/jobs/<uuid:job_id>/resume |
JWT | Resume failed/cancelled run |
| DELETE | /api/jobs/<uuid:job_id> |
JWT | Delete a job record |
3.5 Model serving & Deployment
| Method | Endpoint Path | Authentication | Description |
|---|---|---|---|
| GET | /api/models |
JWT | List registered models |
| POST | /api/models/upload |
JWT | Register model weights |
| DELETE | /api/models/<string:model_name>/<version> |
JWT | Delete model by name and version |
| POST | /api/models/<uuid:model_id>/deploy |
JWT | Create model serving deployment |
| GET | /api/deployments |
JWT | List active model serving deployments |
| GET | /api/deployments/<uuid:deployment_id>/status |
JWT | Get live status/health of a serving deployment |
| POST | /api/deployments/<uuid:deploymentid>/stop |
JWT | Pause a model serving endpoint (Note: no underscore) |
| POST | /api/deployments/<uuid:deployment_id>/start |
JWT | Start a paused serving endpoint (Note: has underscore) |
| DELETE | /api/deployments/<uuid:deployment_id> |
JWT | Delete a deployment |
| POST | /api/deployments/<uuid:deployment_id>/keys |
JWT | Create API inference key |
| GET | /api/deployments/<uuid:deployment_id>/keys |
JWT | List inference keys |
| POST | /api/keys/<uuid:key_id>/revoke |
JWT | Revoke an inference key |
| POST | /api/infer/<deployment_name> |
Inference Key | Request prediction from model |
3.6 Monitoring & System Health
| Method | Endpoint Path | Authentication | Description |
|---|---|---|---|
| GET | /api/monitoring/dashboard |
JWT | Get active jobs stats & resource slots utilization |
| GET | /api/monitoring/history |
JWT | Get historic cluster CPU/GPU records |
| GET | /api/health |
Public | Retrieve API Controller health status |
| GET | /metrics |
Public | Prometheus exporter metrics |
4. Key Endpoint Specifications
4.1 Login (POST /api/auth/login)
Request Body:
Response (200 OK):{
"token": "eyJhbGciOi...",
"user": {
"username": "alice",
"email": "alice@example.com",
"role": "user"
}
}
4.2 Submit Job (POST /api/jobs/submit)
Submits a Python training run. The script code is passed directly as a string in the "code" field (no pre-upload step required).
Request Body:
{
"name": "digits_mnist",
"framework": "pytorch",
"resource_type": "gpu",
"distributed": false,
"num_nodes": 1,
"checkpoint_interval": 5,
"code": "import torch\nprint('Starting training loop...')"
}
{
"job_id": "8a2d1f99-c1d0-42cf-961d-85068cc4adcf",
"model_name": "digits_mnist",
"framework": "pytorch",
"status": "submitted"
}
4.3 Upload Model (POST /api/models/upload)
Used to register BYOB (bring-your-own-model) pre-trained weights. Requires multipart/form-data encoding.
Form Fields:
* model_file: Binary file upload (e.g. .onnx, .pt, .h5).
* model_name: String display name.
* version: Integer string (e.g. "1").
* input_shape: JSON array string (e.g. "[[-1, 784]]").
* output_shape: JSON array string (e.g. "[[-1, 10]]").
* input_dtype (optional): JSON array of types, e.g. '["FP32"]'. Default: ["FP32"].
* output_dtype (optional): JSON array of types, e.g. '["FP32"]'. Default: ["FP32"].
* input_names (optional): JSON array of custom input tensor names, e.g. '["input_ids"]'. Default: ["INPUT__0"].
* output_names (optional): JSON array of custom output tensor names. Default: ["OUTPUT__0"].
4.4 Model Inference (POST /api/infer/{deployment_name})
Executes real-time inference against an active model serving deployment.
Authentication
- Header:
X-API-Key: sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Header:
Content-Type: application/json
Request Payload Structure
The JSON payload must include an "inputs" object mapping each expected input tensor name to its data matrix:
Tensor Naming & Multi-Input Models
- Default Names: If the model was uploaded without custom tensor names, inputs are indexed as
INPUT__0,INPUT__1, etc. - Custom Names: If custom input names were specified during model registration (e.g.
image_input,text_embeddings), use those exact keys in theinputsobject. - Multi-Input Example:
Supported Data Types & Conversions
The serving engine automatically casts JSON numerical arrays to the configured tensor precision:
| Data Type | Triton Type | Python / NumPy Precision | Description |
|---|---|---|---|
FP32 |
TYPE_FP32 |
np.float32 |
Standard 32-bit single-precision floating point (default). |
FP16 |
TYPE_FP16 |
np.float16 |
16-bit half-precision floating point. |
FP64 |
TYPE_FP64 |
np.float64 |
64-bit double-precision floating point. |
INT32 |
TYPE_INT32 |
np.int32 |
32-bit signed integer. |
INT64 |
TYPE_INT64 |
np.int64 |
64-bit signed integer (common for token IDs). |
UINT8 |
TYPE_UINT8 |
np.uint8 |
8-bit unsigned integer (common for image pixels). |
BOOL |
TYPE_BOOL |
np.bool_ |
Boolean (true / false). |
Batching & Dimension Rules
- The outer dimension represents the Batch Dimension (e.g.,
batch_size = 1for single sample[[...]],batch_size = Nfor[[...], [...]]). - If the model defines shape
[[-1, 784]], the-1allows dynamic batch sizes up to the deployment's configuredbatch_size_limit(default:256). - Fixed dimensions (e.g.,
784) must match the exact number of elements per row.
Response Payload (200 OK)
{
"model_name": "digits_mnist",
"model_version": "1",
"outputs": [
{
"name": "OUTPUT__0",
"datatype": "FP32",
"shape": [1, 10],
"data": [0.001, 0.002, 0.985, 0.003, 0.001, 0.002, 0.001, 0.002, 0.002, 0.001]
}
]
}
5. Standard Status Codes & Error Resolution
| HTTP Status | Meaning | Typical Trigger | Recommended Fix |
|---|---|---|---|
200 OK |
Success | Query returned data or inference prediction succeeded. | Proceed with response data. |
201 Created |
Created | Job submitted, file uploaded, or key created. | Record resource ID from payload. |
202 Accepted |
Queued | Async deployment operation accepted. | Poll /api/deployments/<ID>/status for live state. |
400 Bad Request |
Validation Error | Missing "inputs", rank mismatch, or batch size exceeded. |
Check that input tensor dimensions, types, and keys match model metadata. |
401 Unauthorized |
Auth Missing | Expired JWT token or missing Authorization header. |
Re-authenticate via /api/auth/login. |
403 Forbidden |
Access Denied | API key is invalid for this deployment, or non-admin user accessed admin route. | Verify key ID was generated for this specific deployment. |
404 Not Found |
Resource Missing | Target Job ID, Deployment name, or File ID does not exist. | Verify resource ID / deployment name. |
409 Conflict |
Conflict | Duplicate username, existing active deployment name. | Use a distinct name or delete existing resource. |
500 Internal Error |
Engine Error | Serving engine inference execution error or worker failure. | Inspect deployment logs or worker health. |