Skip to content

Apply an automation to past events

POST
/v1/automations/{id}/past-events
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.

id
required
string
Media typeapplication/json
object
confirmSpend

Confirms what firing on these events may spend without a person. Required, true, when the automation holds a spend action.

boolean
expectedEvents

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.

integer
from
required

The window’s start, inclusive.

number
to
required

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

number

Examples

Exampleexample

Example

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

What it fired on

Media typeapplication/json
object
events
required

How many events the window held.

number
opened
required

How many firings that opened: events outside its scope, its conditions unmet or already fired on open none.

number

Examples

Exampleexample

Example

{
"events": 14,
"opened": 9
}
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, past_events_changed

Media typeapplication/json
object
error
required
string
events

How many events the window holds now. Always sent with past_events_changed.

number
reason

Always sent with automation_disabled, past_events_changed.

string

Examples

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, spend_unconfirmed, 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, spend_unconfirmed.

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