API Documentation
Simple HTTP API for real-time event streaming
PUBLISH
Authentication
All API requests require authentication using an API key. Include your API key in the
Authorization
header:
Authorization: Bearer your-api-key-here
Creating an API Key
To create a new API key, visit your API Keys management page.
You'll need to sign in to access your organization's API keys.
Publishing Events
Send events to your subscribers using a simple POST request.
Endpoint
POST https://api.eventblast.io/v1/publish/
Headers
Content-Type: application/json
Authorization: Bearer your-api-key-here
Request Body
{
"topic": "test-topic",
"data": {
"anything-you-want": "To send to the subscribers of your topic"
}
}
Response
{
"sent_at": "2025-09-07T02:49:09Z",
"request_id": "GGLgOxcs_WvrEjQAAAAj",
"subscribe_url": "https://api.eventblast.io/v1/subscribe/acme-inc/test-topic"
}
Example with curl
curl -X POST https://api.eventblast.io/v1/publish/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-here" \
-d '{
"topic": "test-topic",
"data": {
"message": "Your team scored a goal!",
"current_score": 23
}
}'
SUBSCRIBE
Subscribing to Events
Subscribe to events using Server-Sent Events (SSE) with a simple GET request.
Endpoint Schema
GET https://api.eventblast.io/v1/subscribe/{your-org-slug}/{your-topic}
Endpoint Example. Just visitit this in your browser to test it out.
https://api.eventblast.io/v1/subscribe/acme-inc/test-topic
Headers
Accept: text/event-stream
Cache-Control: no-cache
Example with curl
curl -N -H "Accept: text/event-stream" \
-H "Cache-Control: no-cache" \
https://api.eventblast.io/v1/subscribe/acme-inc/test-topic
Example with JavaScript (Pasting this into your browser console will work)
const eventSource = new EventSource(
'https://api.eventblast.io/v1/subscribe/acme-inc/test-topic'
);
eventSource.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log('Received:', data);
};
Event Types
EventBlast sends 3 types of Server-Sent Events (SSE) messages:
1. Connected Event
Sent immediately when the SSE connection is established. Contains a timestamp.
event: connected
data: 1757478464
2. Message Event
Contains your published event data. This is the main event type that carries your custom data.
event: message
data: {"data":{"message":"Your team scored a goal! The score is now 2-1."}}
3. Heartbeat Event (t)
Periodic keepalive messages sent every 30 seconds to maintain the connection. The event type is "t" and contains a timestamp.
event: t
data: 1757478523
event: t
data: 1757478553
event: t
data: 1757478583
Error Responses
Subscription errors return JSON responses with detailed information to help debug issues:
Tip: Most SSE client libraries handle reconnection automatically. In JavaScript, the EventSource API will automatically attempt to reconnect when the connection drops.