Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

Events

Publish CloudEvents, import another system’s history, and read them back: the history by filter, one event by sequence or by its source and ID, what it caused, and a live tail. Erase personal fields from a stored event, and list its erasures.

Events explains the envelope, what EventWolf adds, and when an event is a duplicate, and Filters the filter every read takes.

Paths are relative to https://api.agentpost.tools/v1/events, and every request follows the API basics. Who may call explains each kind of caller.

Publish an event

POST /events

Publishes one event as application/cloudevents+json, or up to 100 as an array in application/cloudevents-batch+json. An event is idempotent on its source and id: publishing it again answers duplicate with the first sequence, which is left out when your credential may not publish the stored event. One event answers 201 when accepted, 200 when a duplicate, and its rejection’s error when rejected; a batch answers 200 with a result for each event, in order.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Idempotency-Key: not taken. Publish takes no Idempotency-Key: an event is idempotent on its source and id.
  • Content-Type: application/cloudevents+json for one event, application/cloudevents-batch+json for a batch.

Body

Name Type Required Description
specversion "1.0" Yes
id string No 1–500 characters.
source string Yes 1–2048 characters.
type string Yes 1–500 characters.
subject string No 1–500 characters.
time string No An ISO 8601 date and time.
datacontenttype string No
dataschema string No 1–2048 characters.
data any No

Response

201 Created, with PublishOutcome.

Errors

Any operation can also answer with the codes Conventions lists.

Import event history

POST /events/import

Imports up to 100 historical events in a request of at most 1 MB, with a result per entry. Keeps each event’s time and its original receipt time, records the batch and origin in imported, and gives each a new sequence after the events already stored. Omit an entry’s receivedAt only when it is unknown; the import time is used. Each event needs its original id. Unregistered types and data that fails today’s schema still import, and a type’s refPaths add no references. Imported events are history only: they make no matches, deliveries, notifications, or pushes, and the live tail leaves them out. An event carrying a record field, such as sequence or projectId, is rejected. A source and id already in this project answers duplicate and leaves the first record unchanged; its sequence is left out when your credential may not import the stored event.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Idempotency-Key: not taken. Import takes no Idempotency-Key: each event is idempotent on its source and id within this project.

Body

Name Type Required Description
batchId string Yes Your import batch ID, scoped to this project. Keep it when resuming the batch; 1–500 characters.
origin string Yes The system or export the history came from; 1–2048 characters.
events any[] Yes Up to 100 entries, each { event: CloudEvent, receivedAt?: ISO timestamp }. Each event needs its original id. Entry errors are returned per event; up to 100 items.

Response

200 OK, with:

Name Type Present Description
results PublishOutcome array Always

Errors

Any operation can also answer with the codes Conventions lists.

Validate an event

POST /events/validate

What publishing this event would answer, with nothing written and no failure recorded.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Idempotency-Key: not taken. This route writes nothing, so it takes no Idempotency-Key.

Body

Name Type Required Description
specversion "1.0" Yes
id string No 1–500 characters.
source string Yes 1–2048 characters.
type string Yes 1–500 characters.
subject string No 1–500 characters.
time string No An ISO 8601 date and time.
datacontenttype string No
dataschema string No 1–2048 characters.
data any No

Response

200 OK, with ValidateResponse.

Errors

Any operation can also answer with the codes Conventions lists.

List events

GET /events

The events that match a filter, in sequence order by default. Use sort=receivedAt to place imported history beside live events by receipt time, with sequence breaking ties. Both sorts are newest first unless order=asc. Pass next as after with the same sort, order, and filters; a cursor from the other sort is refused. The from and to bounds always filter occurrence time, not receipt time. Every page is also held to what your credential may read.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Pages: limit, 1 to 200, default 50, with next and after. Lists has the rule.

Query parameters

