Apply an automation to past events
const url = 'https://api.pixonaut.app/v1/automations/example/past-events';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"confirmSpend":true,"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 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "confirmSpend": true, "from": 1759913600000, "to": 1760000000000 }'Operation ID: automations.applyToPastEvents
It fires once on each event of its trigger in the window that is in its scope and meets its conditions, at most 500 over at most 30 days. Its firings run under the spend limits: those past a limit pause.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Confirms what firing on these events may spend without a person. Required, true, when the automation holds a spend action.
How many events the preview said the window holds: a window that holds another number now is refused, so it fires on the events that were previewed.
The window’s start, inclusive.
The window’s end, inclusive; not in the future.
Examples
Example
{ "confirmSpend": true, "from": 1759913600000, "to": 1760000000000}Responses
Section titled “Responses”What it fired on
object
How many events the window held.
How many firings that opened: events outside its scope, its conditions unmet or already fired on open none.
Examples
Example
{ "events": 14, "opened": 9}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, past_events_changed
object
How many events the window holds now. Always sent with past_events_changed.
Always sent with automation_disabled, past_events_changed.
Examples
automation_disabled
{ "error": "automation_disabled", "reason": "string"}past_events_changed
{ "error": "past_events_changed", "events": 0, "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, spend_unconfirmed, 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, spend_unconfirmed.
Examples
payload_too_large
{ "error": "payload_too_large", "maxBytes": 0}spend_unconfirmed
{ "error": "spend_unconfirmed", "reason": "string"}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].