Skip to content

Test an automation on a past event

POST
/v1/automations/test-run
curl --request POST \
--url https://api.pixonaut.app/v1/automations/test-run \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "draft": { "body": { "steps": [ { "id": "print", "settings": {}, "type": "create_print" } ] }, "runsAs": "author", "sources": { "includeNewKeys": true, "includeNewLinks": true, "includeNewStores": true, "keys": null, "links": null, "stores": null }, "spendLimit": 50, "trigger": "design.committed" }, "eventId": "evt_5a1c9e7b2d4f" }'

Operation ID: automations.testRun

What it would have done: each condition with the values compared, each step blocked and why or run, its placeholders rendered and the limits a spend would count against. A wait does not wait. Nothing is moved, sent or stored, and a test run is never a firing.

Media typeapplication/json
object
automationId

A saved automation, by its id. Name it or draft.

string
draft

A draft, as the editor holds it. Name it or automationId.

object
body
required

The automation’s tree of steps.

object
conditions
Any of:
object
all
required

Every one holds.

Array
>= 1 items
steps
required

The steps, in the order they run. A step’s type names an action from the catalogue.

Array<object>
object
branches

Further steps, under each branch’s name.

object
key
additional properties
Array
id
required

Its id, unique in the body: what a firing names it by.

string
>= 1 characters <= 64 characters
settings

What its type takes; the draft check refuses settings the type does not.

object
key
additional properties
type
required

Its action (approve, create_print, place_order, reroute, cancel_order, notify, email, webhook) or flow step (only_if, paths, wait_for, delay).

string
>= 1 characters <= 64 characters
runsAs

author: it acts with the grants of the member who last saved it. workspace: it acts as the workspace, tied to no member; only an admin may set it, and an automation made with a secret key always runs so.

string
default: author
Allowed values: author workspace
sources

The sources it acts on: the studio always; designer links, keys and connected stores, each every one or a snapshot. To act on only some, an Only if compares the design’s origin.

object
includeNewKeys
required

On, it acts on designs from every secret and publishable key no store was given, those added later too. Off, only from those in keys.

boolean
includeNewLinks
required

On, it acts on designs from every designer link, those made later too. Off, only from the links in links.

boolean
includeNewStores
required

On, it acts on designs from every connected store, those connected later too. Off, only from those in stores. A store may have its own automated flows on its designs; if it does, the first to move one on wins.

boolean
keys

While its switch is off, those that existed when it was switched off; null while it is on. A save that turns it off with none takes it then.

object
sources
required

Each one that existed then, as a design’s origin names it: link:<id>, secret_key:<id> and publishable_key:<id>, or store:<site>.

Array<string>
<= 10000 items
takenAt
required

When its switch was turned off: the snapshot is as of then.

integer
links

While its switch is off, those that existed when it was switched off; null while it is on. A save that turns it off with none takes it then.

object
sources
required

Each one that existed then, as a design’s origin names it: link:<id>, secret_key:<id> and publishable_key:<id>, or store:<site>.

Array<string>
<= 10000 items
takenAt
required

When its switch was turned off: the snapshot is as of then.

integer
stores

While its switch is off, those that existed when it was switched off; null while it is on. A save that turns it off with none takes it then.

object
sources
required

Each one that existed then, as a design’s origin names it: link:<id>, secret_key:<id> and publishable_key:<id>, or store:<site>.

Array<string>
<= 10000 items
takenAt
required

When its switch was turned off: the snapshot is as of then.

integer
spendLimit

Spend actions it may take per rolling 24 hours.

integer
default: 50 >= 1 <= 10000
trigger
required

The event it fires on; null for none yet, which fires on nothing. One with none cannot be enabled.

string | null
Allowed values: design.committed design.approved design.changes_requested design.delivery_captured print.completed print.failed order.submitted order.status_changed order.failed order.cancelled order.delivery_changed
eventId
required

The past event to test on, as the events found name it.

string

Examples

Exampleexample

Example

{
"draft": {
"body": {
"steps": [
{
"id": "print",
"settings": {},
"type": "create_print"
}
]
},
"runsAs": "author",
"sources": {
"includeNewKeys": true,
"includeNewLinks": true,
"includeNewStores": true,
"keys": null,
"links": null,
"stores": null
},
"spendLimit": 50,
"trigger": "design.committed"
},
"eventId": "evt_5a1c9e7b2d4f"
}