Name Type Required Description
from string No An ISO 8601 date and time.
to string No An ISO 8601 date and time.
after string No The next cursor from a page with the same sort; 1–100 characters.
sort string No sequence pages in the order the project accepted events. receivedAt pages by receipt time, with sequence breaking ties, so imported history sits beside live events; default "sequence". One of "sequence" or "receivedAt".
order "asc" or "desc" No desc is newest first, asc oldest first; default "desc".
limit integer No 1–200; default 50.
types string No Event types, comma-separated. A trailing .* matches every type below it, so request.* matches request.created but not request, and * matches every type.
sources string No Sources, comma-separated. A source is exact, or ends with one *, such as /support/*.
workspace string No Only events whose workspace extension is this.
subject string No Only events with this subject.
ref string No A reference, type:id such as request:r_9, or a type alone, such as request. Repeat ref for any of several.
ext[name] string No An extension attribute’s value, such as ext[severity]=warning. The name matches ^[a-z0-9]{1,20}$. A comma separates values: any of them matches. true, false, and numbers are read as themselves.
where[path] string No The value at a data path, such as where[assignee.id]=u_ana. The path matches ^[A-Za-z0-9_$-]+(?:\.[A-Za-z0-9_$-]+)*$, up to 10 paths. A comma separates values: any of them matches. true, false, and numbers are read as themselves.

Response

200 OK, with:

Name Type Present Description
events EventRecord array Always
next string When set

Errors

Any operation can also answer with the codes Conventions lists.

Look up an event

GET /events/lookup

One event by the source and id its producer gave it, as a producer checks whether an event was accepted.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.

Query parameters

Name Type Required Description
source string Yes
id string Yes

Response

200 OK, with:

Name Type Present Description
event EventRecord Always

Errors

Any operation can also answer with the codes Conventions lists.

Stream events

GET /events/stream

Server-Sent Events: each new event that matches the filter, as an EventRecord whose message id is its sequence, and a heartbeat message with { "through": <sequence> } while nothing matches. Reconnect with Last-Event-ID, or after for a client that can’t set it, to resume with retained matching events after that sequence. Without either, the tail sends only events published after it opens. Event retention explains what happens when events age out.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Last-Event-ID: Optional. The sequence of the last event you received.

Query parameters

Name Type Required Description
after string No
types string No Event types, comma-separated. A trailing .* matches every type below it, so request.* matches request.created but not request, and * matches every type.
sources string No Sources, comma-separated. A source is exact, or ends with one *, such as /support/*.
workspace string No Only events whose workspace extension is this.
subject string No Only events with this subject.
ref string No A reference, type:id such as request:r_9, or a type alone, such as request. Repeat ref for any of several.
ext[name] string No An extension attribute’s value, such as ext[severity]=warning. The name matches ^[a-z0-9]{1,20}$. A comma separates values: any of them matches. true, false, and numbers are read as themselves.
where[path] string No The value at a data path, such as where[assignee.id]=u_ana. The path matches ^[A-Za-z0-9_$-]+(?:\.[A-Za-z0-9_$-]+)*$, up to 10 paths. A comma separates values: any of them matches. true, false, and numbers are read as themselves.

Response

200 OK, with no body.

Errors

Any operation can also answer with the codes Conventions lists.

Get an event

GET /events/:sequence

One event by its sequence.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.

Path parameters

Name Type Required Description
sequence string Yes An event’s sequence, such as 42. The sequence of a EventRecord.

Response

200 OK, with:

Name Type Present Description
event EventRecord Always

Errors

Any operation can also answer with the codes Conventions lists.

Get an event timeline

GET /events/:sequence/timeline

One event with what caused it and what it caused, through causationid, and what EventWolf did with it: its matches, deliveries with each attempt in brief, and notifications.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.

Path parameters

Name Type Required Description
sequence string Yes An event’s sequence, such as 42. The sequence of a EventRecord.

Response

200 OK, with TimelineRecord.

Errors

Any operation can also answer with the codes Conventions lists.

Erase event fields

POST /events/:sequence/erase

Removes named personal fields, their parsed references, and frozen notification and push text, and records the erasure atomically. Each notification the event made keeps its record with erasedAt and no title, body, or URL, and a push not yet sent is skipped with event_erased. Answers with only the erasure record, with no event values. Repeating paths is safe. Event records expose cumulative erased paths.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Idempotency-Key: optional. Retrying a write has the rule.

Path parameters

Name Type Required Description
sequence string Yes An event’s sequence, such as 42. The sequence of a EventRecord.

Body

Name Type Required Description
paths string[] Yes Fields on the public event, such as data.customer.email, subject, actor, refs, or summary. Dotted data keys follow filter syntax, up to 64 segments; proto, prototype, and constructor are refused. Object fields are removed; erased array slots become null. No values belong in this request; 1–100 items.

Response

200 OK, with:

Name Type Present Description
erasure ErasureRecord Always

Errors

Any operation can also answer with the codes Conventions lists.

List event erasures

GET /events/:sequence/erasures

The event’s erasure records, newest first, including after the event ages out of retention. Kept until project deletion; records hold paths, time, and caller, never erased values.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Pages: limit, 1 to 200, default 50, with next and after. Lists has the rule.

Path parameters

Name Type Required Description
sequence string Yes An event’s sequence, such as 42. The sequence of a EventRecord.

Query parameters

Name Type Required Description
after string No
limit integer No 1–200; default 50.

Response

200 OK, with:

Name Type Present Description
erasures ErasureRecord array Always
next string When set

Errors

Any operation can also answer with the codes Conventions lists.

The PublishOutcome object

Name Type Present Description
result string Always One of "accepted", "duplicate", or "rejected".
sequence number When set With result: "accepted" or result: "duplicate".
id string When set
source string When set
code string When set With result: "rejected". One of "invalid_envelope", "unknown_type", "invalid_data", "data_too_large", or "forbidden".
issues string[] When set With result: "rejected".
failureId string When set With result: "rejected". An ingestion failure ID, ifl_….

The ValidateResponse object

Name Type Present Description
valid boolean Always
code string When set One of "invalid_envelope", "unknown_type", "invalid_data", "data_too_large", or "forbidden".
issues string[] Always

The EventRecord object

One accepted event, with EventWolf’s record context around it.

Name Type Present Description
sequence number Always The project’s total order. Breaks receipt-time ties and resumes the live tail.
receivedAt string Always
publishedBy object Always How a publisher is recorded beside the source it claimed.
publishedBy.actor object Always The principal that made the request with its own credential. Your project’s secret key is key: and the key’s name, with no kind.
publishedBy.actor.id string Always The principal’s ID.
publishedBy.actor.kind string When set The kind a principal may declare. A principal that declared none has no kind. One of "human", "agent", or "service".
publishedBy.onBehalfOf object When set The delegator, when the actor acted under a delegation.
publishedBy.onBehalfOf.id string Always The principal’s ID.
publishedBy.onBehalfOf.kind string When set The kind a principal may declare. A principal that declared none has no kind. One of "human", "agent", or "service".
publishedBy.via string Always One of "host", "in_process", or "import".
refs object[] Always
refs[].type string Always
refs[].id string Always
refs[].role string Always The envelope attribute the reference came from. One read from a refPaths data path is ref. One of "subject", "actor", "onbehalfof", or "ref".
refs[].path string When set The data path a registry refPaths entry named, when that’s where it came from.
typeVersion number When set
erased object When set Removed fields, including requested paths that were already absent.
erased.paths string[] Always
erased.lastErasedAt string Always
imported object When set Present only on history imported from another system.
imported.batchId string Always
imported.origin string Always
imported.originalReceivedAt string When set
event object Always The event after any erasures, with sequence added as an extension.
event.specversion "1.0" Always
event.id string Always
event.source string Always
event.type string Always
event.subject string When set
event.time string Always
event.datacontenttype "application/json" Always
event.dataschema string When set
event.data any When set
event.sequence number Always

The TimelineRecord object

Name Type Present Description
event EventRecord Always
causes EventRecord array Always The causation chain upward, nearest cause first, at most 20 deep.
effects EventRecord array Always Events whose causation points at this one, in sequence order, at most 100.
matches MatchRecord array When set Present when the caller may manage deliveries.
deliveries object[] When set Present when the caller may manage deliveries.
deliveries[].id string Always Also the webhook-id header on every attempt of a webhook.
deliveries[].kind "webhook" or "push" Always What a delivery sends: a signed webhook to an endpoint, or a push to one of a recipient’s devices.
deliveries[].eventSequence number Always
deliveries[].matchId string When set Absent for an endpoint’s test ping, which has no subscription.
deliveries[].subscriptionId string When set A subscription ID, sub_….
deliveries[].endpointId string When set A webhook’s endpoint.
deliveries[].notificationId string When set A push’s notification, whose text and url it carries.
deliveries[].pushAddressId string When set A push’s address: one device of the notification’s recipient.
deliveries[].status string Always A push stays pending after it is sent until the provider reports whether it reached the device. One of "pending", "succeeded", "failed", "skipped", or "canceled".
deliveries[].skipReason string When set Why a delivery was skipped: the endpoint was disabled, the event is about that endpoint, the push address was invalid, or the event was erased before the push was sent. One of "endpoint_disabled", "about_endpoint", "address_invalid", or "event_erased".
deliveries[].nextAttemptAt string When set
deliveries[].createdAt string Always
deliveries[].finishedAt string When set
deliveries[].attempts object[] Always
deliveries[].attempts[].id string Always An attempt ID, att_….
deliveries[].attempts[].n number Always
deliveries[].attempts[].trigger string Always One of "automatic", "manual", "recover", or "replay".
deliveries[].attempts[].outcome "succeeded" or "failed" Always
deliveries[].attempts[].startedAt string Always
deliveries[].attempts[].duration string Always How long the attempt took, such as "240ms".
deliveries[].attempts[].status number When set The HTTP status the receiver answered, when it answered.
deliveries[].attempts[].error string When set Why there was no answer, or why the answer did not count. One of "timeout", "dns", "connection", "tls", "redirect", "ssrf_blocked", "push_send_failed", "push_delivery_failed", or "device_not_registered".
notifications NotificationRecord array When set Present when the caller may manage recipients: every notification the event made, skipped ones included, at most 500.

The ErasureRecord object

One completed request, including paths that were already absent. No erased values.

Name Type Present Description
id string Always An erasure ID, ers_….
eventSequence number Always
paths string[] Always
erasedAt string Always
requestedBy object Always How a publisher is recorded beside the source it claimed.
requestedBy.actor object Always The principal that made the request with its own credential. Your project’s secret key is key: and the key’s name, with no kind.
requestedBy.actor.id string Always The principal’s ID.
requestedBy.actor.kind string When set The kind a principal may declare. A principal that declared none has no kind. One of "human", "agent", or "service".
requestedBy.onBehalfOf object When set The delegator, when the actor acted under a delegation.
requestedBy.onBehalfOf.id string Always The principal’s ID.
requestedBy.onBehalfOf.kind string When set The kind a principal may declare. A principal that declared none has no kind. One of "human", "agent", or "service".
requestedBy.via string Always One of "host", "in_process", or "import".