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

********************
create_presigned_url
********************



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

  

  Creates a presigned URL for an S3 POST operation to upload a file. You can use this URL to set a default file for a ``FileUploadCard`` in a Q App definition or to provide a file for a single Q App run. The ``scope`` parameter determines how the file will be used, either at the app definition level or the app session level.

   

  .. note::

    

    The IAM permissions are derived from the ``qapps:ImportDocument`` action. For more information on the IAM policy for Amazon Q Apps, see `IAM permissions for using Amazon Q Apps <https://docs.aws.amazon.com/amazonq/latest/qbusiness-ug/deploy-q-apps-iam-permissions.html>`__.

    

  

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


  **Request Syntax**
  ::

    response = client.create_presigned_url(
        instanceId='string',
        cardId='string',
        appId='string',
        fileContentsSha256='string',
        fileName='string',
        scope='APPLICATION'|'SESSION',
        sessionId='string'
    )
    
  :type instanceId: string
  :param instanceId: **[REQUIRED]** 

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

    

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

    The unique identifier of the card the file is associated with.

    

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

    The unique identifier of the Q App the file is associated with.

    

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

    The Base64-encoded SHA-256 digest of the contents of the file to be uploaded.

    

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

    The name of the file to be uploaded.

    

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

    Whether the file is associated with a Q App definition or a specific Q App session.

    

  
  :type sessionId: string
  :param sessionId: 

    The unique identifier of the Q App session the file is associated with, if applicable.

    

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

    
    ::

      {
          'fileId': 'string',
          'presignedUrl': 'string',
          'presignedUrlFields': {
              'string': 'string'
          },
          'presignedUrlExpiration': datetime(2015, 1, 1)
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

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

        The unique identifier assigned to the file to be uploaded.

        
      

      - **presignedUrl** *(string) --* 

        The URL for a presigned S3 POST operation used to upload a file.

        
      

      - **presignedUrlFields** *(dict) --* 

        The form fields to include in the presigned S3 POST operation used to upload a file.

        
        

        - *(string) --* 
          

          - *(string) --* 
    
  
      

      - **presignedUrlExpiration** *(datetime) --* 

        The date and time that the presigned URL will expire in ISO 8601 format.

        
  
  **Exceptions**
  
  *   :py:class:`QApps.Client.exceptions.AccessDeniedException`

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

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

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

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

  