Skip to content
Cresva
Developers

Event Streaming

Receive real-time events from your storefront using Server-Sent Events (SSE). This is ideal for building live dashboards and real-time monitoring.

Scope: analytics:read

Event streaming preview
Webhook delivery infrastructure runs in the Cresva backend today. The public SSE event-stream endpoint described here ships with the public Management API release.

Connecting

Open a persistent connection to the GET /events/stream endpoint. Include your Authorization header and set Accept: text/event-stream to begin receiving events.

Query Parameters

typesstringComma-separated event types to filter. Omit to receive all events.

Examples

curl

bash
curl -N "https://api.cresva.ai/api/storefront/[brandId]/events/stream?types=query.received,transaction.created" \
  -H "Authorization: Bearer cresva_ak_..." \
  -H "Accept: text/event-stream"

JavaScript

javascript
const url = new URL("https://api.cresva.ai/api/storefront/[brandId]/events/stream");
url.searchParams.set("types", "query.received,transaction.created");

const eventSource = new EventSource(url, {
  headers: {
    Authorization: "Bearer " + process.env.CRESVA_API_KEY,
  },
});

eventSource.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log("Event:", data.type, data);
};

eventSource.onerror = (error) => {
  console.error("SSE error:", error);
  eventSource.close();
};

Event format

Each event is delivered as a JSON object with an id, type, timestamp, and a data payload specific to the event type.

json
{
  "id": "evt_1234567890",
  "type": "query.received",
  "timestamp": "2026-03-28T14:30:00Z",
  "data": {
    "queryId": "qry_9f8e7d6c",
    "query": "wireless headphones under $200",
    "platform": "chatgpt"
  }
}

Event types

Products

product.createdproduct.updatedproduct.deleted

Queries

query.receivedquery.responded

Transactions

transaction.createdtransaction.completed

Trust

trust.updated

Deployments

deployment.createddeployment.updated

Alerts

alert.triggered