Preview applying an automation to past events
const url = 'https://api.pixonaut.app/v1/automations/example/past-events/preview';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"from":1759913600000,"to":1760000000000}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
The window’s start, inclusive.
The window’s end, inclusive; not in the future.
Examples
Example
{ "from": 1759913600000, "to": 1760000000000}Responses
Section titled “Responses”What applying it would fire on
object
How many events the window holds.
Whether it holds a spend action: applying it needs the spend confirmation.
A test run on the newest; null for an empty window.
object
Its conditions, each with the values compared; null for none.
object
object
Where it sits in the tree, as all.0.not; empty for a tree of one.
object
object
Whether the automation would fire on it.
Why it would not fire.
Every step, in order, branches after their step: what it would do.
object
The printshop it would act at, and what it could do.
object
object
Why it cannot act there.
object
When it can: checked when it runs, and a step that meets it unmet is blocked.
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.
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
The limits a spend action counts against, as they would stand when it ran.
object
object
object
What it was about, by id.
object
Examples
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 } }}Headers
Section titled “Headers”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
object
Always sent with invalid_body.
Examples
invalid_body
{ "error": "invalid_body", "fields": [ "string" ]}Headers
Section titled “Headers”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
object
Examples
unauthorized
{ "error": "unauthorized"}Headers
Section titled “Headers”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
object
The feature the tenant does not have. Always sent with feature_disabled.
Examples
feature_disabled
{ "error": "feature_disabled", "feature": "api"}forbidden
{ "error": "forbidden"}origin_forbidden
{ "error": "origin_forbidden"}Headers
Section titled “Headers”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
object
Examples
automation_not_found
{ "error": "automation_not_found"}Headers
Section titled “Headers”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
object
Always sent with automation_disabled.
Examples
automation_disabled
{ "error": "automation_disabled", "reason": "string"}Headers
Section titled “Headers”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
object
Sent with payload_too_large.
How many events the window holds, when there are too many. Sent with window_refused.
Always sent with payload_too_large.
Always sent with window_refused.
Examples
payload_too_large
{ "error": "payload_too_large", "maxBytes": 0}window_refused
{ "error": "window_refused", "reason": "string"}Headers
Section titled “Headers”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
Examples
db_error
{ "error": "db_error"}Headers
Section titled “Headers”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].