Skip to content

Preview applying an automation to past events

POST
/v1/automations/{id}/past-events/preview
curl --request POST \
--url https://api.pixonaut.app/v1/automations/example/past-events/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "from": 1759913600000, "to": 1760000000000 }'

Operation ID: automations.pastEventsPreview

How many events of its trigger a window holds (at most 500, over at most 30 days), and a test run on the newest. Nothing is fired.

id
required
string
Media typeapplication/json
object
from
required

The window’s start, inclusive.

number
to
required

The window’s end, inclusive; not in the future.

number

Examples

Exampleexample

Example

{
"from": 1759913600000,
"to": 1760000000000
}

What applying it would fire on

Media typeapplication/json
object
events
required

How many events the window holds.

number
spends
required

Whether it holds a spend action: applying it needs the spend confirmation.

boolean
testRun
required

A test run on the newest; null for an empty window.

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

{
"events": 14,
"spends": true,
"testRun": {
"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

Media typeapplication/json
object
error
required
string

Examples

Exampleautomation_not_found

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: automation_disabled

Media typeapplication/json
object
error
required
string
reason

Always sent with automation_disabled.

string

Examples

Exampleautomation_disabled

automation_disabled

{
"error": "automation_disabled",
"reason": "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: window_refused, payload_too_large

Media typeapplication/json
object
bytes

Sent with payload_too_large.

number
error
required
string
events

How many events the window holds, when there are too many. Sent with window_refused.

number
maxBytes

Always sent with payload_too_large.

number
reason

Always sent with window_refused.

string

Examples

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