See Stacksync in action with a solution architect. Book a demo ↗
GeniesTasks

Genie tasks

Create a Genie task

POST
/v1/workspaces/{workspace_id}/genies/{genie_id}/tasks

Gives a Genie a task to run once (run_at) or on a cron schedule (UTC). An editor role is required: a task makes the genie act in the apps it is connected to.

Authorization

Authorizationstringheaderrequired

Bearer <key>, where <key> is a workspace API key or a user API key. See Authentication.

Path Parameters

workspace_id*integer

The workspace. List the ones your key can reach with GET /v1/workspaces.

genie_id*string

The Genie.

Formatuuid

Query Parameters

region*Regions

Region of the genie: besg (Europe) or usnv (United States)

Value in"besg""usnv"

Header Parameters

Idempotency-Key?|

Makes the create retry-safe for 24 hours: a retry with the same key answers the resource the first call created, with the Idempotent-Replayed: true header, and creates nothing. 1 to 255 visible ASCII characters. The same key with a different request answers 422; while the first call still runs, 409.

Defaultnull

Request Body

application/json
  1. body
name*Name

Unique among the workspace's cron tasks of the region

Length1 <= length <= 255
instruction*Instruction

What the genie is asked each time the task runs

Length1 <= length
cron_expression?|

Run on this cron schedule (UTC), e.g. '0 8 * * 1-5'; or run_at

Defaultnull
run_at?|

Run once at this time (future), ISO 8601; or cron_expression

Defaultnull
start_time?|

With cron_expression: the schedule starts after this time

Defaultnull
is_shared_with_workspace?Is Shared With Workspace
Defaulttrue
validate_only?Validate Only

Run every check of the write and answer 204 without writing: a refused write answers the error the write would

Defaultfalse

Response Body

Created

application/json
  1. response
task_id*Task Id
name?|
Defaultnull
instruction?|

What the genie is asked each time

Defaultnull
cron_expression?|
Defaultnull
run_at?|

For a one-time task: when it runs, ISO 8601

Defaultnull
start_time?|

For a scheduled task: when the schedule starts

Defaultnull
next_run_time?|
Defaultnull
is_paused?|
Defaultnull
is_shared_with_workspace?|
Defaultnull
created_time?|
Defaultnull
Create a Genie task
curl -X POST 'https://api.stacksync.com/v1/workspaces/0/genies/497f6eca-6276-4993-bfeb-53cbbbba6f08/tasks?region=besg' \  -H 'Content-Type: application/json' \  -d '{  "cron_expression": "0 8 * * 1-5",  "instruction": "Summarize the deals that changed stage yesterday",  "name": "Weekday sales summary"}'
{  "task_id": "<task_id>",  "name": "<name>",  "instruction": "<instruction>",  "cron_expression": "<cron_expression>",  "run_at": "<run_at>",  "start_time": "<start_time>",  "next_run_time": "<next_run_time>",  "is_paused": false,  "is_shared_with_workspace": false,  "created_time": "<created_time>"}