ReferenceReference by module

Activity API

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

A live feed of everything that happens in your workspace.

Module code activity · 2 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: activity (everything), activity:read (read only) or activity:<capability>.

Resources

ResourceTableList and readPOSTPATCHDELETE
activitiesactivity/api/v1/activities
eventsevent/api/v1/events

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
activity.purgeactivity:manageApply the activity retention policy
activity.sealactivity:manageSeal the audit trail

activity.purge

Apply the activity retention policy — Deletes activity older than the workspace’s retention window. 0 keeps everything.

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

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

Input

FieldTypeRequiredNotes
daysnumberKeep (days)

Preconditions

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

CodeRefused when
retention_too_shortRetention must be 0 (keep everything) or at least 30 days.

Events it publishes: activity.purged

What it writes: activity (delete) — Removes rows older than the window

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

const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.activities.purge({
  days: 1
})
era activities purge \
  --days 1
tools/call
{
  "name": "era__activity__purge",
  "arguments": {
    "days": 1
  }
}

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

activity.seal

Seal the audit trail — Chains every settled activity row to the one before it, so a later change is detectable.

Needs activity:manage · changes data

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

Input

This action takes no input.

Events it publishes: activity.sealed

What it writes: activity (update) — Writes prev_hash and row_hash on unsealed rows

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

const era = createEra({ apiKey: process.env.ERA_API_KEY })
const res = await era.activities.seal()
era activities seal
tools/call
{
  "name": "era__activity__seal",
  "arguments": {}
}

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

Data models

Activity

Table activity · Resource activities

  • GET /api/v1/activities
  • GET /api/v1/activities/{id}
ColumnTypeNullableAllowed valuesReferences
idstring (int64) · int8
organization_idstring (uuid) · uuidorganization
workspace_idstring (uuid) · uuidworkspace
actor_typestring · text
actor_idstring (uuid) · uuidyes
actor_labelstring · textyes
module_codestring · text
record_typestring · textyes
record_idstring (uuid) · uuidyes
verbstring · text
summarystring · text
diffobject · jsonbyes
sourcestring · text
occurred_atstring (date-time) · timestamptz
reasonstring · textyes
correlation_idstring (uuid) · uuidyes
run_idstring · textyes
job_idstring · textyes
source_ipstring · textyes
user_agentstring · textyes
sealed_atstring (date-time) · timestamptzyes

Primary key: id

Event

Table event · Resource events

  • GET /api/v1/events
  • GET /api/v1/events/{id}
ColumnTypeNullableAllowed valuesReferences
idstring (int64) · int8
organization_idstring (uuid) · uuidorganization
workspace_idstring (uuid) · uuidworkspace
namestring · text
module_codestring · text
record_idstring (uuid) · uuidyes
payloadobject · jsonb
sourcestring · text
occurred_atstring (date-time) · timestamptz
dispatched_atstring (date-time) · timestamptzyes
attemptsinteger · int4
last_errorstring · textyes
next_attempt_atstring (date-time) · timestamptzyes
correlation_idstring (uuid) · uuidyes

Primary key: id

Events

Workflows and webhooks react to these events.

EventWhat happensPayload
activity.purgedActivity past the retention window was deleted.days, removed
activity.sealedSettled activity rows were chained into the audit seal.sealed
Was this page helpful?