:doc:`ChimeSDKMessaging <../../chime-sdk-messaging>` / Client / create_channel

**************
create_channel
**************



.. py:method:: ChimeSDKMessaging.Client.create_channel(**kwargs)

  

  Creates a channel to which you can add users and send messages.

   

  **Restriction**: You can't change a channel's privacy.

   

  .. note::

    

    The ``x-amz-chime-bearer`` request header is mandatory. Use the ARN of the ``AppInstanceUser`` or ``AppInstanceBot`` that makes the API call as the value in the header.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/chime-sdk-messaging-2021-05-15/CreateChannel>`_  


  **Request Syntax**
  ::

    response = client.create_channel(
        AppInstanceArn='string',
        Name='string',
        Mode='UNRESTRICTED'|'RESTRICTED',
        Privacy='PUBLIC'|'PRIVATE',
        Metadata='string',
        ClientRequestToken='string',
        Tags=[
            {
                'Key': 'string',
                'Value': 'string'
            },
        ],
        ChimeBearer='string',
        ChannelId='string',
        MemberArns=[
            'string',
        ],
        ModeratorArns=[
            'string',
        ],
        ElasticChannelConfiguration={
            'MaximumSubChannels': 123,
            'TargetMembershipsPerSubChannel': 123,
            'MinimumMembershipPercentage': 123
        },
        ExpirationSettings={
            'ExpirationDays': 123,
            'ExpirationCriterion': 'CREATED_TIMESTAMP'|'LAST_MESSAGE_TIMESTAMP'
        }
    )
    
  :type AppInstanceArn: string
  :param AppInstanceArn: **[REQUIRED]** 

    The ARN of the channel request.

    

  
  :type Name: string
  :param Name: **[REQUIRED]** 

    The name of the channel.

    

  
  :type Mode: string
  :param Mode: 

    The channel mode: ``UNRESTRICTED`` or ``RESTRICTED``. Administrators, moderators, and channel members can add themselves and other members to unrestricted channels. Only administrators and moderators can add members to restricted channels.

    

  
  :type Privacy: string
  :param Privacy: 

    The channel's privacy level: ``PUBLIC`` or ``PRIVATE``. Private channels aren't discoverable by users outside the channel. Public channels are discoverable by anyone in the ``AppInstance``.

    

  
  :type Metadata: string
  :param Metadata: 

    The metadata of the creation request. Limited to 1KB and UTF-8.

    

  
  :type ClientRequestToken: string
  :param ClientRequestToken: **[REQUIRED]** 

    The client token for the request. An ``Idempotency`` token.

    This field is autopopulated if not provided.

  
  :type Tags: list
  :param Tags: 

    The tags for the creation request.

    

  
    - *(dict) --* 

      A tag object containing a key-value pair.

      

    
      - **Key** *(string) --* **[REQUIRED]** 

        The key in a tag.

        

      
      - **Value** *(string) --* **[REQUIRED]** 

        The value in a tag.

        

      
    

  :type ChimeBearer: string
  :param ChimeBearer: **[REQUIRED]** 

    The ARN of the ``AppInstanceUser`` or ``AppInstanceBot`` that makes the API call.

    

  
  :type ChannelId: string
  :param ChannelId: 

    An ID for the channel being created. If you do not specify an ID, a UUID will be created for the channel.

    

  
  :type MemberArns: list
  :param MemberArns: 

    The ARNs of the channel members in the request.

    

  
    - *(string) --* 

    

  :type ModeratorArns: list
  :param ModeratorArns: 

    The ARNs of the channel moderators in the request.

    

  
    - *(string) --* 

    

  :type ElasticChannelConfiguration: dict
  :param ElasticChannelConfiguration: 

    The attributes required to configure and create an elastic channel. An elastic channel can support a maximum of 1-million users, excluding moderators.

    

  
    - **MaximumSubChannels** *(integer) --* **[REQUIRED]** 

      The maximum number of SubChannels that you want to allow in the elastic channel.

      

    
    - **TargetMembershipsPerSubChannel** *(integer) --* **[REQUIRED]** 

      The maximum number of members allowed in a SubChannel.

      

    
    - **MinimumMembershipPercentage** *(integer) --* **[REQUIRED]** 

      The minimum allowed percentage of TargetMembershipsPerSubChannel users. Ceil of the calculated value is used in balancing members among SubChannels of the elastic channel.

      

    
  
  :type ExpirationSettings: dict
  :param ExpirationSettings: 

    Settings that control the interval after which the channel is automatically deleted.

    

  
    - **ExpirationDays** *(integer) --* **[REQUIRED]** 

      The period in days after which the system automatically deletes a channel.

      

    
    - **ExpirationCriterion** *(string) --* **[REQUIRED]** 

      The conditions that must be met for a channel to expire.

      

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

    
    ::

      {
          'ChannelArn': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **ChannelArn** *(string) --* 

        The ARN of the channel.

        
  
  **Exceptions**
  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.BadRequestException`

  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.ForbiddenException`

  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.UnauthorizedClientException`

  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.ConflictException`

  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.ResourceLimitExceededException`

  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.ThrottledClientException`

  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.ServiceUnavailableException`

  
  *   :py:class:`ChimeSDKMessaging.Client.exceptions.ServiceFailureException`

  