getDurableExecutionHistory method

Future<GetDurableExecutionHistoryResponse> getDurableExecutionHistory({
  1. required String durableExecutionArn,
  2. bool? includeExecutionData,
  3. String? marker,
  4. int? maxItems,
  5. bool? reverseOrder,
})

Retrieves the execution history for a durable execution, showing all the steps, callbacks, and events that occurred during the execution. This provides a detailed audit trail of the execution's progress over time.

The history is available while the execution is running and for a retention period after it completes (1-90 days, default 30 days). You can control whether to include execution data such as step results and callback payloads.

May throw InvalidParameterValueException. May throw ResourceNotFoundException. May throw ServiceException. May throw TooManyRequestsException.

Parameter durableExecutionArn : The Amazon Resource Name (ARN) of the durable execution.

Parameter includeExecutionData : Specifies whether to include execution data such as step results and callback payloads in the history events. Set to true to include data, or false to exclude it for a more compact response. The default is true.

Parameter marker : If NextMarker was returned from a previous request, use this value to retrieve the next page of results. Each pagination token expires after 24 hours.

Parameter maxItems : The maximum number of history events to return per call. You can use Marker to retrieve additional pages of results. The default is 100 and the maximum allowed is 1000. A value of 0 uses the default.

Parameter reverseOrder : When set to true, returns the history events in reverse chronological order (newest first). By default, events are returned in chronological order (oldest first).

Implementation

Future<GetDurableExecutionHistoryResponse> getDurableExecutionHistory({
  required String durableExecutionArn,
  bool? includeExecutionData,
  String? marker,
  int? maxItems,
  bool? reverseOrder,
}) async {
  _s.validateNumRange(
    'maxItems',
    maxItems,
    0,
    1000,
  );
  final $query = <String, List<String>>{
    if (includeExecutionData != null)
      'IncludeExecutionData': [includeExecutionData.toString()],
    if (marker != null) 'Marker': [marker],
    if (maxItems != null) 'MaxItems': [maxItems.toString()],
    if (reverseOrder != null) 'ReverseOrder': [reverseOrder.toString()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/2025-12-01/durable-executions/${Uri.encodeComponent(durableExecutionArn)}/history',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return GetDurableExecutionHistoryResponse.fromJson(response);
}