What it would have done

Media typeapplication/json
object
conditions
required

Its conditions, each with the values compared; null for none.

object
holds
required
boolean
leaves
required
Array<object>
object
field
required
string
has
required
Any of:
Array<string>
holds
required
boolean
path
required

Where it sits in the tree, as all.0.not; empty for a tree of one.

string
wants
required
object
key
additional properties
event
required
object
at
required
number
id
required
string
type
required
string
fires
required

Whether the automation would fire on it.

boolean
reason
required

Why it would not fire.

string | null
steps
required

Every step, in order, branches after their step: what it would do.

Array<object>
object
branch
required
Array<string>
label
required
string | null
outcome
required
string
printshops
required

The printshop it would act at, and what it could do.

Array
One of:
object
can
required
string
Allowed values: yes
id
required
string
name
required
string
reason
required

Why it is blocked, would pause or would stop; what a wait or a delay would wait for; the path a choice of paths would take.

string | null
rendered
required

Its placeholders as they render for this event. Empty for an MCP key: a text written to an order’s own printshop may name its customer.

object
key
additional properties
string
spend
required

The limits a spend action counts against, as they would stand when it ran.

object
automation
required
object
limit
required
number
used
required
number
workspace
required
object
ceiling
required
number
used
required
number
stepId
required
string
type
required
string
subject
required

What it was about, by id.

object
designId
string
orderId
string
printId
string
revision
number

Examples

Exampleexample

Example

{
"conditions": {
"holds": true,
"leaves": [
{
"field": "origin",
"has": [
"studio"
],
"holds": true,
"path": "",
"wants": {
"in": [
"studio"
]
}
}
]
},
"event": {
"at": 1760000300000,
"id": "evt_5a1c9e7b2d4f",
"type": "design.committed"
},
"fires": true,
"reason": null,
"steps": [
{
"branch": [],
"label": null,
"outcome": "would_run",
"printshops": [],
"reason": null,
"rendered": {},
"spend": {
"automation": {
"limit": 50,
"used": 3
},
"workspace": {
"ceiling": 500,
"used": 12
}
},
"stepId": "print",
"type": "create_print"
},
{
"branch": [],
"label": "Order one copy",
"outcome": "blocked",
"printshops": [
{
"can": "yes",
"id": "psc_4e8a9f6c1d2e",
"name": "Printful"
}
],
"reason": "The printshop “Riso Corner” is paused and takes no new orders.",
"rendered": {},
"spend": {
"automation": {
"limit": 50,
"used": 4
},
"workspace": {
"ceiling": 500,
"used": 13
}
},
"stepId": "order",
"type": "place_order"
},
{
"branch": [
"onFailure"
],
"label": null,
"outcome": "not_reached",
"printshops": [],
"reason": null,
"rendered": {},
"spend": null,
"stepId": "tell",
"type": "notify"
}
],
"subject": {
"designId": "des_2b4d8a9f6c1e",
"revision": 2
}
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: invalid_body

Media typeapplication/json
object
error
required
string
fields

Always sent with invalid_body.

Array<string>

Examples

Exampleinvalid_body

invalid_body

{
"error": "invalid_body",
"fields": [
"string"
]
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: unauthorized

Media typeapplication/json
object
error
required
string

Examples

Exampleunauthorized

unauthorized

{
"error": "unauthorized"
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: feature_disabled, origin_forbidden, forbidden

Media typeapplication/json
object
error
required
string
feature

The feature the tenant does not have. Always sent with feature_disabled.

string

Examples

feature_disabled

{
"error": "feature_disabled",
"feature": "api"
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: automation_not_found, event_not_found

Media typeapplication/json
object
error
required
string

Examples

automation_not_found

{
"error": "automation_not_found"
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: payload_too_large

Media typeapplication/json
object
bytes
number
error
required
string
maxBytes

Always sent with payload_too_large.

number

Examples

Examplepayload_too_large

payload_too_large

{
"error": "payload_too_large",
"maxBytes": 0
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Refused: db_error. A request that failed unexpectedly answers as text instead.

object
error
required
string

Examples

Exampledb_error

db_error

{
"error": "db_error"
}
X-Request-Id
required
string

Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.

Questions? Write to [email protected].

Status · Terms of service · Privacy policy · Subprocessors