Automations built from a trigger, conditions and actions, and their executions.
A workflow starts when its trigger fires for a member and runs its conditions and actions for that member. Each run is recorded as an execution, with one node execution per step. Test runs and restarts are real runs: their actions really happen. Creating, updating, test-running and restarting workflows require a plan that includes Workflows.
workflowReturns a workflow, or null if it doesn't exist or was deleted.workflowsLists your workflows, newest first.workflowExecutionReturns an execution (one run of a workflow), or null if it doesn't exist.workflowExecutionsLists a workflow's executions, newest first, test runs included.workflowExecutionRestartRuns the workflow again for the same member with the same trigger values, as a new execution; the original stays as it was.workflowCreateCreates a workflow from a definition of trigger, condition and action nodes connected by edges.workflowUpdateReplaces a workflow's name, description, status and definition; nodes and edges missing from definition are deleted.workflowDeleteDeletes a workflow: events no longer start it, and it disappears from the API with its executions.workflowTestRunRuns a saved workflow once for one member from the trigger you pick, even if it is inactive, and returns before the run finishes; follow it with workflowExecution.Returns a workflow, or null if it doesn't exist or was deleted.
idID!RequiredAn automation that runs for a member when its trigger fires, through the conditions and actions in its definition.
idID!merchantIdID!Your merchant ID, shown under Settings in the Toki app.
nameString!descriptionStringisActiveBoolean!Whether events start the workflow, such as a member earning points. workflowTestRun works either way.
createdAtString!updatedAtString!deletedAtStringAlways null: deleted workflows aren't returned.
lastExecutionAtStringWhen its latest execution started, test runs included; null if it never ran, and in the results of workflowCreate and workflowUpdate.
definitionTokiWorkflowDefinition!The workflow's steps: trigger, condition and action nodes, and the edges that connect them.
executionsTokiWorkflowExecutionConnection!Runs of this workflow, newest first, test runs included.
Lists your workflows, newest first.
queryStringText in the workflow's name or description, case-insensitive.
reverseBooleanReverse the sort order.
A page of TokiWorkflow in nodes, with pageInfo for the next page. Each item:
An automation that runs for a member when its trigger fires, through the conditions and actions in its definition.
idID!merchantIdID!Your merchant ID, shown under Settings in the Toki app.
nameString!descriptionStringisActiveBoolean!Whether events start the workflow, such as a member earning points. workflowTestRun works either way.
createdAtString!updatedAtString!deletedAtStringAlways null: deleted workflows aren't returned.
lastExecutionAtStringWhen its latest execution started, test runs included; null if it never ran, and in the results of workflowCreate and workflowUpdate.
definitionTokiWorkflowDefinition!The workflow's steps: trigger, condition and action nodes, and the edges that connect them.
executionsTokiWorkflowExecutionConnection!Runs of this workflow, newest first, test runs included.
Returns an execution (one run of a workflow), or null if it doesn't exist. Select nodeExecutions to see what each step received and produced, and why a step failed.
idID!RequiredOne run of a workflow for a member; test runs and restarts are executions too.
idID!executionIdID!Same as id.
workflowIdID!The workflow that ran.
merchantIdID!Your merchant ID, shown under Settings in the Toki app.
userIdIDThe member the workflow ran for.
userEmailStringThe email of the member in userId.
userNameStringThe name of the member in userId.
shopIdIDThe store the workflow ran in.
triggerKindString!The trigger that started the run, such as points_earned or timer_triggered.
statusString!running, completed or failed. A run paused on a wait step stays running.
startedAtStringcompletedAtStringWhen the run completed or failed; null while it is running.
createdAtString!initialContextTokiJSONWhat the run started with: the trigger's values in variables, plus the run's IDs.
finalContextTokiJSONThe data after the last step that ran, with the variables the steps added; null while the run is in progress.
errorStringWhy the run failed.
nodeExecutions[TokiWorkflowNodeExecution!]!The steps that ran, in the order they started.
Lists a workflow's executions, newest first, test runs included.
reverseBooleanReverse the sort order.
workflowIdID!RequiredThe workflow whose executions to list.
A page of TokiWorkflowExecution in nodes, with pageInfo for the next page. Each item:
One run of a workflow for a member; test runs and restarts are executions too.
idID!executionIdID!Same as id.
workflowIdID!The workflow that ran.
merchantIdID!Your merchant ID, shown under Settings in the Toki app.
userIdIDThe member the workflow ran for.
userEmailStringThe email of the member in userId.
userNameStringThe name of the member in userId.
shopIdIDThe store the workflow ran in.
triggerKindString!The trigger that started the run, such as points_earned or timer_triggered.
statusString!running, completed or failed. A run paused on a wait step stays running.
startedAtStringcompletedAtStringWhen the run completed or failed; null while it is running.
createdAtString!initialContextTokiJSONWhat the run started with: the trigger's values in variables, plus the run's IDs.
finalContextTokiJSONThe data after the last step that ran, with the variables the steps added; null while the run is in progress.
errorStringWhy the run failed.
nodeExecutions[TokiWorkflowNodeExecution!]!The steps that ran, in the order they started.
Runs the workflow again for the same member with the same trigger values, as a new execution; the original stays as it was. The workflow must be active; it runs as currently saved, and its actions happen again for real. Requires a plan that includes Workflows.
executionIdID!RequiredThe execution to run again.
The execution that workflowTestRun or workflowExecutionRestart started.
workflowIdID!The workflow that runs.
executionIdID!The new execution; follow it with workflowExecution.
Creates a workflow from a definition of trigger, condition and action nodes connected by edges. It stays inactive unless you set isActive to true, and every node and edge needs a new UUID as its id. Requires a plan that includes Workflows.
nameString!RequiredThe workflow's name; it can't be empty.
descriptionStringOptional notes about the workflow. Leaving it out, or sending null, saves none.
isActiveBooleanWhether events start the workflow. Defaults to false, also in workflowUpdate.
definitionTokiWorkflowDefinitionInput!RequiredThe workflow's nodes and the edges that connect them, saved as a whole.
An automation that runs for a member when its trigger fires, through the conditions and actions in its definition.
idID!merchantIdID!Your merchant ID, shown under Settings in the Toki app.
nameString!descriptionStringisActiveBoolean!Whether events start the workflow, such as a member earning points. workflowTestRun works either way.
createdAtString!updatedAtString!deletedAtStringAlways null: deleted workflows aren't returned.
lastExecutionAtStringWhen its latest execution started, test runs included; null if it never ran, and in the results of workflowCreate and workflowUpdate.
definitionTokiWorkflowDefinition!The workflow's steps: trigger, condition and action nodes, and the edges that connect them.
executionsTokiWorkflowExecutionConnection!Runs of this workflow, newest first, test runs included.
Replaces a workflow's name, description, status and definition; nodes and edges missing from definition are deleted. Omitting isActive sets it to false and omitting description clears it. Requires a plan that includes Workflows.
nameString!RequiredThe workflow's name; it can't be empty.
descriptionStringOptional notes about the workflow. Leaving it out, or sending null, saves none.
isActiveBooleanWhether events start the workflow. Defaults to false, also in workflowUpdate.
definitionTokiWorkflowDefinitionInput!RequiredThe workflow's nodes and the edges that connect them, saved as a whole.
idID!RequiredAn automation that runs for a member when its trigger fires, through the conditions and actions in its definition.
idID!merchantIdID!Your merchant ID, shown under Settings in the Toki app.
nameString!descriptionStringisActiveBoolean!Whether events start the workflow, such as a member earning points. workflowTestRun works either way.
createdAtString!updatedAtString!deletedAtStringAlways null: deleted workflows aren't returned.
lastExecutionAtStringWhen its latest execution started, test runs included; null if it never ran, and in the results of workflowCreate and workflowUpdate.
definitionTokiWorkflowDefinition!The workflow's steps: trigger, condition and action nodes, and the edges that connect them.
executionsTokiWorkflowExecutionConnection!Runs of this workflow, newest first, test runs included.
Deletes a workflow: events no longer start it, and it disappears from the API with its executions. Runs already in progress aren't stopped.
idID!Requiredtrue when the change was made. Anything that stops it comes back as an error.
Runs a saved workflow once for one member from the trigger you pick, even if it is inactive, and returns before the run finishes; follow it with workflowExecution. It is a real run: the actions on its path really happen, such as emails sent or points credited. Requires a plan that includes Workflows.
workflowIdID!RequiredThe workflow to run.
customerIdID!RequiredThe member to run the workflow for, by member ID (TokiUser.id), not their Shopify customer ID.
triggerNodeIdString!RequiredThe id of the trigger node to start from, as in the workflow's definition.
variablesTokiJSONThe trigger's values for this run as a JSON object, such as {"amount": 50} for points_earned. Steps read them as variables.
The execution that workflowTestRun or workflowExecutionRestart started.
workflowIdID!The workflow that runs.
executionIdID!The new execution; follow it with workflowExecution.