Workflows Executions API Routes
These API routes allow you to track workflow executions in your MedusaGo application.
Depending on the workflow engine you use, executions may only be retained for a short while, or only until the MedusaGo application is restarted.
GET /admin/workflows-executions#
List Workflows Executions
Retrieve a list of workflows executions. The workflows executions can be filtered by fields such as id. The workflows executions can also be sorted or paginated.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Query parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.offsetnumberOptionallimitnumberOptionalorderstringOptional-.transaction_idstring | string[]Optionalworkflow_idstring | string[]OptionalqstringOptionalwith_deletedbooleanOptionalstatestring | string[]Optionalcreated_atobjectOptionalRequest examples
Responses
200 OK
limitnumberoffsetnumbercountnumberworkflow_executionsobject[]The workflows execution's workflow executions.
workflow_executionsobject[]400, 401, 404, 409, 422, 500: an error response is returned.
GET /admin/workflows-executions/{id}#
Get a Workflows Execution
Retrieve a workflows execution by its ID. You can expand the workflows execution's relations or select the fields that should be returned.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.Request examples
Responses
200 OK
workflow_executionobjectThe workflows execution's details.
workflow_executionobject400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/workflows-executions/{workflow_id}/run#
Execute a Workflow
Execute a workflow by its ID.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
workflow_idstringRequest body (application/json)
inputanyOptionaltransaction_idstringOptionalRequest examples
Responses
200 OK
acknowledgementobjectThe workflow's details
acknowledgementobject400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/workflows-executions/{workflow_id}/steps/failure#
Fail a Step in a Workflow's Execution
Set the status of a step in a workflow's execution as failed. This is useful for long-running workflows.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
workflow_idstringRequest body (application/json)
transaction_idstringstep_idstringresponseanyOptionalcompensate_inputanyOptionalaction"invoke" | "compensate"OptionalRequest examples
Responses
200 OK
successboolean400, 401, 404, 409, 422, 500: an error response is returned.
POST /admin/workflows-executions/{workflow_id}/steps/success#
Succeed a Step in a Workflow's Execution
Set the status of a step in a workflow's execution as successful. This is useful for long-running workflows.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
workflow_idstringRequest body (application/json)
transaction_idstringstep_idstringresponseanyOptionalcompensate_inputanyOptionalaction"invoke" | "compensate"OptionalRequest examples
Responses
200 OK
successboolean400, 401, 404, 409, 422, 500: an error response is returned.
GET /admin/workflows-executions/{workflow_id}/subscribe#
Subscribe to a Workflow's Execution
Subscribe to a workflow's execution to receive real-time information about its steps, status, and data. This route returns an event stream that you can consume using the EventSource API.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
workflow_idstringRequest examples
Responses
200 Stream of the step's status. The response body has the content type text/event-stream.
400, 401, 404, 409, 422, 500: an error response is returned.
GET /admin/workflows-executions/{workflow_id}/{transaction_id}#
Get Workflow Execution's Details
Get the details of the workflow's execution.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
workflow_idstringtransaction_idstringQuery parameters
fieldsstringOptional+ it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.Request examples
Responses
200 OK
workflow_executionobjectThe workflows execution's details.
workflow_executionobject400, 401, 404, 409, 422, 500: an error response is returned.
GET /admin/workflows-executions/{workflow_id}/{transaction_id}/subscribe#
Subscribe to Workflow Execution Events
Subscribe to workflow execution events for a specific workflow and transaction. This endpoint establishes a Server-Sent Events (SSE) connection, allowing clients to receive real-time updates about the workflow execution. The events include details such as the event type, workflow ID, transaction ID, step information, response, result, and any errors that occur during the execution.
Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.
Path parameters
workflow_idstringtransaction_idstringRequest examples
Responses
200 OK
400, 401, 404, 409, 422, 500: an error response is returned.