ReferenceReference by module

Popups API

Every Popups action (4) and data model (2): endpoints, scopes, input, preconditions, events and examples.

Website popups, with targeting and A/B conversion counts.

Module code popups · 4 actions · 2 data models · 2 events. A key or token never does more here than the person behind it can; row-level security applies exactly as in the app. Scopes: popups (everything), popups:read (read only) or popups:<capability>.

Resources

ResourceTableList and readPOSTPATCHDELETE
popup_eventspopup_event/api/v1/popup_events
popupspopup/api/v1/popups

Lists take limit (up to 200), cursor, order (e.g. -created_at), fields and q; every other query parameter is a column filter: ?status=paid, ?total[gte]=100, ?id[in]=a,b, ?x=null.

Actions

ActionNeedsWhat it does
popups.deletepopups:deleteDelete a popup
popups.savepopups:manageCreate or edit a popup
popups.submitpopups:writeSend a popup form
popups.trackpopups:writeCount a popup interaction

popups.delete

Delete a popup — Deletes the popup and its anonymous counts.

Needs popups:delete · removes or cannot be undone · asks a person to confirm when Era runs it

POSThttps://app.getera.io/api/v1/popups/actions/delete
API key or OAuth token · popups:delete
  • Canonical address: POST /api/v1/actions/popups.delete

Input

FieldTypeRequiredNotes
iduuidyesPopup

Events it publishes: popups.deleted

What it writes: popup (delete) — Deletes the popup; popup_event (delete) — Deletes its counts

curl -X POST https://app.getera.io/api/v1/popups/actions/delete \
  -H "Authorization: Bearer $ERA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"id":"ID_ID"}'
Response
{
  "ok": true,
  "result": "…",
  "events": [
    "popups.deleted"
  ]
}
import { createEra } from "@getera/sdk"

const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.popups.delete({
  id: "ID_ID"
})
era popups delete \
  --id "ID_ID"
tools/call
{
  "name": "era__popups__delete",
  "arguments": {
    "id": "ID_ID"
  }
}

Errors: 401 no or expired credential · 403 the credential does not hold popups:delete · 404 the record or module is outside what it may reach · 422 invalid input (problems[]) · 429 slow down

popups.save

Create or edit a popup — Saves a popup shown to visitors on your website, with its targeting and A/B content.

Needs popups:manage · changes data

POSThttps://app.getera.io/api/v1/popups/actions/save
API key or OAuth token · popups:manage
  • Canonical address: POST /api/v1/actions/popups.save

Input

FieldTypeRequiredNotes
iduuidPopup
namestringyesName · max 200
siteIduuidyesWebsite · id of site
formIduuidLead form · id of public_form
activebooleanLive
configobject / arrayyesContent and targeting · JSON: {a:{title,text,image,ctaLabel,ctaUrl},b:{title,text,image,ctaLabel,ctaUrl},split:0,trigger:"arrival",threshold:5,pages:["/"],visitor:"all",device:"all",frequency:"session"}. Both content variants are required; optional content strings may be empty. split is B traffic 0–100. trigger: arrival/delay/exit/scroll; threshold: seconds (delay) or percent (scroll). visitor: all/new/returning; device: all/mobile/desktop; frequency: session/daily/once.
startsAtdate-timeStarts
endsAtdate-timeEnds

Preconditions

The action is refused with 409 and one of these codes:

CodeRefused when
popup_invalidThe content, site, form and timing must be valid and in this workspace.

Events it publishes: popups.saved

What it writes: popup (upsert) — Saves the popup as a new revision

curl -X POST https://app.getera.io/api/v1/popups/actions/save \
  -H "Authorization: Bearer $ERA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"name":"Name","siteId":"SITE_ID","config":{}}'
Response
{
  "ok": true,
  "result": "…",
  "events": [
    "popups.saved"
  ]
}
import { createEra } from "@getera/sdk"

const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.popups.save({
  name: "Name",
  siteId: "SITE_ID",
  config: {}
})
era popups save --data '{"name":"Name","siteId":"SITE_ID","config":{}}'
tools/call
{
  "name": "era__popups__save",
  "arguments": {
    "name": "Name",
    "siteId": "SITE_ID",
    "config": {}
  }
}

