Get API Docs
Page Outline
Returns the auto-generated OpenAPI specification for a model's inference endpoint, enabling clients to understand the expected input schema, output schema, and authentication requirements.
Base Path: /api/v1/models
Method: GET
Path: /{model_id}/api-docs
Auth: Requires a valid Bearer token (Authorization: Bearer <JWT>)
Path Parameters
| Parameter | Type | Description |
|---|---|---|
model_id | string | Unique identifier of the model |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
version_id | string | — | Generate docs for a specific version. Defaults to the promoted version |
format | string | json | Response format: json (OpenAPI 3.0 JSON) or yaml (OpenAPI 3.0 YAML) |
Behavior
- Generates an OpenAPI 3.0 specification scoped to the inference endpoint (
/infer) for this specific model. - The
requestBodyschema is derived from the model'sfeature_columnsand their data types, inferred from the linked dataset at training time. - The
responsesschema is derived from the model'stask_typeand output labels. - Returns
HTTP 422if the model has no promoted version and no schema to derive from. - Returns
HTTP 404if the model is not found.
Response
Returns an OpenAPI 3.0 specification document.
{
"openapi": "3.0.0",
"info": {
"title": "My Churn Predictor - Inference API",
"version": "3",
"description": "Auto-generated inference API for model mdl-7f3a19bc (version ver-001)."
},
"paths": {
"/infer": {
"post": {
"summary": "Run inference",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"age": { "type": "integer" },
"tenure": { "type": "integer" },
"monthly_spend": { "type": "number" },
"support_tickets": { "type": "integer" }
},
"required": ["age", "tenure", "monthly_spend"]
}
}
}
},
"responses": {
"200": {
"description": "Prediction result",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"prediction": { "type": "string", "enum": ["not_churned", "churned"] },
"probabilities": { "type": "object" }
}
}
}
}
}
}
}
}
}
}