Publish events
Send custom events, spans and logs directly with POST /event or in batches of up to 50 with POST /events/batch, with idempotent retries through dedupKey.
Publishing is the direct way to put an event into axonpush when you are not
using OpenTelemetry or a Sentry SDK: an agent step, a tool call, a log line, a
business fact you want next to your traces. Each published event is one row in
the events table, with source: "sdk".
| Method | Path | Use it for |
|---|---|---|
POST | /event | One event. What the SDKs call. |
POST | /events/batch | 1 to 50 events under one credential, with a result per event. |
For workspace observations (observe and identify), see
Observations. Those go to a different endpoint.
Publish one event
curl -X POST https://api.axonpush.xyz/event \
-H "X-API-Key: $AXONPUSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"identifier": "refund.issued",
"eventType": "custom",
"payload": { "amount": 42, "currency": "EUR" },
"metadata": { "tenant": "acme" },
"dedupKey": "refund-9f2c",
"occurredAt": "2026-11-18T09:30:00Z"
}'The response is {"eventId": "...", "status": "accepted"}. Ingest is
asynchronous: accepted means the event was taken for storage, and it shows up
in reads shortly after. The sync field that older SDKs send is ignored.
The SDKs require a channel ID. Over plain HTTP you can leave channel_id out;
see Where events land.
Body fields
| Field | Required | Notes |
|---|---|---|
identifier | yes | Event name or operation name. Defaults to the event type when empty. |
payload | yes | Any JSON object. |
channel_id | no | Target channel. Note the snake case. |
eventType | no | Defaults to custom. Canonical values: agent.start, agent.end, agent.message, agent.tool_call.start, agent.tool_call.end, agent.error, agent.handoff, agent.llm.token, agent.log, app.log, app.span, user.feedback, custom. |
traceId, spanId, parentSpanId | no | Join the event to a trace. The SDKs fill in a trace and span ID when you omit them. |
agentId | no | The agent that produced the event. |
metadata | no | Free-form map. Scalar values (strings up to 160 characters, numbers, booleans) under keys up to 120 characters are also copied into the event’s attributes, so they become custom dimensions, unless the payload already sets that attribute. |
dedupKey | no on /event, required on /events/batch | Idempotency key. See below. |
occurredAt | no | When it actually happened (RFC 3339). Defaults to receive time. |
expiresAt | no | Ask for earlier deletion. See below. |
Idempotency with dedupKey
When an event carries a dedupKey, its event ID is derived from the
organisation, app, environment and key. Sending the same key again in the same
app and environment returns the same eventId and does not store a second
copy. The stored copy is the first one; a resend with a different payload does
not replace it.
Use a key that identifies the fact, not the attempt: an order ID plus the transition, a source table row ID plus its revision. Then a retry after a timeout, or a replay from your own queue, is safe.
The Python, TypeScript and .NET SDKs send a random UUID as dedupKey when you
do not pass one. That protects the SDK’s own internal retries of one call, but
two separate publish calls for the same fact are two events. Pass your own
key when you might publish the same fact twice.
Time: occurredAt and expiresAt
occurredAt is the source time. Set it when you replay or backfill, and keep
it identical across retries, so the event lands at the right place on the
timeline. Without it, the receive time is used.
Retention starts from the earlier of occurredAt and the receive time and
lasts for your plan’s hot retention window (30 days on a self-hosted install).
expiresAt can only shorten that: a later value is capped at the plan window.
Use it for content you are required to keep for less time.
Publish a batch
POST /events/batch takes {"events": [...]} with 1 to 50 events, each with
the same fields as /event. Every event must carry a dedupKey, so a batch
can always be retried as a whole.
curl -X POST https://api.axonpush.xyz/events/batch \
-H "X-API-Key: $AXONPUSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": [
{ "identifier": "ticket.opened", "payload": {"id": "t_1"}, "dedupKey": "t_1:opened" },
{ "identifier": "ticket.closed", "payload": {"id": "t_1"}, "dedupKey": "t_1:closed" }
]
}'The response has one result per input, in order:
{
"results": [
{ "index": 0, "status": "accepted", "eventId": "4f0c..." },
{ "index": 1, "status": "rejected", "errorCode": "dedup_key_required" }
]
}status | errorCode | What to do |
|---|---|---|
accepted | Stored. Done. | |
rejected | dedup_key_required | Add a dedupKey. Retrying unchanged fails again. |
rejected | event_rejected | The event itself is not allowed, for example an unknown channel or one outside the credential’s app, or the organisation is blocked for billing (402). Fix it before retrying. |
retryable | ingest_failed | A server-side failure or a rate or quota limit (429). Resend the same event with the same dedupKey. |
The request as a whole still fails, with no per-event results, when the credential is invalid or the batch is empty or over 50 events.
The batch body may be sent with Content-Encoding: gzip or zstd. Any other
encoding is 415. The limit is 1 MB, compressed and decompressed.
The SDKs do not wrap /events/batch yet. Call it over HTTP.
Where events land
Credential. Send an ak_ key with events:publish as X-API-Key (or
X-Axonpush-Api-Key, or Authorization: Bearer ak_...), or a pt_
public ingest token as X-Public-Token (or
Authorization: Bearer pt_...). A key without events:publish gets 403.
Channel. In this order: the public token’s channel, then channel_id in
the body, then, for a key bound to an app, a channel named default in that
app (created on first use), and otherwise the organisation’s default channel
(seeded as the default channel of an app named Default). A channel must be
live and belong to the credential’s app; otherwise the event is 403 or 404.
A public token naming a different channel_id is 403.
Environment. The credential’s bound environment. A credential that is not
bound to one can pick any active environment of the organisation with the
X-Axonpush-Environment header, by ID or slug; without the header the event
goes to the organisation’s default environment. The SDKs send the header when
you configure an environment (AXONPUSH_ENVIRONMENT). These rules are the same
as on the OTLP endpoints:
- An unknown environment is
400(unknown environment). - A credential bound to one environment may send the header only with its own
environment. Naming another is
400(environment override forbidden).
Limits and errors
POST /eventaccepts bodies up to 3 MB.- On axonpush cloud, an organisation over its plan’s limits gets
402or429with a machine-readable code such asQUOTA_EXCEEDED,PAYMENT_REQUIRED,TRIAL_EXPIRED,PAYMENT_PAST_DUEorSUBSCRIPTION_PAUSED. See Billing. Self-hosted installs have no plan gate, but an inactive licence refuses ingest with402. - With the SDKs’ default
fail_open/failOpensetting, a connection error returnsNone/nullinstead of raising. API errors still raise. - Your organisation’s telemetry policy redacts payload and metadata before anything is indexed.
Related
- Python SDK, TypeScript SDK, .NET SDK
- Events search, to read them back
- API reference:
createEvent,createEventBatch
OpenTelemetry (OTLP)
Point an OTLP/HTTP exporter or collector at axonpush to send spans and log records, authenticated with a publish key or a public ingest token.
Observations (observe and identify)
Report business facts to a workspace with observe, attach profile traits with identify, and check that each observation was stored and projected.