Errors: 401 no or expired credential · 403 the credential does not hold popups:manage · 404 the record or module is outside what it may reach · 422 invalid input (problems[]) · 409 popup_invalid · 429 slow down

popups.submit

Send a popup form — Creates a lead through the form engine and counts the successful send for the A/B test.

Needs popups:write · reaches outside (sends, publishes or charges) · Also callable from a published site (visitor)

A website action: your site calls it through the site API (/api/site/v1/{siteId}, e.g. with @getera/storefront). With an API key or a token it is refused (403 site_only).
POSThttps://app.getera.io/api/v1/popup_events/actions/submit
API key or OAuth token · popups:write
  • Canonical address: POST /api/v1/actions/popups.submit

Input

FieldTypeRequiredNotes
iduuidyesPopup
revisionnumberyesRevision · min 1
impressionIduuidyesImpression
variantstring (enum)yesVariant · Allowed values: A, B
answersobject / arrayAnswers
metaobject / arrayForm details

Preconditions

The action is refused with 409 and one of these codes:

CodeRefused when
popup_invalidNeeds a live popup, its earlier view and an active lead form.

What it writes: popup_event (insert) — A successful form send

Errors: 401 no or expired credential · 403 the credential does not hold popups:write · 404 the record or module is outside what it may reach · 422 invalid input (problems[]) · 409 popup_invalid · 429 slow down

popups.track

Count a popup interaction — Records an anonymous view or click, once.

Needs popups:write · changes data · Also callable from a published site (visitor)

A website action: your site calls it through the site API (/api/site/v1/{siteId}, e.g. with @getera/storefront). With an API key or a token it is refused (403 site_only).
POSThttps://app.getera.io/api/v1/popup_events/actions/track
API key or OAuth token · popups:write
  • Canonical address: POST /api/v1/actions/popups.track

Input

FieldTypeRequiredNotes
iduuidyesPopup
revisionnumberyesRevision · min 1
impressionIduuidyesImpression
variantstring (enum)yesVariant · Allowed values: A, B
kindstring (enum)yesInteraction · Allowed values: view, click

Preconditions

The action is refused with 409 and one of these codes:

CodeRefused when
popup_invalidThe popup must be live on this site; a click needs its view first.

What it writes: popup_event (insert) — One interaction

Errors: 401 no or expired credential · 403 the credential does not hold popups:write · 404 the record or module is outside what it may reach · 422 invalid input (problems[]) · 409 popup_invalid · 429 slow down

Data models

PopupEvent

Table popup_event · Resource popup_events

  • GET /api/v1/popup_events
  • GET /api/v1/popup_events/{id}
ColumnTypeNullableAllowed valuesReferences
idstring (uuid) · uuid
organization_idstring (uuid) · uuidorganization
workspace_idstring (uuid) · uuidworkspace
popup_idstring (uuid) · uuidpopup
revisioninteger · int4
impression_idstring (uuid) · uuid
variantstring · textA, B
kindstring · textview, click, submit
created_atstring (date-time) · timestamptz

Primary key: id

Unique: popup_id, revision, impression_id, kind

Popup

Table popup · Resource popups

  • GET /api/v1/popups
  • GET /api/v1/popups/{id}
ColumnTypeNullableAllowed valuesReferences
idstring (uuid) · uuid
organization_idstring (uuid) · uuidorganization
workspace_idstring (uuid) · uuidworkspace
site_idstring (uuid) · uuidsite
form_idstring (uuid) · uuidyespublic_form
namestring · text
is_activeboolean · bool
revisioninteger · int4
configobject · jsonb
starts_atstring (date-time) · timestamptzyes
ends_atstring (date-time) · timestamptzyes
created_atstring (date-time) · timestamptz
updated_atstring (date-time) · timestamptz

Primary key: id

Checks:

  • CHECK (((ends_at IS NULL) OR (starts_at IS NULL) OR (ends_at > starts_at)))

Events

Workflows and webhooks react to these events.

EventWhat happensPayload
popups.deletedA popup was deleted.id
popups.savedA popup was saved.id
Was this page helpful?