Events
https://api.example.com
/api/v1/events/stream
Stream Events
Server-Sent Events stream for real-time job monitoring. Connect to this endpoint to receive live job events for your client account. Events are streamed as they happen - no polling required. **Authentication:** Pass your credentials as a query parameter: ``` GET /api/v1/events/stream?token=client_id:api_key:api_secret ``` **Event Types:** - `connected`: Sent when connection is established - `job.queued`: Job submitted and queued for processing - `job.started`: Worker picked up the job - `job.completed`: Job finished successfully - `job.failed`: Job encountered an error - `heartbeat`: Keep-alive signal (every 30 seconds) **Event Format (SSE):** ``` event: job.completed data: {"job_id": "abc-123", "processing_time": 45.2, "results_count": 15} ``` **JavaScript Example:** ```javascript const token = 'cli_xxx:sk_xxx:secret_xxx'; const eventSource = new EventSource( `https://spideriq.ai/api/v1/events/stream?token=${token}` ); eventSource.addEventListener('job.completed', (e) => { const data = JSON.parse(e.data); console.log('Job completed:', data.job_id); }); ``` Returns: SSE stream of job events
token
any
query
200Successful Response422Validation Error
curl -X GET 'https://api.example.com/api/v1/events/stream' \
-H 'Authorization: Bearer '
import httpx
resp = httpx.get(
"https://api.example.com/api/v1/events/stream",
headers={"Authorization": "Bearer "},
)
resp.raise_for_status()
print(resp.json())
const resp = await fetch("https://api.example.com/api/v1/events/stream", {
method: "GET",
headers: { "Authorization": "Bearer " }
});
const data = await resp.json();
console.log(data);
package main
import (
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.example.com/api/v1/events/stream", nil)
req.Header.Set("Authorization", "Bearer ")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}
/api/v1/events/status
Get Event Status
Get event service status. Returns: Event service health and active subscription count
200Successful Response
curl -X GET 'https://api.example.com/api/v1/events/status' \
-H 'Authorization: Bearer '
import httpx
resp = httpx.get(
"https://api.example.com/api/v1/events/status",
headers={"Authorization": "Bearer "},
)
resp.raise_for_status()
print(resp.json())
const resp = await fetch("https://api.example.com/api/v1/events/status", {
method: "GET",
headers: { "Authorization": "Bearer " }
});
const data = await resp.json();
console.log(data);
package main
import (
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.example.com/api/v1/events/status", nil)
req.Header.Set("Authorization", "Bearer ")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}