Streaming results
A full lookup checks hundreds of platforms. Streaming means you show the first matches in well under a second instead of waiting for the slowest one.
Opening the stream
GET /v1/lookup/stream
curl -N "https://api.digifootprint.dev/v1/lookup/stream?query=someone@example.com" \ -H "Authorization: Bearer dfp_your_key"
Event types
Five named events. platform_result fires many times, once per confirmed platform, and the others fire at most once each. done carries the same summary counts as the non-streamed response and closes the stream.
Event stream
event: platform_result
data: {"platform":"github","registered":true,"method":"public_api","checkedAt":"..."}
event: platform_result
data: {"platform":"reddit","registered":false,"method":"public_api","checkedAt":"..."}
event: breach_result
data: {"breaches":[{"name":"Adobe","date":"2013-10-04"}]}
event: done
data: {"lookupId":"8f2c...","platformsChecked":844,"matches":3,"socialMatches":2,"servedFromCache":false}In the browser
EventSource cannot send an Authorization header, so proxy the stream through your own backend and attach the key there. That is a feature, not an obstacle: your API key should never reach a browser in the first place.
Client
const source = new EventSource(url); // attach the key server-side
source.addEventListener('platform_result', (event) => {
const result = JSON.parse(event.data);
render(result); // paint as each one lands
});
source.addEventListener('done', (event) => {
const summary = JSON.parse(event.data);
source.close(); // the stream ends here
});