Skip to main content

ML Engine API

Complete API reference for predictions, batch processing, and model management.

Base URL

https://[your-app].azurecontainerapps.io

Replace [your-app] with your Azure Container App name.


Authentication

Pay-As-You-Go: No authentication (runs in your private network)
BYOL: License key via environment variable

Network Security:

  • Deploy in your VNet
  • Configure ingress rules
  • Use API Gateway for external access

Endpoints

Health Check

GET /v1/health

Response:

{
"status": "healthy",
"version": "1.0.0",
"models_loaded": true,
"uptime_seconds": 3847.2
}

Single Prediction

POST /v1/predict
Content-Type: application/json

Request:

{
"vehicleId": "TRUCK-001",
"timestamp": "2026-01-12T10:00:00Z",
"coolant": 95.5,
"engineOilTemp": 102.3,
"vehicleSpeed": 65.0,
"engine_speed": 2100,
"battery_voltage": 13.8,
"fuel_level": 75.0,
"obdDistance": 45000,
"mil_lamp": "LAMP_OFF"
}

Response:

{
"vehicleId": "TRUCK-001",
"timestamp": "2026-01-12T10:00:00Z",
"processingTimeMs": 42.5,
"predictions": {
"healthScore": 87.5,
"maintenanceNeeded": false,
"maintenanceProbability": 0.12,
"remainingUsefulLife": {
"engine": 180,
"brakes": 120,
"battery": 240
},
"anomalyScore": 0.08,
"anomalyDetected": false
},
"alerts": [],
"insights": [
"Vehicle performing normally",
"Oil change due in 45 days"
]
}

Batch Prediction

POST /v1/predict/batch
Content-Type: application/json

Request:

{
"vehicles": [
{"vehicleId": "V001", "coolant": 95.5, ...},
{"vehicleId": "V002", "coolant": 98.0, ...}
]
}

Limit: 1,000 vehicles per request

Response:

{
"count": 2,
"processingTimeMs": 150.5,
"predictions": [
{...},
{...}
]
}

List Models

GET /v1/models

Response:

{
"models": [
{
"name": "health_predictor",
"type": "regressor",
"accuracy": 0.94
},
{
"name": "rul_lstm",
"type": "deep_learning",
"mae_days": 5.2
}
]
}

Input Schema

GET /v1/schema/input

Returns JSON schema for input validation.

Output Schema

GET /v1/schema/output

Returns JSON schema for response format.

Schema Aliases

GET /v1/schema/aliases

Returns all supported field aliases for auto-mapping:

{
"description": "Field aliases that are automatically mapped",
"aliases": {
"engine_speed": ["rpm", "engine_rpm", "engineRPM"],
"coolant": ["coolant_temp", "engine_temp", "ect"],
"battery_voltage": ["battery", "bat_v", "voltage"]
}
}

Schema Statistics

GET /v1/schema/statistics

Returns processing statistics for monitoring data quality:

{
"total_processed": 1500,
"fully_standard": 1200,
"required_mapping": 300,
"standard_compliance_rate": 80.0
}

API Documentation

GET /docs

Interactive Swagger/OpenAPI documentation.


Performance

MetricExpected Value
Health check< 50ms
Single prediction< 500ms
Batch (100 vehicles)< 5 seconds
Concurrent requests1,000/sec per replica

Error Handling

All errors return JSON:

{
"error": {
"code": "invalid_input",
"message": "Missing required field: vehicleId"
}
}

HTTP Status Codes:

  • 200 - Success
  • 400 - Bad request
  • 500 - Server error
  • 503 - Service unavailable

Rate Limiting

Pay-As-You-Go: No limits (you control scaling)
BYOL: Unlimited

Your Azure Container Apps handles auto-scaling.


Next Steps