curl https://qstash.upstash.io/v2/workflows/messageLogs \
-H "Authorization: Bearer <token>"
{
"cursor" : "" ,
"events" : [
{
"time" : 1738788333107 ,
"state" : "CREATED" ,
"workflowRunId" : "wfr_6MXE3GfddpBMWJM7s5WSRPqwcFm8" ,
"workflowUrl" : "http://my-workflow-server.com/workflowEndpoint" ,
"workflowCreatedAt" : 1738788333105 ,
"stepInfo" : {
"stepName" : "init" ,
"stepType" : "Initial" ,
"callType" : "step" ,
"messageId" : "msg_2KxeAKGVEjwDjNK1TVPormoRf7shRyNBpPThVbpvkuZNqri4cXp5nwSajNzAs6UWakvbco3qEPvtjQU3qxqjWarm2kisK" ,
"concurrent" : 1 ,
"createdAt" : 1738788333106
} ,
"nextDeliveryTime" : 1738788333106
} ,
{
"time" : 1738788333107 ,
"state" : "RUN_STARTED" ,
"workflowRunId" : "wfr_6MXE3GfddpBMWJM7s5WSRPqwcFm8" ,
"workflowUrl" : "http://my-workflow-server.com/workflowEndpoint" ,
"workflowCreatedAt" : 1738788333105
}
]
}
The message logs provide a more detailed version of the List Workflow Runs
API . If you need an overview of a workflow run,
that API is more useful, as it returns grouped and processed data.
Each step in a workflow is associated with a message. During its lifecycle, a message generates multiple logs.
For example, when you trigger a workflow, a message is created to execute the first step of the workflow. This message logs a CREATED
state and then waits to be processed by the server. Once successfully processed, it logs a DELIVERED
state. Some data may be duplicated across these events.
In addition to logs generated by messages, we also generate some logs at the workflow run level. For instance, when a workflow is triggered, we log a RUN_STATED
state. Similarly, we log RUN_FAILED
, RUN_SUCCESS
, and other states to track execution status.
The flat view returns all logs generated by a workflow run in their raw format. By checking the flat view, you can see all the lifecycle of workflow run.
Request
By providing a cursor you can paginate through all of the workflow runs.
Filters logs by workflow run ID.
Filters logs by the workflow server URL.
Filters logs by creation date of workflow run (Unix timestamp in
milliseconds).
Filter logs by state, either the state of an individual message or by a state that is generated at the workflow level.
Refer to Debug Logs page for the list of states of an individual message.
The list of states at the workflow level:
Value Description RUN_STARTED
The workflow has started to run and currently in progress. RUN_SUCCESS
The workflow run has completed succesfully. RUN_FAILED
Some errors has occured and workflow failed after all retries. RUN_CANCELED
The workflow run has canceled upon user request. WAITER_ADDED
A new waiter is registered for this workflow run. INVOKED
A new workflow run started by this workflow.
Filter logs by message ID of a particular step
Filters logs by creation date of workflow run (Unix timestamp in
milliseconds).
Filters logs starting from this date (Unix timestamp in milliseconds,
inclusive).
Filters logs ending at this date (Unix timestamp in milliseconds, inclusive).
Specifies the number of logs to return (default and max: 1000).
Response
Each field in the logs is associated with the workflow run and the steps that flushed it.
A cursor which you can use in subsequent requests to paginate through all
logs. If no cursor is returned, you have reached the end of the logs.
The Unix timestamp (in milliseconds) indicating when the log was flushed.
The state of the step or workflow run, depending on the log type.
The ID of the workflow run.
The URL address of the workflow server.
The Unix timestamp (in milliseconds) when the workflow run started.
The HTTP headers of the message associated with this step. Only set if the state is ERROR
.
The error text if this message has failed. Only set if the state is ERROR
.
The HTTP response status returned by the workflow server. Only set if the state is ERROR
.
The HTTP response body returned by the workflow server. Only set if the state is ERROR
.
The HTTP response headers returned by the workflow server. Only set if the state is ERROR
.
The ID of the invoker workflow, if this workflow was triggered by another workflow. Only set if the state is RUN_STARTED
.
The unix timestamp in milliseconds when the invoker workflow was started, if this workflow was triggered by another workflow. Only set if the state is RUN_STARTED
.
The URL of invoker workflow server, if this workflow was triggered by another workflow. Only set if the state is RUN_STARTED
.
The response returned by workflow if it has succesfully terminated. Only set if the state is RUN_SUCCESS
The details of the step executed by this message. Available only if this log was flushed for a message, not at the workflow level like RUN_STARTED
.
The ID of the step which increases monotonically.
The name of the step. It is specified in workflow by user.
Execution type of the step which indicates type of the context function.
Value Function Initial
The default step which created automatically Run
context.run() Call
context.call() SleepFor
context.sleepFor() SleepUntil
context.sleepUntil() Wait
context.waitForEvent() Notify
context.notify() Invoke
context.invoke()
The ID of the message associated with this step.
The output returned by the step
The total number of concurrent steps that is running alongside this step
The unix timestamp in milliseconds when the message associated with this step has created.
The following fields are set only when a specific type of step is executing. These fields are not available for all step types.
The unix timestamp (in milliseconds) which step will sleep until. Only set if stepType is SleepUntil
.
The duration in milliseconds which step will sleep. Only set if stepType is SleepFor
.
The URL of the external address. Available only if stepType is Call
.
The HTTP method of the request sent to the external address. Available only if stepType is Call
.
The HTTP headers of the request sent to the external address. Available only if stepType is Call
.
The body of the request sent to the external address. Available only if stepType is Call
.
The HTTP status returned by the external call. Available only if stepType is Call
.
The body returned by the external call. Available only if stepType is Call
.
The HTTP headers returned by the external call. Available only if stepType is Call
.
The event id of the wait step. Only set if stepType is Wait
.
The unix timestamp (in milliseconds) when the wait will time out.
The duration of timeout in human readable format (e.g. 120s, 1m, 1h).
Set to true if this step is cause of a wait timeout rather than notifying the waiter.
The ID of the invoked workflow run if this step is an invoke step.
The URL address of the workflow server of invoked workflow run if this step is an invoke step.
The Unix timestamp (in milliseconds) when the invoked workflow was started if this step is an invoke step.
The body passed to the invoked workflow if this step is an invoke step.
The HTTP headers passed to invoked workflow if this step is an invoke step.
curl https://qstash.upstash.io/v2/workflows/messageLogs \
-H "Authorization: Bearer <token>"
{
"cursor" : "" ,
"events" : [
{
"time" : 1738788333107 ,
"state" : "CREATED" ,
"workflowRunId" : "wfr_6MXE3GfddpBMWJM7s5WSRPqwcFm8" ,
"workflowUrl" : "http://my-workflow-server.com/workflowEndpoint" ,
"workflowCreatedAt" : 1738788333105 ,
"stepInfo" : {
"stepName" : "init" ,
"stepType" : "Initial" ,
"callType" : "step" ,
"messageId" : "msg_2KxeAKGVEjwDjNK1TVPormoRf7shRyNBpPThVbpvkuZNqri4cXp5nwSajNzAs6UWakvbco3qEPvtjQU3qxqjWarm2kisK" ,
"concurrent" : 1 ,
"createdAt" : 1738788333106
} ,
"nextDeliveryTime" : 1738788333106
} ,
{
"time" : 1738788333107 ,
"state" : "RUN_STARTED" ,
"workflowRunId" : "wfr_6MXE3GfddpBMWJM7s5WSRPqwcFm8" ,
"workflowUrl" : "http://my-workflow-server.com/workflowEndpoint" ,
"workflowCreatedAt" : 1738788333105
}
]
}