Make an automation
const url = 'https://api.pixonaut.app/v1/automations';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Hosted link to printshop","sources":{"includeNewKeys":true,"includeNewLinks":true,"includeNewStores":true,"keys":null,"links":null,"stores":null},"trigger":"design.committed"}'};
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 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Hosted link to printshop", "sources": { "includeNewKeys": true, "includeNewLinks": true, "includeNewStores": true, "keys": null, "links": null, "stores": null }, "trigger": "design.committed" }'Operation ID: automations.create
A disabled automation at version 1, authored by the member who makes it. Unnamed, it is called “Automation N”. Left out, it has no trigger, and its sources are every designer link and key, those to come too, and no store. One made with a secret key runs as the workspace, and only an admin may make one that does otherwise.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The automation’s tree of steps.
object
object
Every one holds.
object
At least one holds.
object
It does not hold.
object
The fact compared.
It holds when the fact is one of these: each at most 200 characters, or 2054 for an origin, which may name a store’s site.
object
It holds from this many copies up.
It holds up to this many copies.
The order’s quantity.
object
The order’s delivery address.
Whether it must be set, or must not.
The steps, in the order they run. A step’s type names an action from the catalogue.
object
Further steps, under each branch’s name.
object
Its id, unique in the body: what a firing names it by.
What its type takes; the draft check refuses settings the type does not.
object
Its action (approve, create_print, place_order, reroute, cancel_order, notify, email, webhook) or flow step (only_if, paths, wait_for, delay).
Confirms that the automation spends without a person, at most its spend limit in 24 hours. Required, true, when it holds a spend action (create print, place order, reroute); a save without it is refused spend_unconfirmed.
What members call it. Left out: “Automation N”, one past the highest such name in the workspace.
Whose grants it acts with. Left out: its author, the member making it; or the workspace, when a secret key makes it.
Left out: every designer link and key, those to come too, and no store.
object
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.
On, it acts on designs from every designer link, those made later too. Off, only from the links in links.
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.
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
Each one that existed then, as a design’s origin names it: link:<id>, secret_key:<id> and publishable_key:<id>, or store:<site>.
When its switch was turned off: the snapshot is as of then.
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
Each one that existed then, as a design’s origin names it: link:<id>, secret_key:<id> and publishable_key:<id>, or store:<site>.
When its switch was turned off: the snapshot is as of then.
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
Each one that existed then, as a design’s origin names it: link:<id>, secret_key:<id> and publishable_key:<id>, or store:<site>.
When its switch was turned off: the snapshot is as of then.
Spend actions it may take per rolling 24 hours.
The event it fires on. Left out: none yet, which fires on nothing.
Examples
Example
{ "name": "Hosted link to printshop", "sources": { "includeNewKeys": true, "includeNewLinks": true, "includeNewStores": true, "keys": null, "links": null, "stores": null }, "trigger": "design.committed"}Responses
Section titled “Responses”The automation
object
The member whose grants it acts with: whoever last saved it. Null when it runs as the workspace.
object
The automation’s tree of steps.
object
object
Every one holds.
object
At least one holds.
object
It does not hold.
object
The fact compared.
It holds when the fact is one of these: each at most 200 characters, or 2054 for an origin, which may name a store’s site.
object
It holds from this many copies up.
It holds up to this many copies.
The order’s quantity.
object
The order’s delivery address.
Whether it must be set, or must not.
The steps, in the order they run. A step’s type names an action from the catalogue.
object
Further steps, under each branch’s name.
object
Its id, unique in the body: what a firing names it by.
What its type takes; the draft check refuses settings the type does not.
object
Its action (approve, create_print, place_order, reroute, cancel_order, notify, email, webhook) or flow step (only_if, paths, wait_for, delay).
When it was last enabled: it never fires on an event from before. Null for one never enabled.
object
Spend actions it took in the last 24 hours, against its spend limit.
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
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.
On, it acts on designs from every designer link, those made later too. Off, only from the links in links.
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.
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
Each one that existed then, as a design’s origin names it: link:<id>, secret_key:<id> and publishable_key:<id>, or store:<site>.
When its switch was turned off: the snapshot is as of then.
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
Each one that existed then, as a design’s origin names it: link:<id>, secret_key:<id> and publishable_key:<id>, or store:<site>.
When its switch was turned off: the snapshot is as of then.
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
Each one that existed then, as a design’s origin names it: link:<id>, secret_key:<id> and publishable_key:<id>, or store:<site>.
When its switch was turned off: the snapshot is as of then.
The event it fires on; null for none yet.
When it was last saved: a save names it as expectedUpdatedAt.
Its current version.
Examples
Example
{ "author": { "name": "Ada Lewis", "userId": "u_8b1d2c3e4f5a" }, "body": { "steps": [] }, "createdAt": 1760000000000, "enabled": false, "enabledAt": null, "firings": { "count": 0, "lastAt": null, "paused": 0, "spentToday": 3, "waiting": 0 }, "id": "aut_3c9e1f7a-2b4d-4e8a-9f6c-1d2e3f4a5b6c", "name": "Hosted link to printshop", "runsAs": "author", "sources": { "includeNewKeys": true, "includeNewLinks": true, "includeNewStores": true, "keys": null, "links": null, "stores": null }, "spendLimit": 50, "standing": { "state": "disabled" }, "trigger": "design.committed", "updatedAt": 1760000000000, "version": 1}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, admin_only, origin_forbidden, forbidden
object
The feature the tenant does not have. Always sent with feature_disabled.
Always sent with admin_only.
Examples
admin_only
{ "error": "admin_only", "reason": "string"}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: author_needs_member, draft_refused, spend_unconfirmed, spend_limit_over_ceiling, payload_too_large
object
Sent with payload_too_large.
The workspace’s ceiling, the most a spend limit may say. Always sent with spend_limit_over_ceiling.
Always sent with payload_too_large.
Always sent with author_needs_member, spend_unconfirmed, spend_limit_over_ceiling.
Always sent with draft_refused.
object
What is wrong, in words.
The step it is about.
Examples
author_needs_member
{ "error": "author_needs_member", "reason": "string"}draft_refused
{ "error": "draft_refused", "refusals": [ { "code": "unknown_action", "message": "string" } ]}payload_too_large
{ "error": "payload_too_large", "maxBytes": 0}spend_limit_over_ceiling
{ "ceiling": 0, "error": "spend_limit_over_ceiling", "reason": "string"}spend_unconfirmed
{ "error": "spend_unconfirmed", "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].