GetExecutionHistoryCommand

Returns the history of the specified execution as a list of events. By default, the results are returned in ascending order of the timeStamp of the events. Use the reverseOrder parameter to get the latest events first.

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

This API action is not supported by EXPRESS state machines.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { SFNClient, GetExecutionHistoryCommand } from "@aws-sdk/client-sfn"; // ES Modules import
// const { SFNClient, GetExecutionHistoryCommand } = require("@aws-sdk/client-sfn"); // CommonJS import
const client = new SFNClient(config);
const input = { // GetExecutionHistoryInput
  executionArn: "STRING_VALUE", // required
  maxResults: Number("int"),
  reverseOrder: true || false,
  nextToken: "STRING_VALUE",
  includeExecutionData: true || false,
};
const command = new GetExecutionHistoryCommand(input);
const response = await client.send(command);
// { // GetExecutionHistoryOutput
//   events: [ // HistoryEventList // required
//     { // HistoryEvent
//       timestamp: new Date("TIMESTAMP"), // required
//       type: "ActivityFailed" || "ActivityScheduled" || "ActivityScheduleFailed" || "ActivityStarted" || "ActivitySucceeded" || "ActivityTimedOut" || "ChoiceStateEntered" || "ChoiceStateExited" || "ExecutionAborted" || "ExecutionFailed" || "ExecutionStarted" || "ExecutionSucceeded" || "ExecutionTimedOut" || "FailStateEntered" || "LambdaFunctionFailed" || "LambdaFunctionScheduled" || "LambdaFunctionScheduleFailed" || "LambdaFunctionStarted" || "LambdaFunctionStartFailed" || "LambdaFunctionSucceeded" || "LambdaFunctionTimedOut" || "MapIterationAborted" || "MapIterationFailed" || "MapIterationStarted" || "MapIterationSucceeded" || "MapStateAborted" || "MapStateEntered" || "MapStateExited" || "MapStateFailed" || "MapStateStarted" || "MapStateSucceeded" || "ParallelStateAborted" || "ParallelStateEntered" || "ParallelStateExited" || "ParallelStateFailed" || "ParallelStateStarted" || "ParallelStateSucceeded" || "PassStateEntered" || "PassStateExited" || "SucceedStateEntered" || "SucceedStateExited" || "TaskFailed" || "TaskScheduled" || "TaskStarted" || "TaskStartFailed" || "TaskStateAborted" || "TaskStateEntered" || "TaskStateExited" || "TaskSubmitFailed" || "TaskSubmitted" || "TaskSucceeded" || "TaskTimedOut" || "WaitStateAborted" || "WaitStateEntered" || "WaitStateExited" || "MapRunAborted" || "MapRunFailed" || "MapRunStarted" || "MapRunSucceeded" || "ExecutionRedriven" || "MapRunRedriven" || "EvaluationFailed", // required
//       id: Number("long"), // required
//       previousEventId: Number("long"),
//       activityFailedEventDetails: { // ActivityFailedEventDetails
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       activityScheduleFailedEventDetails: { // ActivityScheduleFailedEventDetails
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       activityScheduledEventDetails: { // ActivityScheduledEventDetails
//         resource: "STRING_VALUE", // required
//         input: "STRING_VALUE",
//         inputDetails: { // HistoryEventExecutionDataDetails
//           truncated: true || false,
//         },
//         timeoutInSeconds: Number("long"),
//         heartbeatInSeconds: Number("long"),
//       },
//       activityStartedEventDetails: { // ActivityStartedEventDetails
//         workerName: "STRING_VALUE",
//       },
//       activitySucceededEventDetails: { // ActivitySucceededEventDetails
//         output: "STRING_VALUE",
//         outputDetails: {
//           truncated: true || false,
//         },
//       },
//       activityTimedOutEventDetails: { // ActivityTimedOutEventDetails
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       taskFailedEventDetails: { // TaskFailedEventDetails
//         resourceType: "STRING_VALUE", // required
//         resource: "STRING_VALUE", // required
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       taskScheduledEventDetails: { // TaskScheduledEventDetails
//         resourceType: "STRING_VALUE", // required
//         resource: "STRING_VALUE", // required
//         region: "STRING_VALUE", // required
//         parameters: "STRING_VALUE", // required
//         timeoutInSeconds: Number("long"),
//         heartbeatInSeconds: Number("long"),
//         taskCredentials: { // TaskCredentials
//           roleArn: "STRING_VALUE",
//         },
//       },
//       taskStartFailedEventDetails: { // TaskStartFailedEventDetails
//         resourceType: "STRING_VALUE", // required
//         resource: "STRING_VALUE", // required
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       taskStartedEventDetails: { // TaskStartedEventDetails
//         resourceType: "STRING_VALUE", // required
//         resource: "STRING_VALUE", // required
//       },
//       taskSubmitFailedEventDetails: { // TaskSubmitFailedEventDetails
//         resourceType: "STRING_VALUE", // required
//         resource: "STRING_VALUE", // required
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       taskSubmittedEventDetails: { // TaskSubmittedEventDetails
//         resourceType: "STRING_VALUE", // required
//         resource: "STRING_VALUE", // required
//         output: "STRING_VALUE",
//         outputDetails: {
//           truncated: true || false,
//         },
//       },
//       taskSucceededEventDetails: { // TaskSucceededEventDetails
//         resourceType: "STRING_VALUE", // required
//         resource: "STRING_VALUE", // required
//         output: "STRING_VALUE",
//         outputDetails: {
//           truncated: true || false,
//         },
//       },
//       taskTimedOutEventDetails: { // TaskTimedOutEventDetails
//         resourceType: "STRING_VALUE", // required
//         resource: "STRING_VALUE", // required
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       executionFailedEventDetails: { // ExecutionFailedEventDetails
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       executionStartedEventDetails: { // ExecutionStartedEventDetails
//         input: "STRING_VALUE",
//         inputDetails: {
//           truncated: true || false,
//         },
//         roleArn: "STRING_VALUE",
//         stateMachineAliasArn: "STRING_VALUE",
//         stateMachineVersionArn: "STRING_VALUE",
//       },
//       executionSucceededEventDetails: { // ExecutionSucceededEventDetails
//         output: "STRING_VALUE",
//         outputDetails: "<HistoryEventExecutionDataDetails>",
//       },
//       executionAbortedEventDetails: { // ExecutionAbortedEventDetails
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       executionTimedOutEventDetails: { // ExecutionTimedOutEventDetails
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       executionRedrivenEventDetails: { // ExecutionRedrivenEventDetails
//         redriveCount: Number("int"),
//       },
//       mapStateStartedEventDetails: { // MapStateStartedEventDetails
//         length: Number("int"),
//       },
//       mapIterationStartedEventDetails: { // MapIterationEventDetails
//         name: "STRING_VALUE",
//         index: Number("int"),
//       },
//       mapIterationSucceededEventDetails: {
//         name: "STRING_VALUE",
//         index: Number("int"),
//       },
//       mapIterationFailedEventDetails: {
//         name: "STRING_VALUE",
//         index: Number("int"),
//       },
//       mapIterationAbortedEventDetails: {
//         name: "STRING_VALUE",
//         index: Number("int"),
//       },
//       lambdaFunctionFailedEventDetails: { // LambdaFunctionFailedEventDetails
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       lambdaFunctionScheduleFailedEventDetails: { // LambdaFunctionScheduleFailedEventDetails
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       lambdaFunctionScheduledEventDetails: { // LambdaFunctionScheduledEventDetails
//         resource: "STRING_VALUE", // required
//         input: "STRING_VALUE",
//         inputDetails: "<HistoryEventExecutionDataDetails>",
//         timeoutInSeconds: Number("long"),
//         taskCredentials: {
//           roleArn: "STRING_VALUE",
//         },
//       },
//       lambdaFunctionStartFailedEventDetails: { // LambdaFunctionStartFailedEventDetails
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       lambdaFunctionSucceededEventDetails: { // LambdaFunctionSucceededEventDetails
//         output: "STRING_VALUE",
//         outputDetails: "<HistoryEventExecutionDataDetails>",
//       },
//       lambdaFunctionTimedOutEventDetails: { // LambdaFunctionTimedOutEventDetails
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       stateEnteredEventDetails: { // StateEnteredEventDetails
//         name: "STRING_VALUE", // required
//         input: "STRING_VALUE",
//         inputDetails: "<HistoryEventExecutionDataDetails>",
//       },
//       stateExitedEventDetails: { // StateExitedEventDetails
//         name: "STRING_VALUE", // required
//         output: "STRING_VALUE",
//         outputDetails: "<HistoryEventExecutionDataDetails>",
//         assignedVariables: { // AssignedVariables
//           "<keys>": "STRING_VALUE",
//         },
//         assignedVariablesDetails: { // AssignedVariablesDetails
//           truncated: true || false,
//         },
//       },
//       mapRunStartedEventDetails: { // MapRunStartedEventDetails
//         mapRunArn: "STRING_VALUE",
//       },
//       mapRunFailedEventDetails: { // MapRunFailedEventDetails
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//       },
//       mapRunRedrivenEventDetails: { // MapRunRedrivenEventDetails
//         mapRunArn: "STRING_VALUE",
//         redriveCount: Number("int"),
//       },
//       evaluationFailedEventDetails: { // EvaluationFailedEventDetails
//         error: "STRING_VALUE",
//         cause: "STRING_VALUE",
//         location: "STRING_VALUE",
//         state: "STRING_VALUE", // required
//       },
//     },
//   ],
//   nextToken: "STRING_VALUE",
// };

GetExecutionHistoryCommand Input

See GetExecutionHistoryCommandInput for more details

Parameter
Type
Description
executionArn
Required
string | undefined

The Amazon Resource Name (ARN) of the execution.

includeExecutionData
boolean | undefined

You can select whether execution data (input or output of a history event) is returned. The default is true.

maxResults
number | undefined

The maximum number of results that are returned per call. You can use nextToken to obtain further pages of results. The default is 100 and the maximum allowed page size is 1000. A value of 0 uses the default.

This is only an upper limit. The actual number of results returned per call might be fewer than the specified maximum.

nextToken
string | undefined

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

reverseOrder
boolean | undefined

Lists events in descending order of their timeStamp.

GetExecutionHistoryCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
events
Required
HistoryEvent[] | undefined

The list of events that occurred in the execution.

nextToken
string | undefined

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged. Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.

Throws

Name
Fault
Details
ExecutionDoesNotExist
client

The specified execution does not exist.

InvalidArn
client

The provided Amazon Resource Name (ARN) is not valid.

InvalidToken
client

The provided token is not valid.

KmsAccessDeniedException
client

Either your KMS key policy or API caller does not have the required permissions.

KmsInvalidStateException
client

The KMS key is not in valid state, for example: Disabled or Deleted.

KmsThrottlingException
client

Received when KMS returns ThrottlingException for a KMS call that Step Functions makes on behalf of the caller.

SFNServiceException
Base exception class for all service exceptions from SFN service.