:doc:`AppSync <../../appsync>` / Client / create_api_key

**************
create_api_key
**************



.. py:method:: AppSync.Client.create_api_key(**kwargs)

  

  Creates a unique key that you can distribute to clients who invoke your API.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/appsync-2017-07-25/CreateApiKey>`_  


  **Request Syntax**
  ::

    response = client.create_api_key(
        apiId='string',
        description='string',
        expires=123
    )
    
  :type apiId: string
  :param apiId: **[REQUIRED]** 

    The ID for your GraphQL API.

    

  
  :type description: string
  :param description: 

    A description of the purpose of the API key.

    

  
  :type expires: integer
  :param expires: 

    From the creation time, the time after which the API key expires. The date is represented as seconds since the epoch, rounded down to the nearest hour. The default value for this parameter is 7 days from creation time. For more information, see .

    

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

    
    ::

      {
          'apiKey': {
              'id': 'string',
              'description': 'string',
              'expires': 123,
              'deletes': 123
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **apiKey** *(dict) --* 

        The API key.

        
        

        - **id** *(string) --* 

          The API key ID.

          
        

        - **description** *(string) --* 

          A description of the purpose of the API key.

          
        

        - **expires** *(integer) --* 

          The time after which the API key expires. The date is represented as seconds since the epoch, rounded down to the nearest hour.

          
        

        - **deletes** *(integer) --* 

          The time after which the API key is deleted. The date is represented as seconds since the epoch, rounded down to the nearest hour.

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

  
  *   :py:class:`AppSync.Client.exceptions.NotFoundException`

  
  *   :py:class:`AppSync.Client.exceptions.LimitExceededException`

  
  *   :py:class:`AppSync.Client.exceptions.UnauthorizedException`

  
  *   :py:class:`AppSync.Client.exceptions.LimitExceededException`

  
  *   :py:class:`AppSync.Client.exceptions.InternalFailureException`

  
  *   :py:class:`AppSync.Client.exceptions.ApiKeyLimitExceededException`

  
  *   :py:class:`AppSync.Client.exceptions.ApiKeyValidityOutOfBoundsException`

  