The SDK uses two special endpoints that are not intended for direct use, but are documented here for debugging purposes and advanced integrations.
Initial flag load
GET /sdk/flags
Authorization: Bearer cg_live_your_keyReturns all flags for the environment in a format optimized for the SDK, including rollout data needed for local hashing.
SSE stream
GET /sdk/events
Authorization: Bearer cg_live_your_key
Accept: text/event-streamOpens an SSE connection. Events emitted:
flags:updated
Emitted when any flag in the environment is created, updated, or deleted.
event: flags:updated
data: {"key":"new-checkout","type":"boolean","enabled":true}ping
Emitted periodically to keep the connection alive.
event: ping
data: {}Using manually (without the SDK)
const source = new EventSource('https://api.canarygate.io/sdk/events', {
// Native EventSource does not support headers — use a polyfill
// or the SDK which already handles this internally
})
source.addEventListener('flags:updated', (event) => {
const flag = JSON.parse(event.data)
console.log('Flag updated:', flag)
})The native browser EventSource does not support sending authentication headers.
The SDK handles this internally. For manual use, use a library like eventsource (npm)
that supports headers.
Last updated on