list_models¶
- MachineLearningApi.list_models(role_id, fields=None, limit=None, offset=None, sortorder=None, sortby=None, projection_expression=None, filter_expression=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
List SageMaker ML models accessible to the user
Returns registered ML models the caller can access, with optional filter, sort, pagination, and field projection. These are SageMaker models, not Bedrock foundation models.
- Parameters:
role_id (str) – Role identifier used for authorization. Missing this header returns AUTH-1001. (required)
fields (str) – Comma-separated attribute names used only to constrain sortby. When set, sortby must be one of these names; otherwise IPV-1039 is returned. This does not project response fields.
limit (str) – Maximum number of models to return on this page. Defaults to 100. Values greater than 1000 return GE-1028.
offset (str) – 1-based page start. offset=1 is the first item. Defaults to 1 when omitted.
sortorder (str) – Sort direction. desc (default) sorts descending; any other value sorts ascending.
sortby (str) – Attribute to sort by. Defaults to LastModifiedTime, or to the first fields value when fields is set.
projection_expression (str) – Comma-separated DynamoDB attribute names to include on each model. When omitted, all stored attributes are returned.
filter_expression (str) – Filter as key:value pairs separated by commas, combined with AND. ModelName supports wildcard * (case-insensitive). Example ModelName:sales*,OutputType:metadata.
_request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
_request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
_content_type (str, Optional) – force content-type for the request.
_headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
_host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
- Return type:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: GET /models
Success (HTTP 200)¶
Paginated list of accessible ML models.
Request / response example
{
"models": [
{
"ModelId": "7f3a2c1e-9b44-4d21-8c0a-1a2b3c4d5e6f",
"ModelName": "sales-blazingtext",
"Description": "Classifies product review sentiment",
"AlgorithmUsed": "BlazingText",
"OutputType": "metadata",
"ArtifactsLocation": "s3://example-ml-temp/ml-models/7f3a2c1e-9b44-4d21-8c0a-1a2b3c4d5e6f/sampleFile.gz",
"SupportedFileFormats": [
"csv",
"txt"
],
"PreProcessedGlueJobs": "custom_role_job",
"PostProcessedGlueJobs": "custom_role_job",
"Keywords": [
"nlp"
],
"IsSubscribedModel": "no",
"AccessType": "owner",
"CreatedBy": "jane.doe",
"CreationTime": "2026-08-19 07:26:01",
"LastModifiedBy": "jane.doe",
"LastModifiedTime": "2026-08-19 07:26:01"
}
],
"next_available": "no",
"count": 1,
"total_count": 1
}
Errors¶
Documented error codes: GE-1028, IPV-1039, GE-1008.
HTTP 400
Invalid pagination, sort, or filter. Typical cases include limit greater than 1000 (GE-1028) and sortby not in fields (IPV-1039).
Page size greater than 1000
{
"Message": "GE-1028 - Out of range for items per page, Limit is 1000"
}
sortby is not in fields
{
"Message": "IPV-1039 - Invalid sort_by column, please use one from the list of fields"
}
HTTP 500
Unexpected failure while listing models (GE-1008).
Request / response example
{
"Message": "GE-1008 - Could not complete the request. Please try again."
}