FlowRun
A FlowRun is the result object of running a Flow for a specific Site. Essentially, FlowRuns allow the user to reuse Flows for multiple Sites across the application. A FlowRun contains all the same components as it's associated Flow as well as expanded information for each node.
FlowRun object
{
"id": "c97021d2-dfd7-43ee-b9f5-136f49f3062d",
"user": "dev@example.com",
"account": "8d4075a8-5ba0-48c9-9735-b989595edad5",
"flow": "cc5a0ede-1aff-4eff-8040-9f4c0783f043",
"time_created": "2024-11-15T18:01:32.835728Z",
"title": "Dual Step Flow",
"nodes": [
{
"id": "1",
"data": {
"id": "1",
"uri": "",
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"email": "",
"status": "queued",
"case_id": null,
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": "",
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"headers": "{}",
"message": "",
"objects": [],
"payload": "{}",
"subject": "",
"updates": null,
"maxConds": 4,
"maxNodes": 12,
"parentId": null,
"position": {
"x": 0,
"y": 0
},
"start_if": null,
"finalized": false,
"task_type": "scan",
"threshold": 95,
"conditions": null,
"phone_number": "",
"request_type": "GET",
"time_started": null,
"time_completed": null
},
"type": "basic",
"measured": {
"width": 272,
"height": 48
},
"parentId": null,
"position": {
"x": 0,
"y": 0
}
},
{
"id": "2",
"data": {
"id": "2",
"uri": "",
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"email": "",
"status": "queued",
"case_id": null,
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": null,
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"headers": "{}",
"message": "This is a test message",
"objects": [],
"payload": "{}",
"subject": "",
"updates": null,
"maxConds": 4,
"maxNodes": 12,
"parentId": "1",
"position": {
"x": 0,
"y": 150
},
"start_if": null,
"finalized": false,
"task_type": "slack",
"threshold": 95,
"conditions": null,
"phone_number": "",
"request_type": "GET",
"time_started": null,
"time_completed": null
},
"type": "basic",
"measured": {
"width": 272,
"height": 48
},
"parentId": "1",
"position": {
"x": 0,
"y": 150
}
}
],
"edges": [
{
"id": "1",
"type": "smoothstep",
"style": null,
"source": "1",
"target": "2",
"animated": false
}
],
"status": "working",
"time_completed": null,
"logs": [
{
"timestamp": "2024-11-15 18:01:32.833712",
"message": "system starting up for run_id: c97021d2-dfd7-43ee-b9f5-136f49f3062d",
"step": "1"
}
],
"site": "f4f6e6c1-037f-45e4-8cf4-2979f12d2cf0",
"configs": {
"end_on_fail": true
}
}
Create a FlowRun
This endpoint allows the creation task to run asynchronously on the server and resolves quickly. Depending on the lenght of the associated Flow, this process may take several minutes to complete.
data in this request:
"data": {
"site_id": "<site:id>", // <required> uuid of the Site you want to run the Flow for
"flow_id": "<flow:id>", // <required> uuid of the Flow you want to run
"configs": { // <optional> configs object
"end_on_fail": true, // bool, true if flow should terminate on the first failed job
},
}
POST - /flowrun
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{CURSION_API_BASE_URL}/flowrun'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
data = {
"site_id": "<site:id>",
"flow_id": "<flow:id>",
"configs": {
"end_on_fail": True,
},
}
# send the request
res = requests.post(
url=url,
headers=headers,
data=json.dumps(data)
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"id": "c97021d2-dfd7-43ee-b9f5-136f49f3062d",
"user": "dev@example.com",
"account": "8d4075a8-5ba0-48c9-9735-b989595edad5",
"flow": "cc5a0ede-1aff-4eff-8040-9f4c0783f043",
"time_created": "2024-11-15T18:01:32.835728Z",
"title": "Dual Step Flow",
"nodes": [
{
"id": "1",
"data": {
"id": "1",
"uri": "",
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"email": "",
"status": "queued",
"case_id": null,
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": "",
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"headers": "{}",
"message": "",
"objects": [],
"payload": "{}",
"subject": "",
"updates": null,
"maxConds": 4,
"maxNodes": 12,
"parentId": null,
"position": {
"x": 0,
"y": 0
},
"start_if": null,
"finalized": false,
"task_type": "scan",
"threshold": 95,
"conditions": null,
"phone_number": "",
"request_type": "GET",
"time_started": null,
"time_completed": null
},
"type": "basic",
"measured": {
"width": 272,
"height": 48
},
"parentId": null,
"position": {
"x": 0,
"y": 0
}
},
{
"id": "2",
"data": {
"id": "2",
"uri": "",
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"email": "",
"status": "queued",
"case_id": null,
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": null,
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"headers": "{}",
"message": "This is a test message",
"objects": [],
"payload": "{}",
"subject": "",
"updates": null,
"maxConds": 4,
"maxNodes": 12,
"parentId": "1",
"position": {
"x": 0,
"y": 150
},
"start_if": null,
"finalized": false,
"task_type": "slack",
"threshold": 95,
"conditions": null,
"phone_number": "",
"request_type": "GET",
"time_started": null,
"time_completed": null
},
"type": "basic",
"measured": {
"width": 272,
"height": 48
},
"parentId": "1",
"position": {
"x": 0,
"y": 150
}
}
],
"edges": [
{
"id": "1",
"type": "smoothstep",
"style": null,
"source": "1",
"target": "2",
"animated": false
}
],
"status": "working",
"time_completed": null,
"logs": [
{
"timestamp": "2024-11-15 18:01:32.833712",
"message": "system starting up for run_id: c97021d2-dfd7-43ee-b9f5-136f49f3062d",
"step": "1"
}
],
"site": "f4f6e6c1-037f-45e4-8cf4-2979f12d2cf0",
"configs": {
"end_on_fail": true
}
}
Retrieve a FlowRun
This endpoint returns a single FlowRun object and is useful as a simple "detailed view" of the flowrun.
GET - /flowrun/<flowrun:id>
import requests, os
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{BASE_URL}/flowrun/<flowrun:id>'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
# send the request
res = requests.get(
url=url,
headers=headers,
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"id": "c97021d2-dfd7-43ee-b9f5-136f49f3062d",
"user": "dev@example.com",
"account": "8d4075a8-5ba0-48c9-9735-b989595edad5",
"flow": "cc5a0ede-1aff-4eff-8040-9f4c0783f043",
"time_created": "2024-11-15T18:01:32.835728Z",
"title": "Dual Step Flow",
"nodes": [
{
"id": "1",
"data": {
"id": "1",
"uri": "",
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"email": "",
"status": "queued",
"case_id": null,
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": "",
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"headers": "{}",
"message": "",
"objects": [],
"payload": "{}",
"subject": "",
"updates": null,
"maxConds": 4,
"maxNodes": 12,
"parentId": null,
"position": {
"x": 0,
"y": 0
},
"start_if": null,
"finalized": false,
"task_type": "scan",
"threshold": 95,
"conditions": null,
"phone_number": "",
"request_type": "GET",
"time_started": null,
"time_completed": null
},
"type": "basic",
"measured": {
"width": 272,
"height": 48
},
"parentId": null,
"position": {
"x": 0,
"y": 0
}
},
{
"id": "2",
"data": {
"id": "2",
"uri": "",
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"email": "",
"status": "queued",
"case_id": null,
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": null,
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"headers": "{}",
"message": "This is a test message",
"objects": [],
"payload": "{}",
"subject": "",
"updates": null,
"maxConds": 4,
"maxNodes": 12,
"parentId": "1",
"position": {
"x": 0,
"y": 150
},
"start_if": null,
"finalized": false,
"task_type": "slack",
"threshold": 95,
"conditions": null,
"phone_number": "",
"request_type": "GET",
"time_started": null,
"time_completed": null
},
"type": "basic",
"measured": {
"width": 272,
"height": 48
},
"parentId": "1",
"position": {
"x": 0,
"y": 150
}
}
],
"edges": [
{
"id": "1",
"type": "smoothstep",
"style": null,
"source": "1",
"target": "2",
"animated": false
}
],
"status": "working",
"time_completed": null,
"logs": [
{
"timestamp": "2024-11-15 18:01:32.833712",
"message": "system starting up for run_id: c97021d2-dfd7-43ee-b9f5-136f49f3062d",
"step": "1"
}
],
"site": "f4f6e6c1-037f-45e4-8cf4-2979f12d2cf0",
"configs": {
"end_on_fail": true
}
}
Retrieve many FlowRuns
This endpoint returns a paginated response with all FlowRuns objects filtered by your account and ordered by time_created. This endpoint is useful when needing to displaying your flowruns in a table view for example.
The limit parameter specifies the total number of objects you want returned per "group" (we recommend keeping this under 10 for best performance). The offset parameter specfies which "group" to return. For example, limit=10&offset=10 in a total dataset of 30 objects would return 10 flowruns in range flowrun #10 - flowrun #20.
Info
You may optionally pass a site_id=<site:id> to filter the FlowRuns by a specific Site.
GET - /flowrun?limit=10&offset=0
import requests, os
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{BASE_URL}/flowrun?limit=10&offset=0'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
# send the request
res = requests.get(
url=url,
headers=headers,
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"count":30,
"next":"https://api.cursion.dev/v1/ops/flowrun?limit=10&offset=20",
"previous":"https://api.cursion.dev/v1/ops/flowrun?limit=10&offset=10",
"results":[
{
"id": "c97021d2-dfd7-43ee-b9f5-136f49f3062d",
"user": "dev@example.com",
"account": "8d4075a8-5ba0-48c9-9735-b989595edad5",
"flow": "cc5a0ede-1aff-4eff-8040-9f4c0783f043",
"time_created": "2024-11-15T18:01:32.835728Z",
"title": "Dual Step Flow",
"nodes": [
{
"id": "1",
"data": {
"id": "1",
"uri": "",
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"email": "",
"status": "queued",
"case_id": null,
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": "",
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"headers": "{}",
"message": "",
"objects": [],
"payload": "{}",
"subject": "",
"updates": null,
"maxConds": 4,
"maxNodes": 12,
"parentId": null,
"position": {
"x": 0,
"y": 0
},
"start_if": null,
"finalized": false,
"task_type": "scan",
"threshold": 95,
"conditions": null,
"phone_number": "",
"request_type": "GET",
"time_started": null,
"time_completed": null
},
"type": "basic",
"measured": {
"width": 272,
"height": 48
},
"parentId": null,
"position": {
"x": 0,
"y": 0
}
},
{
"id": "2",
"data": {
"id": "2",
"uri": "",
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"email": "",
"status": "queued",
"case_id": null,
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": null,
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"headers": "{}",
"message": "This is a test message",
"objects": [],
"payload": "{}",
"subject": "",
"updates": null,
"maxConds": 4,
"maxNodes": 12,
"parentId": "1",
"position": {
"x": 0,
"y": 150
},
"start_if": null,
"finalized": false,
"task_type": "slack",
"threshold": 95,
"conditions": null,
"phone_number": "",
"request_type": "GET",
"time_started": null,
"time_completed": null
},
"type": "basic",
"measured": {
"width": 272,
"height": 48
},
"parentId": "1",
"position": {
"x": 0,
"y": 150
}
}
],
"edges": [
{
"id": "1",
"type": "smoothstep",
"style": null,
"source": "1",
"target": "2",
"animated": false
}
],
"status": "working",
"time_completed": null,
"logs": [
{
"timestamp": "2024-11-15 18:01:32.833712",
"message": "system starting up for run_id: c97021d2-dfd7-43ee-b9f5-136f49f3062d",
"step": "1"
}
],
"site": "f4f6e6c1-037f-45e4-8cf4-2979f12d2cf0",
"configs": {
"end_on_fail": true
}
}
### SHORTENED FOR DISPLAY PURPOSES ###
]
}
Delete a FlowRun
Caution
Please use caution with this endpoint as it is irreversible.
DELETE - /flowrun/<tesflowt:id>
import requests, os
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{BASE_URL}/flowrun/<flowrun:id>'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
# send the request
res = requests.delete(
url=url,
headers=headers,
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"message": "flowrun deleted successfully"
}
