:doc:`QApps <../../qapps>` / Client / create_q_app

************
create_q_app
************



.. py:method:: QApps.Client.create_q_app(**kwargs)

  

  Creates a new Amazon Q App based on the provided definition. The Q App definition specifies the cards and flow of the Q App. This operation also calculates the dependencies between the cards by inspecting the references in the prompts.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/qapps-2023-11-27/CreateQApp>`_  


  **Request Syntax**
  ::

    response = client.create_q_app(
        instanceId='string',
        title='string',
        description='string',
        appDefinition={
            'cards': [
                {
                    'textInput': {
                        'title': 'string',
                        'id': 'string',
                        'type': 'text-input'|'q-query'|'file-upload'|'q-plugin'|'form-input',
                        'placeholder': 'string',
                        'defaultValue': 'string'
                    },
                    'qQuery': {
                        'title': 'string',
                        'id': 'string',
                        'type': 'text-input'|'q-query'|'file-upload'|'q-plugin'|'form-input',
                        'prompt': 'string',
                        'outputSource': 'approved-sources'|'llm',
                        'attributeFilter': {
                            'andAllFilters': [
                                {'... recursive ...'},
                            ],
                            'orAllFilters': [
                                {'... recursive ...'},
                            ],
                            'notFilter': {'... recursive ...'},
                            'equalsTo': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            },
                            'containsAll': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            },
                            'containsAny': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            },
                            'greaterThan': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            },
                            'greaterThanOrEquals': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            },
                            'lessThan': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            },
                            'lessThanOrEquals': {
                                'name': 'string',
                                'value': {
                                    'stringValue': 'string',
                                    'stringListValue': [
                                        'string',
                                    ],
                                    'longValue': 123,
                                    'dateValue': datetime(2015, 1, 1)
                                }
                            }
                        }
                    },
                    'qPlugin': {
                        'title': 'string',
                        'id': 'string',
                        'type': 'text-input'|'q-query'|'file-upload'|'q-plugin'|'form-input',
                        'prompt': 'string',
                        'pluginId': 'string',
                        'actionIdentifier': 'string'
                    },
                    'fileUpload': {
                        'title': 'string',
                        'id': 'string',
                        'type': 'text-input'|'q-query'|'file-upload'|'q-plugin'|'form-input',
                        'filename': 'string',
                        'fileId': 'string',
                        'allowOverride': True|False
                    },
                    'formInput': {
                        'title': 'string',
                        'id': 'string',
                        'type': 'text-input'|'q-query'|'file-upload'|'q-plugin'|'form-input',
                        'metadata': {
                            'schema': {...}|[...]|123|123.4|'string'|True|None
                        },
                        'computeMode': 'append'|'replace'
                    }
                },
            ],
            'initialPrompt': 'string'
        },
        tags={
            'string': 'string'
        }
    )
    
  :type instanceId: string
  :param instanceId: **[REQUIRED]** 

    The unique identifier of the Amazon Q Business application environment instance.

    

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

    The title of the new Q App.

    

  
  :type description: string
  :param description: 

    The description of the new Q App.

    

  
  :type appDefinition: dict
  :param appDefinition: **[REQUIRED]** 

    The definition of the new Q App, specifying the cards and flow.

    

  
    - **cards** *(list) --* **[REQUIRED]** 

      The cards that make up the Q App definition.

      

    
      - *(dict) --* 

        The properties defining an input card in an Amazon Q App.

        .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``textInput``, ``qQuery``, ``qPlugin``, ``fileUpload``, ``formInput``. 

      
        - **textInput** *(dict) --* 

          A container for the properties of the text input card.

          

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

            The title or label of the text input card.

            

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

            The unique identifier of the text input card.

            

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

            The type of the card.

            

          
          - **placeholder** *(string) --* 

            The placeholder text to display in the text input field.

            

          
          - **defaultValue** *(string) --* 

            The default value to pre-populate in the text input field.

            

          
        
        - **qQuery** *(dict) --* 

          A container for the properties of the query input card.

          

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

            The title or label of the query card.

            

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

            The unique identifier of the query card.

            

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

            The type of the card.

            

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

            The prompt or instructions displayed for the query card.

            

          
          - **outputSource** *(string) --* 

            The source or type of output to generate for the query card.

            

          
          - **attributeFilter** *(dict) --* 

            Turns on filtering of responses based on document attributes or metadata fields.

            

          
            - **andAllFilters** *(list) --* 

              Performs a logical ``AND`` operation on all supplied filters.

              

            
              - *(dict) --* 

                The filter criteria used on responses based on document attributes or metadata fields.

                

              
          
            - **orAllFilters** *(list) --* 

              Performs a logical ``OR`` operation on all supplied filters.

              

            
              - *(dict) --* 

                The filter criteria used on responses based on document attributes or metadata fields.

                

              
          
            - **notFilter** *(dict) --* 

              Performs a logical ``NOT`` operation on all supplied filters.

              

            
            - **equalsTo** *(dict) --* 

              Performs an *equals* operation on two document attributes or metadata fields. Supported for the following `document attribute value types <https://docs.aws.amazon.com/amazonq/latest/api-reference/API_DocumentAttributeValue.html>`__: ``dateValue``, ``longValue``, ``stringListValue`` and ``stringValue``.

              

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

                The identifier for the attribute.

                

              
              - **value** *(dict) --* **[REQUIRED]** 

                The value of the attribute.

                .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``stringValue``, ``stringListValue``, ``longValue``, ``dateValue``. 

              
                - **stringValue** *(string) --* 

                  A string.

                  

                
                - **stringListValue** *(list) --* 

                  A list of strings.

                  

                
                  - *(string) --* 

                  
              
                - **longValue** *(integer) --* 

                  A long integer value.

                  

                
                - **dateValue** *(datetime) --* 

                  A date expressed as an ISO 8601 string.

                   

                  It's important for the time zone to be included in the *ISO 8601 date-time* format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

                  

                
              
            
            - **containsAll** *(dict) --* 

              Returns ``true`` when a document contains all the specified document attributes or metadata fields. Supported for the following `document attribute value types <https://docs.aws.amazon.com/amazonq/latest/api-reference/API_DocumentAttributeValue.html>`__: ``stringListValue``.

              

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

                The identifier for the attribute.

                

              
              - **value** *(dict) --* **[REQUIRED]** 

                The value of the attribute.

                .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``stringValue``, ``stringListValue``, ``longValue``, ``dateValue``. 

              
                - **stringValue** *(string) --* 

                  A string.

                  

                
                - **stringListValue** *(list) --* 

                  A list of strings.

                  

                
                  - *(string) --* 

                  
              
                - **longValue** *(integer) --* 

                  A long integer value.

                  

                
                - **dateValue** *(datetime) --* 

                  A date expressed as an ISO 8601 string.

                   

                  It's important for the time zone to be included in the *ISO 8601 date-time* format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

                  

                
              
            
            - **containsAny** *(dict) --* 

              Returns ``true`` when a document contains any of the specified document attributes or metadata fields. Supported for the following `document attribute value types <https://docs.aws.amazon.com/amazonq/latest/api-reference/API_DocumentAttributeValue.html>`__: ``stringListValue``.

              

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

                The identifier for the attribute.

                

              
              - **value** *(dict) --* **[REQUIRED]** 

                The value of the attribute.

                .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``stringValue``, ``stringListValue``, ``longValue``, ``dateValue``. 

              
                - **stringValue** *(string) --* 

                  A string.

                  

                
                - **stringListValue** *(list) --* 

                  A list of strings.

                  

                
                  - *(string) --* 

                  
              
                - **longValue** *(integer) --* 

                  A long integer value.

                  

                
                - **dateValue** *(datetime) --* 

                  A date expressed as an ISO 8601 string.

                   

                  It's important for the time zone to be included in the *ISO 8601 date-time* format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

                  

                
              
            
            - **greaterThan** *(dict) --* 

              Performs a *greater than* operation on two document attributes or metadata fields. Supported for the following `document attribute value types <https://docs.aws.amazon.com/amazonq/latest/api-reference/API_DocumentAttributeValue.html>`__: ``dateValue`` and ``longValue``.

              

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

                The identifier for the attribute.

                

              
              - **value** *(dict) --* **[REQUIRED]** 

                The value of the attribute.

                .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``stringValue``, ``stringListValue``, ``longValue``, ``dateValue``. 

              
                - **stringValue** *(string) --* 

                  A string.

                  

                
                - **stringListValue** *(list) --* 

                  A list of strings.

                  

                
                  - *(string) --* 

                  
              
                - **longValue** *(integer) --* 

                  A long integer value.

                  

                
                - **dateValue** *(datetime) --* 

                  A date expressed as an ISO 8601 string.

                   

                  It's important for the time zone to be included in the *ISO 8601 date-time* format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

                  

                
              
            
            - **greaterThanOrEquals** *(dict) --* 

              Performs a *greater than or equals* operation on two document attributes or metadata fields. Supported for the following `document attribute value types <https://docs.aws.amazon.com/amazonq/latest/api-reference/API_DocumentAttributeValue.html>`__: ``dateValue`` and ``longValue``.

              

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

                The identifier for the attribute.

                

              
              - **value** *(dict) --* **[REQUIRED]** 

                The value of the attribute.

                .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``stringValue``, ``stringListValue``, ``longValue``, ``dateValue``. 

              
                - **stringValue** *(string) --* 

                  A string.

                  

                
                - **stringListValue** *(list) --* 

                  A list of strings.

                  

                
                  - *(string) --* 

                  
              
                - **longValue** *(integer) --* 

                  A long integer value.

                  

                
                - **dateValue** *(datetime) --* 

                  A date expressed as an ISO 8601 string.

                   

                  It's important for the time zone to be included in the *ISO 8601 date-time* format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

                  

                
              
            
            - **lessThan** *(dict) --* 

              Performs a *less than* operation on two document attributes or metadata fields. Supported for the following `document attribute value types <https://docs.aws.amazon.com/amazonq/latest/api-reference/API_DocumentAttributeValue.html>`__: ``dateValue`` and ``longValue``.

              

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

                The identifier for the attribute.

                

              
              - **value** *(dict) --* **[REQUIRED]** 

                The value of the attribute.

                .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``stringValue``, ``stringListValue``, ``longValue``, ``dateValue``. 

              
                - **stringValue** *(string) --* 

                  A string.

                  

                
                - **stringListValue** *(list) --* 

                  A list of strings.

                  

                
                  - *(string) --* 

                  
              
                - **longValue** *(integer) --* 

                  A long integer value.

                  

                
                - **dateValue** *(datetime) --* 

                  A date expressed as an ISO 8601 string.

                   

                  It's important for the time zone to be included in the *ISO 8601 date-time* format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

                  

                
              
            
            - **lessThanOrEquals** *(dict) --* 

              Performs a *less than or equals* operation on two document attributes or metadata fields.Supported for the following `document attribute value type <https://docs.aws.amazon.com/amazonq/latest/api-reference/API_DocumentAttributeValue.html>`__: ``dateValue`` and ``longValue``.

              

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

                The identifier for the attribute.

                

              
              - **value** *(dict) --* **[REQUIRED]** 

                The value of the attribute.

                .. note::    This is a Tagged Union structure. Only one of the     following top level keys can be set: ``stringValue``, ``stringListValue``, ``longValue``, ``dateValue``. 

              
                - **stringValue** *(string) --* 

                  A string.

                  

                
                - **stringListValue** *(list) --* 

                  A list of strings.

                  

                
                  - *(string) --* 

                  
              
                - **longValue** *(integer) --* 

                  A long integer value.

                  

                
                - **dateValue** *(datetime) --* 

                  A date expressed as an ISO 8601 string.

                   

                  It's important for the time zone to be included in the *ISO 8601 date-time* format. For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time.

                  

                
              
            
          
        
        - **qPlugin** *(dict) --* 

          A container for the properties of the plugin input card.

          

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

            The title or label of the plugin card.

            

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

            The unique identifier of the plugin card.

            

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

            The type of the card.

            

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

            The prompt or instructions displayed for the plugin card.

            

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

            The unique identifier of the plugin used by the card.

            

          
          - **actionIdentifier** *(string) --* 

            The action identifier of the action to be performed by the plugin card.

            

          
        
        - **fileUpload** *(dict) --* 

          A container for the properties of the file upload input card.

          

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

            The title or label of the file upload card.

            

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

            The unique identifier of the file upload card.

            

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

            The type of the card.

            

          
          - **filename** *(string) --* 

            The default filename to use for the file upload card.

            

          
          - **fileId** *(string) --* 

            The identifier of a pre-uploaded file associated with the card.

            

          
          - **allowOverride** *(boolean) --* 

            A flag indicating if the user can override the default file for the upload card.

            

          
        
        - **formInput** *(dict) --* 

          A container for the properties of the form input card.

          

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

            The title or label of the form input card.

            

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

            The unique identifier of the form input card.

            

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

            The type of the card.

            

          
          - **metadata** *(dict) --* **[REQUIRED]** 

            The metadata that defines the form input card data.

            

          
            - **schema** (:ref:`document<document>`) -- **[REQUIRED]** 

              The JSON schema that defines the shape of the response data.

              

            
          
          - **computeMode** *(string) --* 

            The compute mode of the form input card. This property determines whether individual participants of a data collection session can submit multiple response or one response. A compute mode of ``append`` shall allow participants to submit the same form multiple times with different values. A compute mode of ``replace``code> shall overwrite the current value for each participant.

            

          
        
      
  
    - **initialPrompt** *(string) --* 

      The initial prompt displayed when the Q App is started.

      

    
  
  :type tags: dict
  :param tags: 

    Optional tags to associate with the new Q App.

    

  
    - *(string) --* 

    
      - *(string) --* 

      


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

    
    ::

      {
          'appId': 'string',
          'appArn': 'string',
          'title': 'string',
          'description': 'string',
          'initialPrompt': 'string',
          'appVersion': 123,
          'status': 'PUBLISHED'|'DRAFT'|'DELETED',
          'createdAt': datetime(2015, 1, 1),
          'createdBy': 'string',
          'updatedAt': datetime(2015, 1, 1),
          'updatedBy': 'string',
          'requiredCapabilities': [
              'FileUpload'|'CreatorMode'|'RetrievalMode'|'PluginMode',
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **appId** *(string) --* 

        The unique identifier of the new Q App.

        
      

      - **appArn** *(string) --* 

        The Amazon Resource Name (ARN) of the new Q App.

        
      

      - **title** *(string) --* 

        The title of the new Q App.

        
      

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

        The description of the new Q App.

        
      

      - **initialPrompt** *(string) --* 

        The initial prompt displayed when the Q App is started.

        
      

      - **appVersion** *(integer) --* 

        The version of the new Q App.

        
      

      - **status** *(string) --* 

        The status of the new Q App, such as "Created".

        
      

      - **createdAt** *(datetime) --* 

        The date and time the Q App was created.

        
      

      - **createdBy** *(string) --* 

        The user who created the Q App.

        
      

      - **updatedAt** *(datetime) --* 

        The date and time the Q App was last updated.

        
      

      - **updatedBy** *(string) --* 

        The user who last updated the Q App.

        
      

      - **requiredCapabilities** *(list) --* 

        The capabilities required to run the Q App, such as file upload or third-party integrations.

        
        

        - *(string) --* 
    
  
  **Exceptions**
  
  *   :py:class:`QApps.Client.exceptions.AccessDeniedException`

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

  
  *   :py:class:`QApps.Client.exceptions.ValidationException`

  
  *   :py:class:`QApps.Client.exceptions.InternalServerException`

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

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

  
  *   :py:class:`QApps.Client.exceptions.ContentTooLargeException`

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

  