:doc:`Rekognition <../../rekognition>` / Client / create_collection

*****************
create_collection
*****************



.. py:method:: Rekognition.Client.create_collection(**kwargs)

  

  Creates a collection in an AWS Region. You can add faces to the collection using the  IndexFaces operation.

   

  For example, you might create collections, one for each of your application users. A user can then index faces using the ``IndexFaces`` operation and persist results in a specific collection. Then, a user can search the collection for faces in the user-specific container.

   

  When you create a collection, it is associated with the latest version of the face model version.

   

  .. note::

    

    Collection names are case-sensitive.

    

   

  This operation requires permissions to perform the ``rekognition:CreateCollection`` action. If you want to tag your collection, you also require permission to perform the ``rekognition:TagResource`` operation.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/rekognition-2016-06-27/CreateCollection>`_  


  **Request Syntax**
  ::

    response = client.create_collection(
        CollectionId='string',
        Tags={
            'string': 'string'
        }
    )
    
  :type CollectionId: string
  :param CollectionId: **[REQUIRED]** 

    ID for the collection that you are creating.

    

  
  :type Tags: dict
  :param Tags: 

    A set of tags (key-value pairs) that you want to attach to the collection.

    

  
    - *(string) --* 

    
      - *(string) --* 

      


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

    
    ::

      {
          'StatusCode': 123,
          'CollectionArn': 'string',
          'FaceModelVersion': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **StatusCode** *(integer) --* 

        HTTP status code indicating the result of the operation.

        
      

      - **CollectionArn** *(string) --* 

        Amazon Resource Name (ARN) of the collection. You can use this to manage permissions on your resources.

        
      

      - **FaceModelVersion** *(string) --* 

        Version number of the face detection model associated with the collection you are creating.

        
  
  **Exceptions**
  
  *   :py:class:`Rekognition.Client.exceptions.InvalidParameterException`

  
  *   :py:class:`Rekognition.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`Rekognition.Client.exceptions.InternalServerError`

  
  *   :py:class:`Rekognition.Client.exceptions.ThrottlingException`

  
  *   :py:class:`Rekognition.Client.exceptions.ProvisionedThroughputExceededException`

  
  *   :py:class:`Rekognition.Client.exceptions.ResourceAlreadyExistsException`

  
  *   :py:class:`Rekognition.Client.exceptions.ServiceQuotaExceededException`

  

  **Examples**

  This operation creates a Rekognition collection for storing image data.
  ::

    response = client.create_collection(
        CollectionId='myphotos',
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'CollectionArn': 'aws:rekognition:us-west-2:123456789012:collection/myphotos',
        'StatusCode': 200,
        'ResponseMetadata': {
            '...': '...',
        },
    }

  