Quickstart
Send two turns of a conversation and receive the moments in them, in five minutes.
You'll create a conversation, send it two things people said on a renewal call, and receive a
decision and a request.do: first on an event stream, then as a signed webhook.
@sparkle/sdk is in private beta
The TypeScript tabs use @sparkle/sdk, which isn't on npm yet. To try it, ask us for
access. Python and Go have no SDK yet: the cURL, Python and Go tabs
call the HTTP API directly.
Get a test key
In the dashboard, open Settings → API keys and create a key in the test environment. Test keys
start with spk_test_ and are never billed. Their conversations' events, marked livemode: false,
go only to test webhook subscriptions, never to your live endpoints (test and
live). Export it for the commands below:
export SPARKLE_API_KEY=spk_test_...Create a conversation
A conversation is one call or meeting. Create it with a webhook_url, and every event of this
conversation is delivered there. Use any public HTTPS URL that reaches port 3000 on your machine,
such as one from ngrok http 3000; you'll start the server behind it in step 5.
curl https://api.sparkle.ai/public/v1/conversations \
-H "X-API-Key: $SPARKLE_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"title": "Acme renewal call",
"webhook_url": "https://example.ngrok.app/sparkle"
}'Every POST and PUT takes an Idempotency-Key: sending the same key again returns the first
response instead of acting twice. The response holds the conversation and its webhook:
{
"conversation": {
"id": "cnv_2kd7q1v9x4m8r2t6b3ny",
"tenant_id": "ten_2kd5m0c8w3e7h1p4s9fa",
"organization_id": "org_2kd5m0d2y6b0k4n8r1gc",
"environment": "test",
"status": "live",
"title": "Acme renewal call",
"metadata": {},
"moment_types": [],
"moments_count": 0,
"started_at": "2026-12-03T15:00:00Z",
"webhook": {
"id": "whs_2kd7q1w3z7c1f5j9m2pd",
"url": "https://example.ngrok.app/sparkle"
},
"created_at": "2026-12-03T15:00:00Z",
"updated_at": "2026-12-03T15:00:00Z"
},
"receivers": [],
"webhook": {
"id": "whs_2kd7q1w3z7c1f5j9m2pd",
"url": "https://example.ngrok.app/sparkle",
"secret": "whsec_8c1f4e0b9a6d2f7e5c3b1a0d9e8f7c6b5a4d3e2f"
}
}webhook.secret signs every delivery to that URL, and this is the only time you see it. The URL
receives this conversation's conversation.created, moment.detected and conversation.ended. For
one URL that receives every conversation's events, conversation.deleted included, create a
webhook subscription instead, once, and leave webhook_url out.
Keep the secret, along with the conversation's id:
export CONVERSATION_ID=cnv_2kd7q1v9x4m8r2t6b3ny
export SPARKLE_WEBHOOK_SECRET=whsec_8c1f4e0b9a6d2f7e5c3b1a0d9e8f7c6b5a4d3e2fstarted_at is time zero of the conversation's clock. Turn times count from it, in seconds.
Send two turns
A turn is one stretch of one person speaking. Send two: Sam agrees to the renewal terms four seconds in, and Dana commits to a fix twenty seconds later.
curl https://api.sparkle.ai/public/v1/conversations/$CONVERSATION_ID/turns \
-H "X-API-Key: $SPARKLE_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"turns": [
{
"id": "t1",
"final": true,
"speaker": "sam",
"name": "Sam",
"channel": "mic",
"start": 0.8,
"end": 4.1,
"text": "Okay, let'\''s go with the two-year term at the current tier."
},
{
"id": "t2",
"final": true,
"speaker": "dana",
"name": "Dana",
"channel": "remote",
"start": 21.0,
"end": 23.4,
"text": "I'\''ll get the SSO fix out by Friday."
}
]
}'Sparkle answers 202 Accepted with no body: it has stored the turns and reads them in the
background. The turn contract explains each field, and why sending a turn
twice is safe.
Stream the moments
The conversation's event stream sends each moment as a server-sent event, the ones already detected
first. -N turns off curl's buffering, so each event prints as it arrives:
curl -N https://api.sparkle.ai/public/v1/conversations/$CONVERSATION_ID/stream \
-H "X-API-Key: $SPARKLE_API_KEY"Two events arrive. Lines that start with : are comments that keep the connection open:
: connected
id: 1796310031204-0
event: moment.detected
data: {"id":"evt_2kd7qc4h8n1s5w9z3b6e","object":"event","type":"moment.detected","livemode":false,"data":{"kind":"decision","text":"Okay, let's go with the two-year term at the current tier.",…}}
id: 1796310031377-0
event: moment.detected
data: {"id":"evt_2kd7qd8k2p6t0x4a7c1f","object":"event","type":"moment.detected","livemode":false,"data":{"kind":"request.do","text":"I'll get the SSO fix out by Friday.",…}}Each data line is one event. The second one, formatted:
{
"id": "evt_2kd7qd8k2p6t0x4a7c1f",
"object": "event",
"type": "moment.detected",
"livemode": false,
"created_at": "2026-12-03T15:00:31Z",
"data": {
"id": "mom_2kd7qb3f7j1n5r9v2y6d",
"object": "moment",
"conversation_id": "cnv_2kd7q1v9x4m8r2t6b3ny",
"kind": "request.do",
"title": "Dana · Ship the SSO fix by Friday",
"text": "I'll get the SSO fix out by Friday.",
"speaker": { "key": "dana", "name": "Dana" },
"at": 23.4,
"confidence": 0.91,
"turn_ids": ["t2"],
"settled_ms": 0,
"classifier": "typesafe:…",
"definition": null,
"created_at": "2026-12-03T15:00:31.377214Z"
}
}Look at settled_ms. The decision went out 5,000 ms after Sam stopped talking: Sparkle waited
for the exchange to settle, in case someone objected. The request.do has 0: a commitment is
complete when it's said. Timing profiles explains the difference.
Receive the webhook
The same two events were sent to your webhook_url, signed with the conversation's secret. Run a
server on port 3000 behind that URL. It checks the signature on the raw body, drops events it has
already handled, and answers 2xx quickly:
import { createServer } from "node:http";
import { Sparkle, SparkleSignatureError } from "@sparkle/sdk";
const seen = new Set<string>();
createServer(async (req, res) => {
const chunks: Buffer[] = [];
for await (const chunk of req) chunks.push(chunk);
try {
// Checks Sparkle-Signature against the raw body, and its timestamp against your clock.
const event = await Sparkle.webhooks.verify(
Buffer.concat(chunks),
req.headers,
process.env.SPARKLE_WEBHOOK_SECRET!
);
if (!seen.has(event.id)) {
seen.add(event.id);
if (event.type === "moment.detected") {
console.log(event.type, event.data.kind, event.data.text);
} else {
console.log(event.type);
}
}
res.writeHead(204).end();
} catch (error) {
if (!(error instanceof SparkleSignatureError)) throw error;
res.writeHead(400).end("invalid signature");
}
}).listen(3000);A delivery that fails, because the server wasn't up yet for example, is retried after 1, 2, 4 and 8 minutes, so the two moments arrive within a few minutes of starting it. They print as:
conversation.created
moment.detected decision Okay, let's go with the two-year term at the current tier.
moment.detected request.do I'll get the SSO fix out by Friday.End the conversation
When the call is over, end the conversation. Sparkle lets any moment still settling go, then sends
conversation.ended with a summary:
curl -X POST https://api.sparkle.ai/public/v1/conversations/$CONVERSATION_ID/end \
-H "X-API-Key: $SPARKLE_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"{
"id": "evt_2kd7qf1m5q9u3y7b0d4h",
"object": "event",
"type": "conversation.ended",
"livemode": false,
"created_at": "2026-12-03T15:02:10Z",
"data": {
"conversation": { "id": "cnv_2kd7q1v9x4m8r2t6b3ny", "status": "ended", "…": "…" },
"summary": {
"moments_count": 2,
"moments_by_kind": { "decision": 1, "request.do": 1 },
"duration_s": 130,
"turns_count": 2
}
}
}Next steps
Send a live transcript
The turn contract: partial turns, corrections and speakers.
Connect Recall.ai or Deepgram
Let a meeting bot or a speech-to-text stream post the turns for you.
Define your own moment
Describe it in plain English, test it on a transcript, then make it live.
Import a finished call
Run a recorded transcript through the same detection after the call.