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

*********************
list_retrieved_traces
*********************



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

  

  Retrieves a list of traces for a given ``RetrievalToken`` from the CloudWatch log group generated by Transaction Search. For information on what each trace returns, see `BatchGetTraces <https://docs.aws.amazon.com/xray/latest/api/API_BatchGetTraces.html>`__.

   

  This API does not initiate a retrieval process. To start a trace retrieval, use ``StartTraceRetrieval``, which generates the required ``RetrievalToken``.

   

  When the ``RetrievalStatus`` is not *COMPLETE*, the API will return an empty response. Retry the request once the retrieval has completed to access the full list of traces.

   

  For cross-account observability, this API can retrieve traces from linked accounts when CloudWatch log is set as the destination across relevant accounts. For more details, see `CloudWatch cross-account observability <https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html>`__.

   

  For retrieving data from X-Ray directly as opposed to the Transaction Search generated 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/ListRetrievedTraces>`_  


  **Request Syntax**
  ::

    response = client.list_retrieved_traces(
        RetrievalToken='string',
        TraceFormat='XRAY'|'OTEL',
        NextToken='string'
    )
    
  :type RetrievalToken: string
  :param RetrievalToken: **[REQUIRED]** 

    Retrieval token.

    

  
  :type TraceFormat: string
  :param TraceFormat: 

    Format of the requested traces.

    

  
  :type NextToken: string
  :param NextToken: 

    Specify the pagination token returned by a previous request to retrieve the next page of indexes.

    

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

    
    ::

      {
          'RetrievalStatus': 'SCHEDULED'|'RUNNING'|'COMPLETE'|'FAILED'|'CANCELLED'|'TIMEOUT',
          'TraceFormat': 'XRAY'|'OTEL',
          'Traces': [
              {
                  'Id': 'string',
                  'Duration': 123.0,
                  'Spans': [
                      {
                          'Id': 'string',
                          'Document': 'string'
                      },
                  ]
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **RetrievalStatus** *(string) --* 

        Status of the retrieval.

        
      

      - **TraceFormat** *(string) --* 

        Format of the requested traces.

        
      

      - **Traces** *(list) --* 

        Full traces for the specified requests.

        
        

        - *(dict) --* 

          Retrieved collection of spans with matching trace IDs.

          
          

          - **Id** *(string) --* 

            The unique identifier for the span.

            
          

          - **Duration** *(float) --* 

            The length of time in seconds between the start time of the root span and the end time of the last span that completed.

            
          

          - **Spans** *(list) --* 

            Spans that comprise the trace.

            
            

            - *(dict) --* 

              A span from a trace that has been ingested by the X-Ray service. A span represents a unit of work or an operation performed by a service.

              
              

              - **Id** *(string) --* 

                The span ID.

                
              

              - **Document** *(string) --* 

                The span document.

                
          
        
      
    
      

      - **NextToken** *(string) --* 

        Specify the pagination token returned by a previous request to retrieve the next page of indexes.

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

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

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

  