Skip to content

Update model by id. If the model is active, it will generate a new version.

PUT
/v2/models/{model_id}
curl --request PUT \
--url https://pie.streamline.enterprises/v2/models/model_price_reco_v1 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "description": "example", "handlers": { "training": { "type": "lambda", "arn": "arn:aws:lambda:us-west-2:123456789012:function:train-model", "version": "1" }, "inference": { "type": "lambda", "arn": "arn:aws:lambda:us-west-2:123456789012:function:infer-model" } }, "handler_contracts": { "training": { "input_schema": { "type": "object", "properties": { "data_path": { "type": "string" } } }, "output_schema": { "type": "object", "properties": { "model_path": { "type": "string" } } } }, "inference": { "input_schema": { "type": "object", "properties": { "features": { "type": "array", "items": { "type": "number" } } } }, "output_schema": { "type": "object", "properties": { "predictions": { "type": "array" } } } } }, "metadata": {} }'
model_id
required
string
Example
model_price_reco_v1
Media type application/json
object
name
required
string
description
required
string
handlers
required
object
training
required
One of:
object
type
required
string
Allowed value: lambda
arn
required
string
version
string
inference
required
One of:
object
type
required
string
Allowed value: lambda
arn
required
string
version
string
Example
{
"training": {
"type": "lambda",
"arn": "arn:aws:lambda:us-west-2:123456789012:function:train-model",
"version": "1"
},
"inference": {
"type": "lambda",
"arn": "arn:aws:lambda:us-west-2:123456789012:function:infer-model"
}
}
handler_contracts

Typed input/output contracts per handler type. Controls which subscriptions become stale when handlers change. Contract fields are JSON Schema Draft 2020-12 documents.

object
training
object
input_schema

JSON Schema Draft 2020-12 document for the payload accepted by this handler. When set on inference, direct inference requests validate input against this schema before dispatch. Stored event-subscription payloads are validated against the target’s schema for the action (warnings-only on mismatch).

object
output_schema

JSON Schema Draft 2020-12 document for the handler’s successful output on job completion. Mismatches are logged as warnings but do not fail completion (external handlers may diverge).

object
inference
object
input_schema

JSON Schema Draft 2020-12 document for the payload accepted by this handler. When set on inference, direct inference requests validate input against this schema before dispatch. Stored event-subscription payloads are validated against the target’s schema for the action (warnings-only on mismatch).

object
output_schema

JSON Schema Draft 2020-12 document for the handler’s successful output on job completion. Mismatches are logged as warnings but do not fail completion (external handlers may diverge).

object
metadata
required
object

A model

Media type application/json
object
version
required
object
version
required
string
description
required
string
metadata
required
object
status
required
string
Allowed values: pending training active failed
model
required
object
id
required
string
name
required
string
description
required
string
handlers
required
object
training
required
One of:
object
type
required
string
Allowed value: lambda
arn
required
string
version
string
inference
required
One of:
object
type
required
string
Allowed value: lambda
arn
required
string
version
string
handler_contracts

Typed input/output contracts per handler type. When set, subscription staleness is driven by changes to these schemas rather than the handlers field. Contract fields are JSON Schema Draft 2020-12 documents.

object
training
object
input_schema

JSON Schema Draft 2020-12 document for the payload accepted by this handler. When set on inference, direct inference requests validate input against this schema before dispatch. Stored event-subscription payloads are validated against the target’s schema for the action (warnings-only on mismatch).

object
output_schema

JSON Schema Draft 2020-12 document for the handler’s successful output on job completion. Mismatches are logged as warnings but do not fail completion (external handlers may diverge).

object
inference
object
input_schema

JSON Schema Draft 2020-12 document for the payload accepted by this handler. When set on inference, direct inference requests validate input against this schema before dispatch. Stored event-subscription payloads are validated against the target’s schema for the action (warnings-only on mismatch).

object
output_schema

JSON Schema Draft 2020-12 document for the handler’s successful output on job completion. Mismatches are logged as warnings but do not fail completion (external handlers may diverge).

object
metadata
required
object
status
required
string
Allowed values: pending active
Example
{
"version": {
"status": "pending"
},
"model": {
"id": "model_price_reco_v1",
"name": "Price recommendation",
"description": "Domain-level price model",
"handlers": {
"training": {
"type": "lambda",
"arn": "arn:aws:lambda:us-west-2:123456789012:function:train",
"version": "1"
},
"inference": {
"type": "lambda",
"arn": "arn:aws:lambda:us-west-2:123456789012:function:infer"
}
},
"handler_contracts": null,
"metadata": {
"team": "pricing"
},
"status": "active"
}
}

Validation error — malformed input, invalid path parameters, or request that fails syntactic validation.

Media type application/json
object
success
required
boolean
message
required

Human-readable error message

string
Example
{
"success": false
}

Missing or invalid Authorization bearer token, expired token, or token rejected by the authorization layer (e.g. API Gateway JWT authorizer or application validation).

Media type application/json
object
success
required
boolean
message
required

Human-readable error message

string
Example
{
"success": false
}

Authenticated caller lacks the permission required for this operation.

Media type application/json
object
success
required
boolean
message
required

Human-readable error message

string
Example
{
"success": false
}

Requested resource was not found.

Media type application/json
object
success
required
boolean
message
required

Human-readable error message

string
Example
{
"success": false
}

Semantically invalid request — e.g. domain not active, no model assigned, feature contract mismatch, or invalid feature definitions.

Media type application/json
object
success
required
boolean
message
required

Human-readable error message

string
Example
{
"success": false
}