:doc:`XRay <../../xray>` / Client / start_trace_retrieval

*********************
start_trace_retrieval
*********************



.. py:method:: XRay.Client.start_trace_retrieval(**kwargs)

  

  Initiates a trace retrieval process using the specified time range and for the given trace IDs in the Transaction Search generated CloudWatch log group. For more information, see `Transaction Search <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Transaction-Search.html>`__.

   

  API returns a ``RetrievalToken``, which can be used with ``ListRetrievedTraces`` or ``GetRetrievedTracesGraph`` to fetch results. Retrievals will time out after 60 minutes. To execute long time ranges, consider segmenting into multiple retrievals.

   

  If you are using `CloudWatch cross-account observability <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html>`__, you can use this operation in a monitoring account to retrieve data from a linked source account, as long as both accounts have transaction search enabled.

   

  For retrieving data from X-Ray directly as opposed to the Transaction-Search Log group, see `BatchGetTraces <https://docs.aws.amazon.com/xray/latest/api/API_BatchGetTraces.html>`__.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/xray-2016-04-12/StartTraceRetrieval>`_  


  **Request Syntax**
  ::

    response = client.start_trace_retrieval(
        TraceIds=[
            'string',
        ],
        StartTime=datetime(2015, 1, 1),
        EndTime=datetime(2015, 1, 1)
    )
    
  :type TraceIds: list
  :param TraceIds: **[REQUIRED]** 

    Specify the trace IDs of the traces to be retrieved.

    

  
    - *(string) --* 

    

  :type StartTime: datetime
  :param StartTime: **[REQUIRED]** 

    The start of the time range to retrieve traces. The range is inclusive, so the specified start time is included in the query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC.

    

  
  :type EndTime: datetime
  :param EndTime: **[REQUIRED]** 

    The end of the time range to retrieve traces. The range is inclusive, so the specified end time is included in the query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC.

    

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

    
    ::

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

    

    - *(dict) --* 
      

      - **RetrievalToken** *(string) --* 

        Retrieval token.

        
  
  **Exceptions**
  
  *   :py:class:`XRay.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`XRay.Client.exceptions.ThrottledException`

  
  *   :py:class:`XRay.Client.exceptions.ResourceNotFoundException`

  