:doc:`SageMaker <../../sagemaker>` / Client / list_models

***********
list_models
***********



.. py:method:: SageMaker.Client.list_models(**kwargs)

  

  Lists models created with the ``CreateModel`` API.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/ListModels>`_  


  **Request Syntax**
  ::

    response = client.list_models(
        SortBy='Name'|'CreationTime',
        SortOrder='Ascending'|'Descending',
        NextToken='string',
        MaxResults=123,
        NameContains='string',
        CreationTimeBefore=datetime(2015, 1, 1),
        CreationTimeAfter=datetime(2015, 1, 1)
    )
    
  :type SortBy: string
  :param SortBy: 

    Sorts the list of results. The default is ``CreationTime``.

    

  
  :type SortOrder: string
  :param SortOrder: 

    The sort order for results. The default is ``Descending``.

    

  
  :type NextToken: string
  :param NextToken: 

    If the response to a previous ``ListModels`` request was truncated, the response includes a ``NextToken``. To retrieve the next set of models, use the token in the next request.

    

  
  :type MaxResults: integer
  :param MaxResults: 

    The maximum number of models to return in the response.

    

  
  :type NameContains: string
  :param NameContains: 

    A string in the model name. This filter returns only models whose name contains the specified string.

    

  
  :type CreationTimeBefore: datetime
  :param CreationTimeBefore: 

    A filter that returns only models created before the specified time (timestamp).

    

  
  :type CreationTimeAfter: datetime
  :param CreationTimeAfter: 

    A filter that returns only models with a creation time greater than or equal to the specified time (timestamp).

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'Models': [
              {
                  'ModelName': 'string',
                  'ModelArn': 'string',
                  'CreationTime': datetime(2015, 1, 1)
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Models** *(list) --* 

        An array of ``ModelSummary`` objects, each of which lists a model.

        
        

        - *(dict) --* 

          Provides summary information about a model.

          
          

          - **ModelName** *(string) --* 

            The name of the model that you want a summary for.

            
          

          - **ModelArn** *(string) --* 

            The Amazon Resource Name (ARN) of the model.

            
          

          - **CreationTime** *(datetime) --* 

            A timestamp that indicates when the model was created.

            
      
    
      

      - **NextToken** *(string) --* 

        If the response is truncated, SageMaker returns this token. To retrieve the next set of models, use it in the subsequent request.

        
  