# Introduction > Conversation events for developers. Sparkle tells your product the moment something happens in a conversation. Sparkle reads a live conversation's transcript and sends you an event when something happens in it: a decision, a request or a commitment, a question, a fact nobody in the room knows. You send the transcript as it's spoken. Each moment arrives seconds later, typed and signed, with who said it and the words they used. ## How it works ```text 1. Transcript in 2. Moments 3. Events out ──────────────────────── ────────────────────────── ───────────────────────── your own turns decision +5.0s a signed webhook a Recall.ai bot ──► request.do +0.0s ──► a server-sent event stream a Deepgram stream knowledge_gap +2.0s the moments list a finished transcript your own kinds … ``` 1. **Transcript in.** Post turns as people speak, point a [Recall.ai](/docs/receivers/recall) or [Deepgram](/docs/receivers/deepgram) stream at the conversation, or [import a finished transcript](/docs/guides/import). 2. **Moments.** Sparkle reads each finished turn once and decides whether it is one of [ten built-in kinds](/docs/concepts/moments), or one of the [custom moments](/docs/guides/custom-moments) you define in plain English. Each kind waits [as long as it needs](/docs/concepts/timing): a request goes at once, a decision waits for the exchange to settle. 3. **Events out.** Each moment goes out as a `moment.detected` event, to your [webhook](/docs/webhooks) and on the conversation's event stream. Here is what you receive when Sam says "Okay, let's go with the two-year term at the current tier.": ```json { "id": "evt_2kd7qc4h8n1s5w9z3b6e", "object": "event", "type": "moment.detected", "livemode": false, "created_at": "2026-12-03T15:00:09Z", "data": { "id": "mom_2kd7qa1c5e9g3j7l0npw", "object": "moment", "conversation_id": "cnv_2kd7q1v9x4m8r2t6b3ny", "kind": "decision", "text": "Okay, let's go with the two-year term at the current tier.", "speaker": { "key": "sam", "name": "Sam" }, "at": 4.1, "confidence": 0.82, "turn_ids": ["t1"], "settled_ms": 5000, "…": "…" } } ``` ## Start here - [Quickstart](https://docs.sparkle.ai/docs/quickstart): Create a conversation, send two turns and receive your first moments in five minutes. - [Use with AI](https://docs.sparkle.ai/docs/use-with-ai): Point Claude Code, Codex or Cursor at these docs and let it write the integration. - [Concepts](https://docs.sparkle.ai/docs/concepts/conversations): Conversations, the turn contract, the ten moment kinds and how delivery works. - [API reference](https://docs.sparkle.ai/docs/api): Every endpoint and webhook event, generated from the OpenAPI spec. ## Keys and environments Every request carries an API key in the `X-API-Key` header, against `https://api.sparkle.ai/public/v1`. A key belongs to one organization of your company, and comes in two environments: * `spk_test_…` keys for building and testing. Test traffic is never billed. * `spk_live_…` keys for production. Create keys in the dashboard under **Settings → API keys**. [Security](/docs/concepts/security) covers keys, signatures and how long Sparkle keeps a transcript. Source: https://docs.sparkle.ai/docs.md --- # Use with AI > Point Claude Code, Codex or Cursor at these docs and let it write the integration. Every page of these docs is also plain markdown, written to be read by a coding agent as well as by you: | URL | What it is | | ------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | | [`/llms.txt`](https://docs.sparkle.ai/llms.txt) | An index of every page, with a one-line summary each. | | [`/llms-full.txt`](https://docs.sparkle.ai/llms-full.txt) | All of the docs in one file, the API reference included. | | Any page's URL plus `.md` | That page alone, such as [`/docs/quickstart.md`](https://docs.sparkle.ai/docs/quickstart.md). | | [`/openapi/v1.yaml`](https://docs.sparkle.ai/openapi/v1.yaml) | The OpenAPI spec. | The buttons at the top of each page copy it as markdown, open it in Claude, or copy a Claude Code command that starts from it. ## Point your agent at the docs **Claude Code** Run Claude Code in your project with the docs in the prompt: ```bash claude "Read https://docs.sparkle.ai/llms-full.txt and help me integrate Sparkle into this project." ``` To keep the docs in every session, add the snippet below to your `CLAUDE.md`. **Codex** Run Codex in your project with the docs in the prompt: ```bash codex "Read https://docs.sparkle.ai/llms-full.txt and help me integrate Sparkle into this project." ``` To keep the docs in every session, add the snippet below to your `AGENTS.md`. **Cursor** Add the docs once, then mention them in any chat. Type `@Docs`, choose **Add new doc**, and paste: ```text https://docs.sparkle.ai/llms-full.txt ``` To keep the essentials in every chat, add the snippet below to your `AGENTS.md` or a project rule. If your agent can't fetch URLs, download the file into the project and point it there: ```bash curl -o sparkle-docs.md https://docs.sparkle.ai/llms-full.txt ``` ## A snippet for AGENTS.md or CLAUDE.md Paste this into the file your agent reads at the start of every session. It holds what an agent gets wrong most often without the docs: ```markdown title="AGENTS.md" ## Sparkle This project uses Sparkle to detect moments in conversations: decisions, requests, questions, knowledge gaps. Full docs: https://docs.sparkle.ai/llms-full.txt. Any docs page as markdown: its URL plus `.md`. - API base: https://api.sparkle.ai/public/v1, JSON. Authenticate with the header `X-API-Key: $SPARKLE_API_KEY` (`spk_test_…` in development, `spk_live_…` in production). The key stays on the server; never send it to a browser. - Every POST and PUT needs an `Idempotency-Key` header: a new UUID per request, reused only to retry that same request. - Flow: `POST /conversations` → `POST /conversations/{id}/turns` (up to 500 per batch) → moments on `GET /conversations/{id}/stream` (server-sent events) and as `moment.detected` webhooks → `POST /conversations/{id}/end`. Finished transcripts: `POST /conversations/import`. - Turn: `{id, final, speaker, name?, channel: "mic" | "remote", start, end, text}`, times in seconds from the conversation's `started_at`. The same `id` replaces a turn; only final turns are detected on; order within a batch doesn't matter; `speaker` is a stable key, `name` is optional. - Event: `{id: "evt_…", object: "event", type, livemode, created_at, data}`; `livemode` is false for a test key's conversations, whose events reach test subscriptions only. Deduplicate on the event `id`. Types: `conversation.created`, `moment.detected`, `conversation.ended`, `conversation.deleted`. - Webhooks: verify `Sparkle-Signature` (`t=,v1=`) before parsing: HMAC-SHA256 of `.` keyed with the secret, compared in constant time; reject a `t` more than 300 seconds from now. Answer 2xx within 30 seconds and do slow work after. - Moment kinds: `question.open`, `question.directed`, `knowledge_gap`, `reference`, `request.find`, `request.do`, `decision`, `work_item`, `next_steps`, `ideas_wanted`, plus custom moments by name. - Errors are RFC 9457 problem details. Branch on `code`, not on `detail`. ``` ## Prompts to start from Copy one, fill in what's in angle brackets, and run it in your project. ### Integrate from scratch ```text Read https://docs.sparkle.ai/llms-full.txt. Integrate Sparkle into this project: create a conversation when a call starts, send our transcript to it as turns under Sparkle's turn contract, and end the conversation when the call ends. Read the API key from SPARKLE_API_KEY and send an Idempotency-Key with every POST. Before writing code, show me where our transcript comes from and how you'll map it to turns. ``` ### Handle webhooks ```text Read https://docs.sparkle.ai/docs/webhooks.md. Add an endpoint that receives Sparkle webhooks: verify Sparkle-Signature on the raw body with SPARKLE_WEBHOOK_SECRET, reject timestamps more than 5 minutes old, drop event ids we've already handled, answer 204 at once and handle moment.detected after responding. Add a test that sends a correctly signed sample event and one with a bad signature. ``` ### Stream moments into a UI ```text Read https://docs.sparkle.ai/docs/concepts/delivery.md. Show Sparkle moments live in our UI while a call runs: open GET /conversations/{id}/stream from our server (the API key must never reach the browser), resume with Last-Event-ID after a disconnect, and relay each moment to the client over . Show each moment's kind, speaker name and text as it arrives. ``` ### Define a custom moment ```text Read https://docs.sparkle.ai/docs/guides/custom-moments.md. Help me define a Sparkle custom moment named that fires when . Draft when and not_when, and five fire and five skip examples. Evaluate it with POST /moments/evaluate on the transcript in , labelling the turns it should fire on, then suggest wording changes from the misses and false fires before we make it live. ``` Source: https://docs.sparkle.ai/docs/use-with-ai.md --- # 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](https://sparkle.ai/contact). 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](/docs/webhooks#test-and-live)). Export it for the commands below: ```bash 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** ```bash 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" }' ``` **TypeScript** ```ts import { Sparkle } from "@sparkle/sdk"; const sparkle = new Sparkle(); // reads SPARKLE_API_KEY const { conversation, webhook } = await sparkle.conversations.create({ title: "Acme renewal call", webhook_url: "https://example.ngrok.app/sparkle", }); ``` **Python** ```python import os import uuid import requests API = "https://api.sparkle.ai/public/v1" headers = {"X-API-Key": os.environ["SPARKLE_API_KEY"]} created = requests.post( f"{API}/conversations", headers={**headers, "Idempotency-Key": str(uuid.uuid4())}, json={ "title": "Acme renewal call", "webhook_url": "https://example.ngrok.app/sparkle", }, ).json() conversation_id = created["conversation"]["id"] ``` **Go** ```go body := strings.NewReader(`{ "title": "Acme renewal call", "webhook_url": "https://example.ngrok.app/sparkle" }`) req, _ := http.NewRequest("POST", "https://api.sparkle.ai/public/v1/conversations", body) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Idempotency-Key", rand.Text()) // crypto/rand req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() var created struct { Conversation struct{ ID string } `json:"conversation"` Webhook struct{ Secret string } `json:"webhook"` } json.NewDecoder(resp.Body).Decode(&created) ``` 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: ```json { "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](/docs/webhooks) instead, once, and leave `webhook_url` out. Keep the secret, along with the conversation's `id`: ```bash export CONVERSATION_ID=cnv_2kd7q1v9x4m8r2t6b3ny export SPARKLE_WEBHOOK_SECRET=whsec_8c1f4e0b9a6d2f7e5c3b1a0d9e8f7c6b5a4d3e2f ``` `started_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** ```bash 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." } ] }' ``` **TypeScript** ```ts await sparkle.conversations.turns.send(conversation.id, [ { 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.", }, ]); ``` **Python** ```python requests.post( f"{API}/conversations/{conversation_id}/turns", headers={**headers, "Idempotency-Key": str(uuid.uuid4())}, json={ "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.", }, ] }, ).raise_for_status() ``` **Go** ```go type Turn struct { ID string `json:"id"` Final bool `json:"final"` Speaker string `json:"speaker"` Name string `json:"name,omitempty"` Channel string `json:"channel"` Start float64 `json:"start"` End float64 `json:"end"` Text string `json:"text"` } payload, _ := json.Marshal(map[string][]Turn{"turns": { {"t1", true, "sam", "Sam", "mic", 0.8, 4.1, "Okay, let's go with the two-year term at the current tier."}, {"t2", true, "dana", "Dana", "remote", 21.0, 23.4, "I'll get the SSO fix out by Friday."}, }}) url := "https://api.sparkle.ai/public/v1/conversations/" + created.Conversation.ID + "/turns" req, _ := http.NewRequest("POST", url, bytes.NewReader(payload)) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Idempotency-Key", rand.Text()) req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) ``` Sparkle answers `202 Accepted` with no body: it has stored the turns and reads them in the background. [The turn contract](/docs/concepts/turns) 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** ```bash curl -N https://api.sparkle.ai/public/v1/conversations/$CONVERSATION_ID/stream \ -H "X-API-Key: $SPARKLE_API_KEY" ``` **TypeScript** ```ts for await (const event of sparkle.conversations.stream(conversation.id)) { if (event.type === "moment.detected") { console.log(event.data.kind, event.data.speaker.name, event.data.text); } } ``` **Python** ```python import json with requests.get( f"{API}/conversations/{conversation_id}/stream", headers=headers, stream=True ) as stream: for line in stream.iter_lines(decode_unicode=True): if line.startswith("data: "): moment = json.loads(line[len("data: "):])["data"] print(moment["kind"], moment["speaker"]["name"], moment["text"]) ``` **Go** ```go url := "https://api.sparkle.ai/public/v1/conversations/" + created.Conversation.ID + "/stream" req, _ := http.NewRequest("GET", url, nil) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() scanner := bufio.NewScanner(resp.Body) scanner.Buffer(make([]byte, 0, 64*1024), 1<<20) for scanner.Scan() { if data, ok := strings.CutPrefix(scanner.Text(), "data: "); ok { var event struct { Data struct { Kind string `json:"kind"` Text string `json:"text"` } `json:"data"` } json.Unmarshal([]byte(data), &event) fmt.Println(event.Data.Kind, event.Data.Text) } } ``` Two events arrive. Lines that start with `:` are comments that keep the connection open: ```text : 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: ```json { "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](/docs/concepts/timing) 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: **TypeScript** ```ts title="server.ts" import { createServer } from "node:http"; import { Sparkle, SparkleSignatureError } from "@sparkle/sdk"; const seen = new Set(); 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); ``` **Python** ```python title="server.py" import hashlib import hmac import json import os import time from flask import Flask, request app = Flask(__name__) SECRET = os.environ["SPARKLE_WEBHOOK_SECRET"].encode() seen: set[str] = set() def verify(header: str, body: bytes) -> bool: parts = [part.strip().partition("=") for part in header.split(",")] t = next((value for key, _, value in parts if key == "t"), "") signatures = [value for key, _, value in parts if key == "v1"] if not t.isdigit() or not signatures or abs(time.time() - int(t)) > 300: return False expected = hmac.new(SECRET, f"{t}.".encode() + body, hashlib.sha256).hexdigest() return any(hmac.compare_digest(expected, sig) for sig in signatures) @app.post("/sparkle") def sparkle(): body = request.get_data() if not verify(request.headers.get("Sparkle-Signature", ""), body): return "invalid signature", 400 event = json.loads(body) if event["id"] not in seen: seen.add(event["id"]) if event["type"] == "moment.detected": print(event["type"], event["data"]["kind"], event["data"]["text"]) else: print(event["type"]) return "", 204 app.run(port=3000) ``` **Go** ```go title="main.go" package main import ( "crypto/hmac" "crypto/sha256" "encoding/hex" "encoding/json" "fmt" "io" "net/http" "os" "strconv" "strings" "time" ) func verify(secret, header string, body []byte) bool { var t string var signatures []string for _, part := range strings.Split(header, ",") { key, value, _ := strings.Cut(strings.TrimSpace(part), "=") switch key { case "t": t = value case "v1": signatures = append(signatures, value) } } signedAt, err := strconv.ParseInt(t, 10, 64) if err != nil || len(signatures) == 0 { return false } if age := time.Now().Unix() - signedAt; age > 300 || age < -300 { return false } mac := hmac.New(sha256.New, []byte(secret)) mac.Write([]byte(t + ".")) mac.Write(body) expected := mac.Sum(nil) for _, signature := range signatures { got, err := hex.DecodeString(signature) if err == nil && hmac.Equal(got, expected) { return true } } return false } func main() { secret := os.Getenv("SPARKLE_WEBHOOK_SECRET") seen := map[string]bool{} http.HandleFunc("POST /sparkle", func(w http.ResponseWriter, r *http.Request) { body, _ := io.ReadAll(r.Body) if !verify(secret, r.Header.Get("Sparkle-Signature"), body) { http.Error(w, "invalid signature", http.StatusBadRequest) return } var event struct { ID string `json:"id"` Type string `json:"type"` Data map[string]any `json:"data"` } json.Unmarshal(body, &event) if !seen[event.ID] { seen[event.ID] = true if kind, ok := event.Data["kind"]; ok { fmt.Println(event.Type, kind, event.Data["text"]) } else { fmt.Println(event.Type) } } w.WriteHeader(http.StatusNoContent) }) http.ListenAndServe(":3000", nil) } ``` 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: ```text 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** ```bash curl -X POST https://api.sparkle.ai/public/v1/conversations/$CONVERSATION_ID/end \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" ``` **TypeScript** ```ts await sparkle.conversations.end(conversation.id); ``` **Python** ```python requests.post( f"{API}/conversations/{conversation_id}/end", headers={**headers, "Idempotency-Key": str(uuid.uuid4())}, ).raise_for_status() ``` **Go** ```go url := "https://api.sparkle.ai/public/v1/conversations/" + created.Conversation.ID + "/end" req, _ := http.NewRequest("POST", url, nil) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Idempotency-Key", rand.Text()) resp, err := http.DefaultClient.Do(req) ``` ```json { "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](https://docs.sparkle.ai/docs/concepts/turns): The turn contract: partial turns, corrections and speakers. - [Connect Recall.ai or Deepgram](https://docs.sparkle.ai/docs/receivers/recall): Let a meeting bot or a speech-to-text stream post the turns for you. - [Define your own moment](https://docs.sparkle.ai/docs/guides/custom-moments): Describe it in plain English, test it on a transcript, then make it live. - [Import a finished call](https://docs.sparkle.ai/docs/guides/import): Run a recorded transcript through the same detection after the call. Source: https://docs.sparkle.ai/docs/quickstart.md --- # Conversations and sources > A conversation is one call or meeting. Sources are how its transcript gets in. A conversation is one call, meeting or interview. It holds the turns of its transcript and the moments Sparkle found in them, and it has its own clock: turn times are seconds from its `started_at`. ## Who owns what Your company has one or more organizations, such as one per product or per team. API keys, conversations, webhooks and custom moments belong to one organization, and a key only sees its own organization's data. A conversation is created in the environment of the key that created it, `test` or `live`, and says so in its `environment` field. Test conversations are never billed. ## Create a conversation **@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](https://sparkle.ai/contact). Python and Go have no SDK yet: the cURL, Python and Go tabs call the HTTP API directly. **cURL** ```bash 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": "Globex onboarding", "receivers": ["recall"], "moment_types": ["decision", "request.do", "knowledge_gap"], "webhook_url": "https://example.com/hooks/sparkle", "metadata": { "crm_account": "acct_8812" } }' ``` **TypeScript** ```ts const { conversation, receivers, webhook } = await sparkle.conversations.create({ title: "Globex onboarding", receivers: ["recall"], moment_types: ["decision", "request.do", "knowledge_gap"], webhook_url: "https://example.com/hooks/sparkle", metadata: { crm_account: "acct_8812" }, }); ``` **Python** ```python created = requests.post( "https://api.sparkle.ai/public/v1/conversations", headers={ "X-API-Key": os.environ["SPARKLE_API_KEY"], "Idempotency-Key": str(uuid.uuid4()), }, json={ "title": "Globex onboarding", "receivers": ["recall"], "moment_types": ["decision", "request.do", "knowledge_gap"], "webhook_url": "https://example.com/hooks/sparkle", "metadata": {"crm_account": "acct_8812"}, }, ).json() ``` **Go** ```go body := strings.NewReader(`{ "title": "Globex onboarding", "receivers": ["recall"], "moment_types": ["decision", "request.do", "knowledge_gap"], "webhook_url": "https://example.com/hooks/sparkle", "metadata": {"crm_account": "acct_8812"} }`) req, _ := http.NewRequest("POST", "https://api.sparkle.ai/public/v1/conversations", body) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Idempotency-Key", rand.Text()) req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) ``` Every field is optional: | Field | What it does | | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | `title` | A label for the conversation, up to 200 characters. | | `started_at` | Time zero of the conversation's clock. Defaults to now; set it when the call began earlier than you create the conversation. | | `receivers` | `recall` or `deepgram`: vendors that will post the transcript for you. Each gets a receiver path in the response, shown only once. | | `moment_types` | The [moment kinds](/docs/concepts/moments) to detect, built-in or custom. Empty or absent detects every built-in kind and every live custom moment. | | `webhook_url` | An HTTPS URL that receives this conversation's events. The response's `webhook.secret` signs them, shown only once. | | `metadata` | Your own JSON, up to 16 KB, returned as sent. | ## Sources A source is how a conversation's transcript arrives. Pick the one that matches what you already have: | You have | Use | | --------------------------------------------------------- | ------------------------------------------------------------------------------------------- | | Your own speech-to-text, or any transcript as it's spoken | [Post turns](/docs/concepts/turns) to `POST /conversations/{id}/turns`. | | A Recall.ai meeting bot | The [Recall.ai receiver](/docs/receivers/recall): Recall posts its transcript to Sparkle. | | A Deepgram live stream | The [Deepgram receiver](/docs/receivers/deepgram): forward Deepgram's results as they come. | | A microphone or a meeting tab in a web page | [Capture audio in the browser](/docs/guides/browser-audio): Sparkle transcribes it. | | Raw audio on a server, a phone bridge or a mobile app | The [audio streaming protocol](/docs/api/audio-streaming). | | A finished recording's transcript | [Import it](/docs/guides/import) with `POST /conversations/import`. | Every source produces turns under the same [turn contract](/docs/concepts/turns), and every turn records the source it came from. Send each stretch of speech through one source. [Sources](/docs/concepts/sources) says when to use each, and covers connections, which create a conversation per call for you. ## Lifecycle | `status` | Means | | ------------ | ------------------------------------------------------------------------------------------------ | | `live` | It takes turns and detects moments as they arrive. | | `processing` | An [imported](/docs/guides/import) transcript is being read. `progress` counts the turns read. | | `ended` | It takes no more turns. Moments still settling go out within seconds, then `conversation.ended`. | End a live conversation with `POST /conversations/{id}/end` when the call is over. Sparkle lets go any moment still settling, then sends `conversation.ended` with a summary of what it found. An imported conversation ends by itself. A live conversation left open ends by itself too, once no turn has arrived for 60 minutes (counted from when it was created or started, if it never had a turn). An open [audio socket](/docs/api/audio-streaming) keeps it live, even through silence. It ends the same way an end call does, and `conversation.ended` says why in `data.reason`: | `reason` | Means | | ----------- | ------------------------------------------------------------------------ | | `requested` | You ended it, with `POST /conversations/{id}/end` or from the dashboard. | | `idle` | No turn arrived for 60 minutes and no audio socket was open. | | `completed` | An imported transcript was read to its end. | | `failed` | An imported transcript could not be read to its end. | Handle a `reason` you don't recognize as `requested`: more may be added. `DELETE /conversations/{id}` erases the conversation with its turns, its moments and the webhook deliveries that carry them. Your webhook subscriptions get `conversation.deleted`. ## Read it back | Endpoint | Returns | | --------------------------------- | ------------------------------------------------------- | | `GET /conversations` | The organization's conversations, newest first. | | `GET /conversations/{id}` | One conversation, with `moments_count` so far. | | `GET /conversations/{id}/turns` | Its stored turns in start order, partial ones included. | | `GET /conversations/{id}/moments` | Its moments, in the order they were let go. | Lists are cursor-paginated: pass the previous response's `page_info.end_cursor` as `cursor`, and up to 100 items per page as `limit`. Source: https://docs.sparkle.ai/docs/concepts/conversations.md --- # Sources > The ways a transcript reaches Sparkle, and when to use each. A source is how a conversation's transcript reaches Sparkle. Every source produces turns under the same [turn contract](/docs/concepts/turns), and the moments arrive the same way whichever one sent them. | You have | Use | | --------------------------------------------------------------- | -------------------------------------------------------------------- | | Your own speech-to-text, or any transcript as it's spoken | [Your app sends turns](#your-app-sends-turns). | | A microphone or meeting tab in a web page, or raw audio | [Audio](#audio): Sparkle transcribes it. | | Recall.ai bots or Deepgram streams that start outside your code | A [connection](#connections): one URL, a conversation per call. | | A Recall.ai bot or Deepgram stream your code starts | A [per-conversation receiver](#per-conversation-receivers). | | A finished recording's transcript | [Import it](/docs/guides/import) with `POST /conversations/import`. | | Zoom meetings with cloud recording | A [Zoom connection](/docs/connections/zoom): sign in with Zoom once. | ## Your app sends turns Your code creates the conversation, then posts what people said to `POST /conversations/{id}/turns`, through the API or `@sparkle/sdk`. Use it when you already have text: your own speech-to-text, a vendor you read yourself, or a chat. You choose the speaker keys and turn ids, and you end the conversation when the call is over. See [the turn contract](/docs/concepts/turns). ## Audio Sparkle transcribes the audio for you, and stores only the turns. * In a web page, `recordAudio` from `@sparkle/sdk/browser` streams the microphone and a meeting tab. See [Capture audio in the browser](/docs/guides/browser-audio). * On a server, a phone bridge or a mobile app, speak the [audio streaming protocol](/docs/api/audio-streaming) directly. Both need a conversation your code created, and bill [transcription minutes](/docs/concepts/plans#how-transcription-is-metered). ## Connections A connection is one permanent receiver URL for a vendor, set up once for the organization. You give the URL to Recall.ai or Deepgram, and every call the vendor sends to it becomes a conversation of its own: Sparkle creates it on the call's first event, in the connection's environment, and tags its metadata with the connection and the vendor's id for the call. A call's conversation ends when the vendor reports the end of the call. If that report never comes, it ends after 60 minutes without a turn, as any [live conversation](/docs/concepts/conversations#lifecycle) does. Set one up in the guides for [Recall.ai](/docs/connections/recall) and [Deepgram](/docs/connections/deepgram). ## Per-conversation receivers Your code creates the conversation with `"receivers": ["recall"]` or `["deepgram"]`, and the response holds a receiver path for that conversation alone. You give that URL to the bot or stream you start for the call. See the [Recall.ai](/docs/receivers/recall) and [Deepgram](/docs/receivers/deepgram) receivers. ## Connection or per-conversation receiver? Use a connection when calls start outside your code and you don't want to create conversations yourself. Use a per-conversation receiver when your code already creates the conversation and wants its id, its own `webhook_url` or its title up front. | | Connection | Per-conversation receiver | | ------------------ | ----------------------------------------------------------------------------- | -------------------------------------------------------- | | URL | One per connection, for every call. | One per conversation. | | Conversation | Created by Sparkle on the call's first event. | Created by your code, before the call. | | Title and metadata | Set from the vendor: `Recall.ai call 3f2a9c1e`, the call's id in metadata. | Yours. | | Events | The organization's [webhook subscriptions](/docs/webhooks). | Subscriptions, and the conversation's own `webhook_url`. | | Ends | On the vendor's end of the call, or after 60 minutes without a turn. | When you end it, or after 60 minutes without a turn. | | Recall.ai bots | In your own Recall.ai workspace, given its verification secret, or Sparkle's. | In Sparkle's Recall.ai workspace only. | Source: https://docs.sparkle.ai/docs/concepts/sources.md --- # The turn contract > The shape every transcript takes in Sparkle, and the four rules that make sending it safe. There is no standard transcript format, so Sparkle defines one. A turn is one stretch of one person speaking. The [receivers](/docs/receivers/recall) turn a vendor's payload into turns for you; when you post your own, each turn looks like this: ```json { "id": "t_812", "final": true, "speaker": "spk_2", "name": "Dana", "channel": "remote", "start": 778.2, "end": 781.0, "text": "I'll get the SSO fix out by Friday." } ``` | Field | Type | Meaning | | -------------- | ----------------- | -------------------------------------------------------------------------------------------------- | | `id` | string | Your ID for the turn, up to 255 characters. Moments name the turns they read by it, in `turn_ids`. | | `final` | boolean | Whether the turn is finished. Partial turns are stored but never detected on. | | `speaker` | string | A stable key for who is speaking: the same key is the same person, for the whole conversation. | | `name` | string, optional | The speaker's name, when you know it. | | `channel` | `mic` or `remote` | `mic` for whoever runs the capture, `remote` for everyone else. | | `start`, `end` | number | Seconds from the conversation's `started_at`. | | `text` | string | What was said. | Send up to 500 turns per request to `POST /conversations/{id}/turns`. Sparkle answers `202` with no body once it has stored them. ## The four rules ### The same id replaces Sending a turn again under the same `id` replaces it, so a correction or a growing partial never becomes a second turn. Each replacement adds one to the stored turn's `revision`. ### Only final turns reach detection Speech-to-text sends partial results while someone talks. Send them if you want them stored, with `"final": false`, then send the finished version under the same `id` with `"final": true`. Sparkle reads a turn the first time it arrives final, and only then. The partial: ```json { "id": "t_812", "final": false, "speaker": "spk_2", "channel": "remote", "start": 778.2, "end": 779.6, "text": "I'll get the SSO" } ``` Then the final version, which replaces it: ```json { "id": "t_812", "final": true, "speaker": "spk_2", "channel": "remote", "start": 778.2, "end": 781.0, "text": "I'll get the SSO fix out by Friday." } ``` This is also what makes retries safe: a batch sent twice reads each final turn once. ### Order doesn't matter Within a batch, Sparkle sorts turns by `start` before reading them. Batches are read in the order they arrive, so a turn that arrives late is still read, after the ones already sent. ### Speaker is a key, name is a fact `speaker` says which person is talking; `name` says who that person is, when you know. Use whatever key your speech-to-text gives you (`spk_2`, a participant ID, a channel number) and keep it the same for the same person. Add `name` when a roster or a sign-in tells you, even partway through the call. A moment carries both, as `speaker.key` and `speaker.name`. ## Send turns Send turns as they finish, every second or two, or in larger batches if you buffer. The sooner a final turn arrives, the sooner its moment can. **@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](https://sparkle.ai/contact). Python and Go have no SDK yet: the cURL, Python and Go tabs call the HTTP API directly. **cURL** ```bash 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": "t_812", "final": true, "speaker": "spk_2", "name": "Dana", "channel": "remote", "start": 778.2, "end": 781.0, "text": "I'\''ll get the SSO fix out by Friday." } ] }' ``` **TypeScript** ```ts await sparkle.conversations.turns.send(conversationId, [ { id: "t_812", final: true, speaker: "spk_2", name: "Dana", channel: "remote", start: 778.2, end: 781.0, text: "I'll get the SSO fix out by Friday.", }, ]); ``` **Python** ```python requests.post( f"https://api.sparkle.ai/public/v1/conversations/{conversation_id}/turns", headers={ "X-API-Key": os.environ["SPARKLE_API_KEY"], "Idempotency-Key": str(uuid.uuid4()), }, json={ "turns": [ { "id": "t_812", "final": True, "speaker": "spk_2", "name": "Dana", "channel": "remote", "start": 778.2, "end": 781.0, "text": "I'll get the SSO fix out by Friday.", } ] }, ).raise_for_status() ``` **Go** ```go payload := []byte(`{"turns": [{ "id": "t_812", "final": true, "speaker": "spk_2", "name": "Dana", "channel": "remote", "start": 778.2, "end": 781.0, "text": "I'll get the SSO fix out by Friday." }]}`) url := "https://api.sparkle.ai/public/v1/conversations/" + conversationID + "/turns" req, _ := http.NewRequest("POST", url, bytes.NewReader(payload)) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Idempotency-Key", rand.Text()) req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) ``` Consecutive turns from the same speaker are read together, so splitting a long stretch of speech into several turns is fine. A moment's `text` is the turns it read, merged, and `turn_ids` lists them all. Source: https://docs.sparkle.ai/docs/concepts/turns.md --- # Moments > The ten built-in moment kinds, what each one fires on, and what a moment carries. A moment is something that happened in a conversation that your product may want to act on. Sparkle reads each finished turn once, with the six turns before it for context, and picks at most one built-in kind for it. Most turns are none of them. ## The ten kinds | Kind | Fires on | Example | | ------------------- | --------------------------------------------------------------------------- | ----------------------------------------------- | | `question.open` | A factual question to the whole room. | "Does anyone know how many seats they have?" | | `question.directed` | A question to one person who is present. | "Dana, what's the SLA on that?" | | `knowledge_gap` | A missing fact, or a fact stated with a hedge that a source could settle. | "I think they own about 51%, but I'm not sure." | | `reference` | An outside thing someone leans on from memory: a law, a method, a document. | "That's done under a scheme of arrangement." | | `request.find` | A request to pull up something that already exists. | "Can someone pull up the NDA?" | | `request.do` | New work asked for, or promised. | "I'll send the board a summary tonight." | | `decision` | The room settles how to proceed. | "Let's go with the two-year term." | | `work_item` | A bug, a wish or a fix named and not yet captured. | "That export button is broken." | | `next_steps` | Someone asks what happens next. | "Where do we go from here?" | | `ideas_wanted` | Someone asks for options or ideas. | "Any ideas for the launch?" | Sparkle also has two options for talk that isn't a moment, `still_discussing` and `small_talk`, so a turn isn't forced into the nearest kind. Those two are never sent. Each kind belongs to a [timing profile](/docs/concepts/timing), which decides how long it waits before it goes out: | Profile | Kinds | Waits | | ------------ | ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------- | | answer | `question.open`, `question.directed`, `knowledge_gap`, `reference`, `request.find`, `next_steps` | About 2 seconds of quiet, 5 seconds at most | | act | `decision`, `work_item` | 5 seconds of quiet, 12 seconds at most | | act, at once | `request.do` | No wait | | ideas | `ideas_wanted` | 8 seconds of quiet, 20 seconds at most, then 90 seconds before the next | To detect only some kinds, list them in the conversation's `moment_types` when you create it. ## Your own kinds The ten kinds cover what most calls have in common. For what's specific to your business, such as a pricing objection or a promise a compliance team must review, [define a custom moment](/docs/guides/custom-moments) in plain English. Its moments arrive the same way, with its name as their `kind`. A turn can be a built-in kind and a custom one at once. ## What a moment carries ```json { "id": "mom_2kd7qa1c5e9g3j7l0npw", "object": "moment", "conversation_id": "cnv_2kd7q1v9x4m8r2t6b3ny", "kind": "knowledge_gap", "title": "Sam · Whether EU data must stay in-region", "text": "I think our EU data has to stay in-region, but I'm not sure.", "speaker": { "key": "sam", "name": "Sam" }, "at": 1284.6, "confidence": 0.88, "turn_ids": ["t_301"], "settled_ms": 2000, "classifier": "typesafe:…", "definition": null, "created_at": "2026-12-03T15:21:27.112394Z" } ``` | Field | Meaning | | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | | `id` | The moment. | | `kind` | One of the ten kinds, or a custom moment's name. | | `text` | What was said: the turn that set it off, merged with the same speaker's turns just before it. | | `speaker` | `key` is the speaker key the turn was sent with; `name` its name, or `null`. | | `at` | When that turn ended, in seconds from the conversation's `started_at`. | | `confidence` | The classifier's probability for the moment, from 0 to 1. | | `turn_ids` | Your IDs of the turns in `text`. Consecutive turns by one speaker are merged before detection, so this can list several and `text` joins them. | | `settled_ms` | How long Sparkle waited after the turn ended before letting the moment go, in conversation time. | | `classifier` | The classifier that read the turn. | | `definition` | For a custom moment, its `id`, the `version` that fired, and the `label` and `color` it had then; `null` for a built-in kind. | | `title` | A short line saying who did what, such as `Dana · Ship the SSO fix by Friday`, written by Claude Haiku. `null` when none was written in time. | A moment reaches you inside an event, as a webhook and on the conversation's stream. [Delivery](/docs/concepts/delivery) covers both. Source: https://docs.sparkle.ai/docs/concepts/moments.md --- # Timing profiles > Why a decision waits a few seconds and a request doesn't. Sending a moment the instant a turn ends is often wrong. A decision's first sentence usually comes before the one that settles it; a question may be answered by the room a second later; a brainstorm asks for ideas five times in a minute. Each moment kind has a timing profile that says how long to wait, so you get the conclusion once rather than the first half of it, or the same thing three times. | Profile | Kinds | Quiet | At most | Cooldown | | ------------ | ------------------------------------------------------------------------------------------------ | ----- | ------- | -------- | | answer | `question.open`, `question.directed`, `knowledge_gap`, `reference`, `request.find`, `next_steps` | 2 s | 5 s | 3 s | | act | `decision`, `work_item` | 5 s | 12 s | 10 s | | act, at once | `request.do` | none | none | 10 s | | ideas | `ideas_wanted` | 8 s | 20 s | 90 s | * **Quiet** is how long a moment waits for another turn of the same profile to fire. Each new one restarts the wait. * **At most** caps the wait, counted from the end of the first turn that fired, so a long exchange still produces its moment. * **Cooldown** is the gap after one moment of a profile before the next one of that profile can go. Every timer runs on the conversation's clock, the `start` and `end` of its turns, not on when the request arrived. An [imported transcript](/docs/guides/import) gets the moments a live run of the same call would have. Each moment's `settled_ms` tells you how long it waited. ## A decision waits for the exchange to land ```text conversation time (s) 40 43.1 44.0 48.2 53.2 │ │ │ │ │ Sam ├───────────┤ "So we're aligned on the term." │ └─ decision fires, waits │ │ Dana ├─────────────────┤ "Let's go with two years at the current tier." └─ decision fires, joins the wait ······· 5 s of quiet ······► sent: one moment, Dana's line ``` Sam's line reads as a decision forming, and Dana's settles it. Both fire as `decision`, and the act profile holds them together until 5 seconds pass without another. The latest one stands for the whole exchange, so you receive one moment, with Dana's words and `settled_ms: 5000`, instead of a half-made decision followed by a correction. ## A request goes at once "I'll get the SSO fix out by Friday." is complete when it's said: there is nothing to wait for. `request.do` skips the quiet window and goes out with `settled_ms: 0`. If a decision or a work item of the same exchange is still waiting, the request takes its place: you receive one `request.do`, not a half-settled decision followed by the request. The one exception is the cooldown: a second request within 10 seconds of the last act moment waits for the cooldown to end, like any other act moment. ## A question goes while it still hangs Questions and knowledge gaps are worth the most while nobody has answered yet. The answer profile waits 2 seconds of quiet, never more than 5, and sends every question it held, so a second question asked right behind the first is kept rather than lost. ## A brainstorm wakes you once People ask for ideas again and again as a brainstorm warms up. The ideas profile waits for 8 seconds of quiet, then ignores repeated `ideas_wanted` for the next 90 seconds: one moment serves the whole brainstorm. ## When a conversation ends Ending a conversation lets every moment that is still waiting go at once, after the turns already sent. [Custom moments](/docs/guides/custom-moments) pick one of the three profiles with their `timing` field. Source: https://docs.sparkle.ai/docs/concepts/timing.md --- # Delivery > How events reach you, by stream or webhook, and how to handle retries, replays and repeats. Every moment goes out as a `moment.detected` event. You can receive it three ways, and use more than one at once: | Use | When | How | | ------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------- | | The conversation's event stream | A live UI, or a worker that follows one conversation. | `GET /conversations/{id}/stream`, server-sent events. | | The conversation's own webhook | Whoever starts the conversation handles its events. | Pass `webhook_url` when you create it. | | A webhook subscription | One backend handles every conversation of the organization. | `POST /webhooks`, or **Webhooks** in the dashboard. | The stream carries `moment.detected` only. Webhooks also get the conversation's lifecycle: | Event | When | | ---------------------- | ------------------------------------------------------------------------------------- | | `conversation.created` | A conversation was created. | | `moment.detected` | A moment was let go. | | `conversation.ended` | An ended conversation let go its last moment. `data.summary` counts what it produced. | | `conversation.deleted` | A conversation was deleted, with everything it held. Subscriptions only. | ## The event The same envelope travels on every path: ```json { "id": "evt_2kd7qd8k2p6t0x4a7c1f", "object": "event", "type": "moment.detected", "livemode": false, "created_at": "2026-12-03T15:00:31Z", "data": { "id": "mom_2kd7qb3f7j1n5r9v2y6d", "object": "moment", "kind": "request.do", "text": "I'll get the SSO fix out by Friday.", "…": "…" } } ``` The event `id` is the one to deduplicate on. It's the same on the stream and in the webhook, on every retry and replay, and when one event goes to several URLs. Store the IDs you've handled and skip one you've seen. ## The stream The stream sends the moments already let go first, then each new one as it's let go, until you disconnect: ```text : connected id: 1796310031377-0 event: moment.detected data: {"id":"evt_2kd7qd8k2p6t0x4a7c1f","object":"event","type":"moment.detected","livemode":false,"data":{…}} : heartbeat ``` * Lines starting with `:` are comments that keep the connection open. Ignore them. * Each event's `id:` line is its position in the stream, not the event ID. To resume after a dropped connection, send the last one back in the `Last-Event-ID` header and the stream continues after it. Browser `EventSource` does this for you. * The stream needs your API key, so open it from your server, never from a browser, and relay what your UI needs. **@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](https://sparkle.ai/contact). Python and Go have no SDK yet: the cURL, Python and Go tabs call the HTTP API directly. **cURL** ```bash curl -N https://api.sparkle.ai/public/v1/conversations/$CONVERSATION_ID/stream \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Last-Event-ID: 1796310031204-0" ``` **TypeScript** ```ts for await (const event of sparkle.conversations.stream(conversationId, { lastEventId: "1796310031204-0", })) { if (event.type === "moment.detected") { console.log(event.data.kind, event.data.text); } } ``` **Python** ```python with requests.get( f"https://api.sparkle.ai/public/v1/conversations/{conversation_id}/stream", headers={ "X-API-Key": os.environ["SPARKLE_API_KEY"], "Last-Event-ID": "1796310031204-0", }, stream=True, ) as stream: for line in stream.iter_lines(decode_unicode=True): if line.startswith("data: "): event = json.loads(line[len("data: "):]) print(event["type"], event["data"]["kind"], event["data"]["text"]) ``` **Go** ```go url := "https://api.sparkle.ai/public/v1/conversations/" + conversationID + "/stream" req, _ := http.NewRequest("GET", url, nil) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Last-Event-ID", "1796310031204-0") resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close() scanner := bufio.NewScanner(resp.Body) scanner.Buffer(make([]byte, 0, 64*1024), 1<<20) for scanner.Scan() { if data, ok := strings.CutPrefix(scanner.Text(), "data: "); ok { fmt.Println(data) } } ``` ## Webhooks Each delivery is a `POST` with the event as its body and three headers: `Sparkle-Event` (the type), `Sparkle-Delivery` (the delivery, the same on every retry) and `Sparkle-Signature`. Check the signature before you trust the body: [Verify the signature](/docs/webhooks#verify-the-signature) has the code. * **Answer `2xx` within 30 seconds.** Do slow work after you answer. * **Retries.** A network error, a timeout, a `429` or a `5xx` is retried: up to 5 attempts, the first at once and the next after 1, 2, 4 and 8 minutes. Any other `4xx` fails the delivery at once. * **Replay.** `POST /webhooks/{id}/deliveries/{deliveryId}/replay` sends a delivery again, for example after you fix your endpoint. The replay carries the same event `id`. * **Order.** Each delivery is sent and retried on its own, so events can arrive out of order. `conversation.ended` is emitted after a conversation's last moment; treat the conversation as complete once you hold `summary.moments_count` of its moments. A conversation's own webhook and a subscription are independent. When both exist, each event goes to both, with the same event `id`. [Webhooks](/docs/webhooks) covers subscriptions, secrets, deliveries and replay in full. ## Catching up If you missed events, `GET /conversations/{id}/moments` lists a conversation's moments in the order they were let go. Each one has the moment `id` that was inside its event's `data`. ## Safe retries on your side Every `POST` and `PUT` you send needs an `Idempotency-Key` header, such as a UUID. Sending the same key again returns the first request's response and does nothing twice, so when a request times out, retry it with the same key. Use a new key for each new request. A retry that arrives while the first is still running gets [`409 conflict.idempotency_key`](/docs/api/errors/conflict): wait, then send it again. Source: https://docs.sparkle.ai/docs/concepts/delivery.md --- # Security and data > API keys, signed webhooks, how long Sparkle keeps a transcript, and how to erase one. ## API keys Every request carries an API key in the `X-API-Key` header. A key belongs to one organization of your company and sees only that organization's conversations, webhooks and custom moments. | Prefix | Environment | Use | | ----------- | ----------- | ----------------------------------- | | `spk_test_` | test | Building and testing. Never billed. | | `spk_live_` | live | Production traffic. | A conversation records the environment of the key that created it. Each key also has a role (owner, editor or viewer) and can be limited to some scopes; `GET /me` shows what the key in a request can do. * Keep keys on your server. Never ship one in a browser or a mobile app: the stream, the turns endpoint and everything else need a key, so relay what your client needs from your backend. * Create one key per service, so you can revoke one without touching the others. Manage them in the dashboard under **Settings → API keys**. * A receiver URL, such as the one for [Recall.ai](/docs/receivers/recall), carries a token that identifies its conversation. Treat it like a key. ## Signed webhooks Every webhook delivery carries a `Sparkle-Signature` header: an HMAC-SHA256 of the timestamp and the raw body, keyed with the subscription's secret or the conversation's `webhook.secret`. Before you trust a delivery: 1. Compute the HMAC over the raw body, before parsing it, and compare in constant time. 2. Reject a timestamp more than 5 minutes from your clock, so a captured request can't be replayed later. 3. Drop an event `id` you've already handled. [Verify the signature](/docs/webhooks#verify-the-signature) has the exact format and the code. Secrets are shown once, when they're created; rotating one in the dashboard takes effect on the next attempt. ## What Sparkle keeps, and for how long | Data | Kept | | -------------------------------------------------------- | ---------------------- | | Turns and moments | 30 days, then deleted. | | The conversation itself: title, metadata, status, counts | Until you delete it. | Sparkle processes a conversation on your behalf: you decide what it holds and when it goes. The receivers log each request's outcome, never the transcript. ## Deleting `DELETE /conversations/{id}` erases the conversation with its turns, its moments and the webhook deliveries that carry them, and stops its stream. Your subscriptions receive `conversation.deleted`. Use it when someone in a call asks to be forgotten. Deleting your company in the dashboard schedules everything in it for erasure after 30 days, during which you can restore it. Source: https://docs.sparkle.ai/docs/concepts/security.md --- # Plans & limits > What each plan includes, how minutes are metered, and what the API answers at a limit. Every company is on one plan. A new company starts on **Free**. An owner upgrades to **Pro** or **Scale** in **Settings → Plan and billing**, paying by card for the live minutes used each month, and for the audio Sparkle transcribes; see [Billing](/docs/concepts/billing). **Enterprise** is the one plan you ask for rather than buy: an owner sends the request with **Contact sales** on the same page, and Sparkle's team sets the plan once the agreement is in place. Pro and Scale can't be requested. When you run Sparkle locally, billing is simulated: an owner switches to any plan, Enterprise included, at once and for free. See [Billing](/docs/concepts/billing#local-development). `GET /public/v1/plan` returns your plan, its limits, what it includes and the usage counted against it, for any key of the organization. The dashboard reads the same from `GET /api/v1/plan`. ## Plans | | Free | Pro | Scale | Enterprise | | ---------------------------------- | ------------------- | --------------------------- | ------------------------------------------------------------ | ---------------------------- | | Price | $0 | $0.015 / min | $500 / month minimum, then from $0.012 / min, down to $0.006 | Committed | | Live minutes a month | 1,000, then refused | 1,000 included, then billed | 1,000 included, then billed | Committed volume | | Test minutes a month | 2,000 | 10,000 | 50,000 | Unlimited | | Transcription minutes a month | 60, then refused | $0.012 / stream-minute | $0.012 / stream-minute | By agreement | | Test transcription minutes a month | 60 | 300 | 1,000 | Unlimited | | Live conversations at once | 2 | 25 | 250 | Unlimited | | Custom moments per organization | 3 | 50 | 100 | Unlimited | | Shadow mode | — | ✓ | ✓ | ✓ | | Webhook endpoints per organization | 3 | 25 | 100 | Unlimited | | API keys per organization | 4 | 25 | 100 | Unlimited | | Organizations | 2 | 5 | 25 | Unlimited | | Members | 5 | 15 | 50 | Unlimited | | Retention of turns and moments | 30 days | 30 days | 30 days | 30 days, longer by agreement | | Turns per import | 1,000 | 5,000 | 5,000 | 5,000 | | API requests a minute, per key | 120 | 600 | 3,000 | 6,000 | | Event streams open at once | 5 | 50 | 500 | Unlimited | | Minutes per audio stream | 120 | 240 | 480 | Unlimited | | Dedicated throughput | — | — | ✓ | ✓ | | SLA, VPC or self-hosted model | — | — | — | ✓ | | Custom data processing terms | — | — | — | ✓ | Every plan detects every built-in moment type, with webhooks and event streams. At most 25 custom moments run live in an organization at once, on any plan. Enterprise limits are set per agreement. An [audio stream](/docs/api/audio-streaming) that reaches its minutes closes with `audio.session_limit`; a new session continues it, and the browser SDK does that for you. Some rows are not enforced yet: event streams are not counted, and retention is 30 days on every plan, Enterprise included, until a longer window is agreed and configured. ## How minutes are metered Usage is **billed per second, quoted per minute**. A conversation meters the longest of these readings, rounded up to the whole second, with no rounding to minutes: * **Span**: from the first final turn's start to the last final turn's end, on the transcript's own timestamps. * **Words**: the words of all final turns, at 150 a minute. A transcript whose timestamps are compressed still meters what was said. * **Audio**: when Sparkle transcribes the conversation's audio, the seconds its longest stream sent. The transcriber runs whether or not anyone speaks. A 61-second call meters 61 seconds; a conversation of 4 turns across 3 minutes and 10 seconds meters 3 minutes 10 seconds; an import of 900 words whose timestamps span one minute meters 6 minutes. Partial turns meter nothing until their final version arrives. Sending a turn again, or revising it, never meters it twice: the meter only rises to what the stored turns now add up to. Live conversations meter as their turns arrive and settle when they end; an import meters once, exactly as the same turns sent live would. Minutes count per UTC month, for the whole company, as the seconds metered divided by 60, so a monthly allowance such as Free's 1,000 live minutes is 60,000 seconds. **Test keys and the dashboard never count against live minutes**: they have their own monthly allowance. ## How transcription is metered When Sparkle transcribes audio, from the [browser SDK](/docs/guides/browser-audio) or the [audio streaming protocol](/docs/api/audio-streaming), it also meters **transcription minutes**: the seconds of audio its transcriber accepted, **summed across the conversation's streams**. A call streamed as a microphone and a meeting tab is two streams, so an hour of it is 120 transcription minutes, while the conversation meters 60 minutes. Turns you post, and turns from the Recall.ai and Deepgram receivers, meter no transcription minutes. Transcription minutes count per UTC month for the whole company, separately from conversation minutes: * **Live keys on Pro and Scale** pay $0.012 per stream-minute, billed per second; see [Billing](/docs/concepts/billing#audio-transcription). Enterprise's are by agreement. * **Live keys on Free** include 60 transcription minutes a month (`transcription_minutes`), and are never billed for them. * **Test keys and the dashboard's Playground** have a monthly test allowance (`test_transcription_minutes`): 60 on Free, 300 on Pro, 1,000 on Scale, unlimited on Enterprise. They are never billed. `GET /public/v1/plan` returns both allowances under `limits`, `-1` where there is no cap, and this month's use under `usage`. The per-stream length limit, minutes per audio stream above, is separate. ## At a limit A refusal is an [RFC 9457 error](/docs/api/errors) with a specific `code`, a `detail` that says it in words, and `message_params` carrying `plan`, `limit_key`, `limit` and `used`: ```json { "status": 403, "code": "limit.custom_moments", "detail": "The Free plan includes 3 custom moments, and this organization has 3.", "message_params": { "plan": "free", "limit_key": "custom_moments", "limit": 3, "used": 3 } } ``` Read `code` and `message_params` in your code; show `detail` to people. Responses also carry these headers: | Header | Value | | ----------------------- | ------------------------------------------------------ | | `X-Sparkle-Plan` | The company's plan, such as `free`. | | `X-Sparkle-Limit-Name` | The limit reached, such as `live_minutes`. | | `X-Sparkle-Limit` | The limit. | | `X-Sparkle-Limit-Used` | What the company, or organization, has used of it. | | `X-Sparkle-Limit-Reset` | For minutes, when they count from zero (Unix seconds). | | Status | Code | When | | ------ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | | `403` | `limit.minutes_exceeded` | A live key starts a conversation, or imports one, after Free's 1,000 live minutes this month. | | `403` | `limit.test_minutes_exceeded` | A test key or the dashboard starts one after the month's test minutes. | | `403` | `limit.transcription_minutes` | A live key mints or opens an audio session after Free's 60 transcription minutes this month. | | `403` | `limit.test_transcription_minutes` | A test key or the dashboard mints or opens an audio session after the month's test transcription minutes. | | `429` | `limit.concurrent_conversations` | A live key starts one while the plan's live conversations are all running. | | `403` | `limit.custom_moments` | The organization defines or enables one custom moment more than its plan allows. | | `403` | `limit.webhook_endpoints` | The organization subscribes one webhook endpoint more than its plan allows. | | `403` | `limit.api_keys` | The organization creates one active API key more than its plan allows. | | `403` | `limit.organizations` | The company creates one organization more than its plan allows. | | `403` | `limit.members` | The company invites one person more than its plan allows; pending invitations count. | | `403` | `limit.import_turns` | An import sends more turns than the plan imports at once. | | `403` | `plan.capability_required` | The plan doesn't include the feature, such as shadow mode on Free. `required_plan` names the first plan that does. | | `429` | `rate_limit.exceeded` | The key sent more requests this minute than its plan allows. | | `429` | `rate_limit.custom_moment_evaluations` | The organization started more than 10 custom moment evaluations this minute, on any plan. | A limit is checked when something starts, never midway: **a running call is never cut off**. A conversation that has metered a minute keeps taking turns past the month's minutes, and we record it. One that has not started yet is refused its first turns, with `limit.minutes_exceeded`, once the minutes are used up. Audio works the same way with transcription minutes. A session is checked when it is minted and when its socket opens. A socket that has not yet metered any audio is checked once more when it first meters, and closes with the code if the minutes ran out meanwhile. **A socket already streaming keeps streaming** past the month's transcription minutes, and its audio is still metered. Continuing after `audio.session_limit` or a dropped connection takes a new session, so it is refused once they are used up. A conversation counts as running while it is live and has started or metered a minute in the last 15 minutes, so a conversation your client forgot to end stops holding a slot. End conversations when calls finish all the same. Source: https://docs.sparkle.ai/docs/concepts/plans.md --- # Billing > How Pro and Scale are paid for, how minutes are counted and priced, and where invoices are. Free costs nothing and needs no card. **Pro** and **Scale** are paid by card, monthly in arrears, for the live time the company used that month and the audio Sparkle transcribed, **billed per second and quoted per minute**; Scale costs at least $500 a month. **Enterprise** is a contract: talk to us, and we invoice it directly. ## Upgrading An owner of the company chooses **Upgrade** on Pro or Scale in **Settings → Plan and billing → Plans**. The checkout is Stripe's: it takes a card and the billing details, and the plan changes a few seconds after it completes. Every billing period is a calendar month in UTC, the month the minutes count in, so the first invoice covers the rest of the month you upgraded in. Owners move between Pro and Scale from the same page. Before confirming, the page previews the change: each limit on both plans against this month's usage, the limits usage is already over on the new plan, and what Stripe charges at once. The switch takes effect at once. Usage is paid after it happens, so it is never prorated; Scale's monthly minimum is, for the part of the month on Scale, and that difference is invoiced at once: charged when moving to Scale, credited to the next invoice when leaving it. ## Enterprise Enterprise is not bought in the dashboard. An owner asks for it with **Contact sales** in **Settings → Plan and billing**, which tells Sparkle's team; nothing changes until we set the plan. Only Enterprise is requested: Pro and Scale are bought as above. When a company paying for Pro or Scale moves to Enterprise, Sparkle ends its subscription at once, so it is never billed twice. Stripe draws up a final invoice for the usage not yet invoiced, less a credit for the unused part of Scale's minimum; a credit larger than the usage stays on the account toward the Enterprise invoices. **Manage billing** opens Stripe's billing portal, where an owner updates the card and the billing details, downloads invoices, or cancels. Only owners can upgrade, manage billing or see invoices; every member sees the plan, this month's minutes and the estimate. ## Prices | Plan | Price | | ---------- | --------------------------------------------------------------------------------------------------------------------- | | Free | $0, up to 1,000 minutes a month | | Pro | First 1,000 minutes each month free, then $0.015 a minute | | Scale | $500 a month minimum. First 1,000 minutes free, then $0.012 up to 100,000, $0.009 up to 1,000,000, and $0.006 past it | | Enterprise | Committed volume, by agreement | Pro and Scale also charge for [audio transcription](#audio-transcription), $0.012 per stream-minute. Prices are quoted per minute and billed per second: a second costs a sixtieth of its tier's minute, so a 61-second call on Pro, past the free minutes, costs $0.01525. The tiers are graduated: each minute is priced by the tier it falls in, so on Scale a month of 200,000 minutes is 99,000 at $0.012 and 100,000 at $0.009, $2,088. Prices are in US dollars. Scale's minutes count toward its minimum: a month costs $500 or its minutes, whichever is more, so the minimum covers 42,666 minutes and 40 seconds, the free ones included. The invoice shows it as a $500 line charged at the start of each month and the minutes past what it covers at the end; the first month's $500 is prorated for the part of the month left after the upgrade. ## Audio transcription When Sparkle transcribes audio, from the [browser SDK](/docs/guides/browser-audio) or the [audio streaming protocol](/docs/api/audio-streaming), Pro and Scale also charge **$0.012 per stream-minute**, billed per second, at the same rate at every volume. It is its own invoice line, **Audio transcription**, on top of the plan's minutes, and it doesn't count toward Scale's minimum: a Scale month with less usage than the minimum costs $500 plus its transcription. Transcription minutes are the audio Sparkle's transcriber accepted, summed across a conversation's streams, as [Plans & limits](/docs/concepts/plans#how-transcription-is-metered) describes. An hour's call streamed as a microphone and a meeting tab is 60 minutes of conversation and 120 transcription minutes, so $1.44 of audio transcription. Turns you post yourself, or through a receiver, have none. Free has no paid audio: it includes 60 live transcription minutes a month and refuses new audio sessions past them. Enterprise's audio is by agreement. ## What is counted Only **live-key usage** is billed, metered as [Plans & limits](/docs/concepts/plans#how-minutes-are-metered) describes: each conversation meters the longest of its final turns' span, their words at 150 a minute and, for audio Sparkle transcribes, its longest stream, in whole seconds. **Test keys and the dashboard are never billed**, on any plan, for minutes or transcription. Usage on Free before an upgrade stays on Free. Sparkle reports the company's seconds and transcription seconds to Stripe every hour, and the last ones of a month reach that month's invoice. **Plan and billing** shows this month's usage and an **estimate** of the charge from it and the plan's prices; the invoice is the bill. ## Invoices Stripe draws up the invoice at the end of each month and charges the card on file. The invoices are listed under **Plan and billing → Invoices** and in the billing portal, each with Stripe's page and PDF. ## When a payment fails The company keeps its plan for **7 days** while Stripe retries the card, and the dashboard shows a banner asking an owner to update it. If the invoice is still unpaid after that, the company moves to Free and its limits apply, until a payment goes through and the plan comes back. ## Cancelling Cancelling in the billing portal takes effect at the end of the month. The plan stays until then, the month's usage is invoiced as usual, and the company moves to Free. Deleting the company, once its grace period ends, also cancels the subscription and deletes the company's billing details at Stripe. ## Local development A Sparkle API whose `APP_URL` is local (`localhost`, `127.0.0.1` or a `*.localhost` name) simulates billing unless `BILLING_PROVIDER=stripe` says otherwise. An owner moves to any plan, Enterprise included, up or down, at once: no Stripe page, no card and no charge. The plan, its audit trail and the owners' emails follow as they would with Stripe; the billing portal and invoices are not there, and Enterprise shows no estimate, having no price. Simulated billing refuses to start in production, and anywhere else whose `APP_URL` is not local. Source: https://docs.sparkle.ai/docs/concepts/billing.md --- # Custom moments > Define your own moment kind in plain English, test it on a transcript, then make it live. The [ten built-in kinds](/docs/concepts/moments) cover what most calls share. Every business also has moments nobody else names: a pricing objection on a sales call, a promise about returns a compliance team must review, a question an interviewer isn't allowed to ask. A custom moment is one of those, written in plain English. No prompt engineering and no model training: you describe it, measure it on a transcript, and turn it on. **@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](https://sparkle.ai/contact). Python and Go have no SDK yet: the cURL, Python and Go tabs call the HTTP API directly. ### Describe it A custom moment has a `name`, which becomes the `kind` of its moments, and four parts that decide when it fires: | Field | What it is | | ---------------- | -------------------------------------------------------------------------------------- | | `when` | When it fires, in plain English. Up to 1,000 characters. | | `not_when` | The near misses it should skip, though they look alike. Up to 1,000 characters. | | `examples` | Up to 10 lines it should `fire` on and 10 it should `skip`. | | `timing` | The [timing profile](/docs/concepts/timing): `act` (the default), `answer` or `ideas`. | | `min_confidence` | The probability a turn needs to fire it, above 0 and up to 1. Defaults to 0.5. | Two more fields decide how it's shown, not when it fires. Its moments carry both, so your own UI can render them the way the dashboard does: | Field | What it is | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | `label` | A display name, 1 to 60 characters. Defaults to the name in words: `pricing_objection` is "Pricing objection". | | `color` | One of `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink` or `gray`, the dashboard's label colors. Defaults to one picked from the name. | **cURL** ```bash curl https://api.sparkle.ai/public/v1/moments \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "name": "pricing_objection", "when": "The customer pushes back on price: says it costs too much or is over budget, asks for a discount, or compares us to a cheaper option.", "not_when": "Price is only mentioned, asked about or explained without resistance, including a clarifying question about price.", "examples": { "fire": ["That'\''s way over what we budgeted."], "skip": ["What does the Pro plan cost?"] }, "timing": "act", "min_confidence": 0.6 }' ``` **TypeScript** ```ts const moment = await sparkle.moments.create({ name: "pricing_objection", when: "The customer pushes back on price: says it costs too much or is over budget, asks for a discount, or compares us to a cheaper option.", not_when: "Price is only mentioned, asked about or explained without resistance, including a clarifying question about price.", examples: { fire: ["That's way over what we budgeted."], skip: ["What does the Pro plan cost?"], }, timing: "act", min_confidence: 0.6, }); ``` **Python** ```python moment = requests.post( "https://api.sparkle.ai/public/v1/moments", headers={ "X-API-Key": os.environ["SPARKLE_API_KEY"], "Idempotency-Key": str(uuid.uuid4()), }, json={ "name": "pricing_objection", "when": "The customer pushes back on price: says it costs too much or is over " "budget, asks for a discount, or compares us to a cheaper option.", "not_when": "Price is only mentioned, asked about or explained without " "resistance, including a clarifying question about price.", "examples": { "fire": ["That's way over what we budgeted."], "skip": ["What does the Pro plan cost?"], }, "timing": "act", "min_confidence": 0.6, }, ).json() ``` **Go** ```go body := strings.NewReader(`{ "name": "pricing_objection", "when": "The customer pushes back on price: says it costs too much or is over budget, asks for a discount, or compares us to a cheaper option.", "not_when": "Price is only mentioned, asked about or explained without resistance, including a clarifying question about price.", "examples": { "fire": ["That's way over what we budgeted."], "skip": ["What does the Pro plan cost?"] }, "timing": "act", "min_confidence": 0.6 }`) req, _ := http.NewRequest("POST", "https://api.sparkle.ai/public/v1/moments", body) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Idempotency-Key", rand.Text()) req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) ``` It starts as a draft at version 1. A draft runs on no conversation until you make it live: ```json { "id": "mdef_2kd8a4c7f1h5k9n3q6sb", "name": "pricing_objection", "label": "Pricing objection", "color": "violet", "when": "The customer pushes back on price: says it costs too much or is over budget, asks for a discount, or compares us to a cheaper option.", "not_when": "Price is only mentioned, asked about or explained without resistance, including a clarifying question about price.", "examples": { "fire": ["That's way over what we budgeted."], "skip": ["What does the Pro plan cost?"] }, "timing": "act", "min_confidence": 0.6, "version": 1, "status": "draft", "live_version": null, "shadow_version": null, "created_at": "2026-12-03T16:10:00Z", "updated_at": "2026-12-03T16:10:00Z" } ``` `name` is snake\_case, up to 40 characters, unique in your organization and not a built-in kind. It can't change later. ### Test it on a transcript Evaluate the moment on a transcript before it touches a live call. Send up to 1,000 turns, or the `conversation_id` of one you already have, and in `expected` the IDs of the turns it should fire on: ```json title="evaluate.json" { "turns": [ { "id": "c1", "final": true, "speaker": "tom", "name": "Tom", "channel": "mic", "start": 3.0, "end": 7.0, "text": "Of course. The Team plan is twelve dollars per seat per month." }, { "id": "c2", "final": true, "speaker": "priya", "name": "Priya", "channel": "remote", "start": 7.5, "end": 9.0, "text": "Is that price per seat or per team?" }, { "id": "c3", "final": true, "speaker": "tom", "name": "Tom", "channel": "mic", "start": 9.5, "end": 11.0, "text": "Per seat, billed annually." }, { "id": "c4", "final": true, "speaker": "priya", "name": "Priya", "channel": "remote", "start": 24.0, "end": 28.0, "text": "Honestly, that's way over what we budgeted for this quarter." }, { "id": "c5", "final": true, "speaker": "tom", "name": "Tom", "channel": "mic", "start": 28.5, "end": 30.0, "text": "I hear you." }, { "id": "c6", "final": true, "speaker": "priya", "name": "Priya", "channel": "remote", "start": 44.0, "end": 47.5, "text": "Northwind quoted us about half that." }, { "id": "c7", "final": true, "speaker": "tom", "name": "Tom", "channel": "mic", "start": 48.0, "end": 51.0, "text": "We could look at a two-year term." }, { "id": "c8", "final": true, "speaker": "priya", "name": "Priya", "channel": "remote", "start": 66.0, "end": 70.0, "text": "We'd need it closer to eight dollars a seat to make this work." } ], "expected": ["c4", "c6", "c8"] } ``` **cURL** ```bash curl https://api.sparkle.ai/public/v1/moments/mdef_2kd8a4c7f1h5k9n3q6sb/evaluate \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d @evaluate.json ``` **TypeScript** ```ts import { readFile } from "node:fs/promises"; const result = await sparkle.moments.evaluate( moment.id, JSON.parse(await readFile("evaluate.json", "utf8")) ); console.log(`${result.hits}/${result.expected} caught, ${result.false_fires} false`); ``` **Python** ```python with open("evaluate.json") as f: result = requests.post( f"https://api.sparkle.ai/public/v1/moments/{moment['id']}/evaluate", headers={ "X-API-Key": os.environ["SPARKLE_API_KEY"], "Idempotency-Key": str(uuid.uuid4()), }, json=json.load(f), ).json() print(f"{result['hits']}/{result['expected']} caught, {result['false_fires']} false") ``` **Go** ```go body, _ := os.ReadFile("evaluate.json") url := "https://api.sparkle.ai/public/v1/moments/mdef_2kd8a4c7f1h5k9n3q6sb/evaluate" req, _ := http.NewRequest("POST", url, bytes.NewReader(body)) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Idempotency-Key", rand.Text()) req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) ``` The evaluation runs the moment as it would run live, timing included, and reports where it fired and how that compares with your labels: ```json { "hits": 2, "expected": 3, "false_fires": 1, "precision": 0.67, "misses": [ { "turn": "c8", "text": "We'd need it closer to eight dollars a seat to make this work." } ], "false": [{ "turn": "c2", "text": "Is that price per seat or per team?" }], "fires": [ { "turn": "c2", "at": 9.0, "text": "Is that price per seat or per team?", "confidence": 0.63 }, { "turn": "c4", "at": 28.0, "text": "Honestly, that's way over what we budgeted for this quarter.", "confidence": 0.94 }, { "turn": "c6", "at": 47.5, "text": "Northwind quoted us about half that.", "confidence": 0.81 } ], "threshold": 0.6, "near_misses": [ { "turn_id": "c8", "score": 0.52, "threshold": 0.6, "reason": "below_threshold" }, { "turn_id": "c7", "score": 0.31, "threshold": 0.6, "reason": "below_threshold" } ], "suggestion": "Add a clarifying question about how the price is counted, like \"is that per seat?\", to not_when, and name a counter-offer below the quoted price in when.", "stats": { "turns": 8, "fires": 3, "ms": 4210 } } ``` `precision` is the share of fires that were on a labelled turn. `suggestion` is a change to the wording that would fix the most common mistake. Without `expected`, the label fields are `null`; `fires`, `near_misses` and `stats` are always there. An evaluation reads up to 1,000 turns and can take 30 seconds or more; it gives up after 90. Give your HTTP client a timeout above that, about 100 seconds, and don't retry a timeout: the first run may still be going, so a retry with the same `Idempotency-Key` gets a 409. The TypeScript SDK's `evaluate` waits 100 seconds per attempt and never retries a timeout; pass `{ timeoutMs }` as its last argument to change the wait. `threshold` is the score a turn needed: the evaluated version's `min_confidence`. `near_misses` are the turns it came closest to firing on without firing, at most 3, highest `score` first. Each one's `reason` says why it didn't fire: | `reason` | Meaning | | ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | | `below_threshold` | The score fell short of `threshold`. Add the line as a `fire` example, or loosen `when`. | | `settled_away` | It cleared `threshold` as the pick, but timing let it go unfired: a later turn of the same exchange fired, or a cooldown held it. | | absent | It cleared `threshold`, but another option was the classifier's pick for that turn. | Here the missed counter-offer (`c8`) scored 0.52 against 0.6: a `fire` example like it would catch it. To try wording before saving it, `POST /moments/evaluate` (`sparkle.moments.evaluate(params)` in the SDK) takes the whole definition in `definition` beside the same `turns` and `expected`. ### Revise it Send only the fields to change to `PUT /moments/{id}`. Until the moment first goes live, an edit changes the draft in place, and it stays version 1: ```json { "not_when": "Price is only mentioned, asked about or explained without resistance, including a clarifying question about how the price is counted (\"is that per seat?\").", "when": "The customer pushes back on price: says it costs too much or is over budget, asks for a discount, compares us to a cheaper option, or names a price they would accept below ours." } ``` Evaluate again on the same transcript, and repeat until the misses and false fires are ones you can live with. Once the moment is live, edits work differently: see the last step. `label` and `color` are the exception: they never make a version, before or after it goes live. A change reaches live conversations within about 5 seconds, and moments already detected keep the label and color they were sent with. ### Make it live Set `status` to `live`: **cURL** ```bash curl -X PUT https://api.sparkle.ai/public/v1/moments/mdef_2kd8a4c7f1h5k9n3q6sb \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"status": "live"}' ``` **TypeScript** ```ts await sparkle.moments.update(moment.id, { status: "live" }); ``` **Python** ```python requests.put( f"https://api.sparkle.ai/public/v1/moments/{moment['id']}", headers={ "X-API-Key": os.environ["SPARKLE_API_KEY"], "Idempotency-Key": str(uuid.uuid4()), }, json={"status": "live"}, ).raise_for_status() ``` **Go** ```go url := "https://api.sparkle.ai/public/v1/moments/mdef_2kd8a4c7f1h5k9n3q6sb" req, _ := http.NewRequest("PUT", url, strings.NewReader(`{"status": "live"}`)) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Idempotency-Key", rand.Text()) req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) ``` Within about 5 seconds, live conversations start running it: every conversation created without `moment_types`, and every one whose `moment_types` names it. Version 1 is now its `live_version`. Its moments arrive like any other, with its name as the `kind`, and in `definition` the version that fired with the label and color it had then: ```json { "id": "mom_2kd8b7e1h5l9p3t7x0ac", "object": "moment", "conversation_id": "cnv_2kd8b0a4d8g2j6m0q3tf", "kind": "pricing_objection", "title": "Priya · Over budget for this quarter", "text": "Honestly, that's way over what we budgeted for this quarter.", "speaker": { "key": "priya", "name": "Priya" }, "at": 812.4, "confidence": 0.94, "turn_ids": ["u_204"], "settled_ms": 5000, "classifier": "typesafe:…", "definition": { "id": "mdef_2kd8a4c7f1h5k9n3q6sb", "version": 1, "label": "Pricing objection", "color": "violet" }, "created_at": "2026-12-04T10:13:41.902113Z" } ``` Custom moments are read in the same call as the built-in kinds, as a second pick: a turn can be a `decision` and a `pricing_objection` at once, and adding custom moments never takes a turn away from a built-in kind. To stop it, set `status` to `disabled`. Like going live, it reaches live conversations within about 5 seconds. Setting it back to `live` resumes its `live_version`, not a newer draft. A custom moment never goes back to draft, and deleting it keeps its name on the moments it already detected. ### Shadow, then promote Once a moment has a `live_version`, an edit no longer changes what live conversations run. `PUT /moments/{id}` writes the next version as a draft, and `live_version` keeps running until you promote the draft. Before you do, run it in shadow: beside the live version, on the same live calls, with its fires stored for comparison and never sent to your streams or webhooks. You can evaluate it on a transcript first, too: pass its `version` to `POST /moments/{id}/evaluate`. Say your edit wrote version 2. Start its shadow: **cURL** ```bash curl -X POST https://api.sparkle.ai/public/v1/moments/mdef_2kd8a4c7f1h5k9n3q6sb/versions/2/shadow \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" ``` **TypeScript** ```ts await sparkle.moments.versions.shadow(moment.id, 2); ``` **Python** ```python requests.post( f"https://api.sparkle.ai/public/v1/moments/{moment['id']}/versions/2/shadow", headers={ "X-API-Key": os.environ["SPARKLE_API_KEY"], "Idempotency-Key": str(uuid.uuid4()), }, ).raise_for_status() ``` **Go** ```go url := "https://api.sparkle.ai/public/v1/moments/mdef_2kd8a4c7f1h5k9n3q6sb/versions/2/shadow" req, _ := http.NewRequest("POST", url, nil) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Idempotency-Key", rand.Text()) resp, err := http.DefaultClient.Do(req) ``` After some calls, `GET /moments/{id}/versions` (`sparkle.moments.versions.list(id)`) lists every version with the moments it detected, and compares the shadow with the live version on the same conversations: ```json { "versions": [ { "version": 2, "status": "shadow", "fires": 41, "…": "…" }, { "version": 1, "status": "live", "fires": 44, "…": "…" } ], "comparison": { "live_version": 1, "shadow_version": 2, "since": "2026-12-04T09:00:00Z", "both": [ { "conversation_id": "cnv_2kd8b0a4d8g2j6m0q3tf", "turn_ids": ["u_204"], "at": 812.4, "text": "Honestly, that's way over what we budgeted for this quarter." } ], "only_live": [ { "conversation_id": "cnv_2kd8c5h9m3q7u1y5b8ej", "turn_ids": ["u_77"], "at": 301.2, "text": "Is the onboarding fee included in that price?" } ], "only_shadow": [ { "conversation_id": "cnv_2kd8d2j6n0r4v8z2c5fk", "turn_ids": ["u_19"], "at": 95.8, "text": "We'd sign today if you could meet us at nine a seat." } ] } } ``` Read `only_live` and `only_shadow`: those are the calls where the two versions disagree. Here the new wording drops a clarifying question and catches a counter-offer. When it wins, promote it with `POST /moments/{id}/versions/2/promote` (`sparkle.moments.versions.promote(id, 2)`). Live conversations switch to version 2 in one step, version 1 is archived, and the shadow ends. You can also promote a draft directly, without a shadow. If the shadow loses, stop it instead. The version goes back to draft, the shadow moments it already stored are kept, and live conversations stop running it within about 5 seconds: **cURL** ```bash curl -X DELETE https://api.sparkle.ai/public/v1/moments/mdef_2kd8a4c7f1h5k9n3q6sb/versions/2/shadow \ -H "X-API-Key: $SPARKLE_API_KEY" ``` **TypeScript** ```ts await sparkle.moments.versions.stopShadow(moment.id, 2); ``` **Python** ```python requests.delete( f"https://api.sparkle.ai/public/v1/moments/{moment['id']}/versions/2/shadow", headers={"X-API-Key": os.environ["SPARKLE_API_KEY"]}, ).raise_for_status() ``` **Go** ```go url := "https://api.sparkle.ai/public/v1/moments/mdef_2kd8a4c7f1h5k9n3q6sb/versions/2/shadow" req, _ := http.NewRequest("DELETE", url, nil) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) resp, err := http.DefaultClient.Do(req) ``` It answers `204`, also when the version isn't in shadow, so stopping twice is safe. A version the moment doesn't have is a [`404`](/docs/api/errors/not-found). ## List where a moment fired `GET /moments/{id}/fires` lists the moments a custom moment detected across your conversations, newest first and cursor-paged, from `since` on (a week ago when absent). It lists the moments it sent; add `include_shadow=true` for those a version in shadow detected too, marked `shadow`, and `version` to keep one version's: **cURL** ```bash curl "https://api.sparkle.ai/public/v1/moments/mdef_2kd8a4c7f1h5k9n3q6sb/fires?since=2026-12-01T00:00:00Z" \ -H "X-API-Key: $SPARKLE_API_KEY" ``` **TypeScript** ```ts for await (const fire of sparkle.moments.fires.list(moment.id, { since: "2026-12-01T00:00:00Z" })) { console.log(fire.conversation_title, fire.text); } ``` **Python** ```python page = requests.get( f"https://api.sparkle.ai/public/v1/moments/{moment['id']}/fires", headers={"X-API-Key": os.environ["SPARKLE_API_KEY"]}, params={"since": "2026-12-01T00:00:00Z"}, ).json() for fire in page["items"]: print(fire["conversation_title"], fire["text"]) ``` **Go** ```go url := "https://api.sparkle.ai/public/v1/moments/mdef_2kd8a4c7f1h5k9n3q6sb/fires?since=2026-12-01T00:00:00Z" req, _ := http.NewRequest("GET", url, nil) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) resp, err := http.DefaultClient.Do(req) ``` Each item names the moment and its conversation, with what it read and where: ```json { "moment_id": "mom_2kd8b7e1h5l9p3t7x0ac", "conversation_id": "cnv_2kd8b0a4d8g2j6m0q3tf", "conversation_title": "Northwind renewal", "turn_ids": ["u_204"], "text": "Honestly, that's way over what we budgeted for this quarter.", "title": "Priya · Over budget for this quarter", "speaker": { "key": "priya", "name": "Priya" }, "at": 812.4, "confidence": 0.94, "version": 1, "shadow": false, "created_at": "2026-12-04T10:13:41.902113Z" } ``` Without `include_shadow`, a version's moments in the window number its `fires` less its `shadow_fires` in `GET /moments/{id}/versions`. Reading fires needs only view access to conversations, so a `viewer` key can list them. ## Limits * `name` is fixed once created; `label` and `color` can change at any time. * At most 25 custom moments can be live in an organization at a time. * An evaluation reads at most 1,000 final turns, enough for an hour-long call, and `expected` is a list of your own turn IDs. It gives up after 90 seconds, and answers [`502`](/docs/api/errors/bad-gateway) with `bad_gateway.classifier` when the classifier fails; try again. * An organization starts at most 10 evaluations a minute, from the dashboard and the API together. The 11th answers [`429`](/docs/api/errors/rate-limit) with `rate_limit.custom_moment_evaluations`; wait the seconds in `Retry-After`. Every attempt counts, a refused one included. * An API key limited to scopes needs `custom_moment:*` for these calls. ## Writing good definitions The wording is the tuning surface. A few habits make the difference: * **Say who says what.** "The customer pushes back on price" is sharper than "price objection": it rules out the rep explaining a discount. * **Quote the phrasing.** Short quoted lines in `when` ("that's over our budget", "can you do better?") show the classifier the range you mean. * **Spend `not_when` on the near misses.** Name what looks like the moment but isn't: a clarifying question, a hypothetical, the same words from the other side. When an evaluation shows a false fire, the fix usually goes here. * **Make examples disagree with each other.** A `skip` line that is one word away from a `fire` line teaches more than an unrelated one. * **Invent your examples.** Write them in the style of your calls, but don't paste real customers' words into a definition. * **Choose timing by what you'll do with it.** `act` when you want the settled outcome of an exchange, `answer` when you need to react while the question still hangs, `ideas` when one moment per brainstorm is enough. * **Raise `min_confidence` to trade recall for precision.** Start at 0.5 to 0.6, evaluate, and raise it when false fires cost you more than misses. ## Templates Seven ready-made custom moments are written and tested the same way. `GET /moments/templates` lists them, each with your organization's own custom moment of that name once you have one. | Template | Fires when | Timing | | ------------------------ | ------------------------------------------------------------------------------------------- | ------ | | `competitor_mentioned` | Someone names a competing product or vendor, or an alternative the customer uses instead. | answer | | `pricing_objection` | The customer pushes back on price, asks for a discount or compares a cheaper option. | act | | `pricing_discussed` | The conversation turns to what you charge, without pushback. | act | | `commitment_with_date` | Someone commits to doing something by a specific day, date or time. | act | | `risk_or_blocker` | Someone names something that could stop or delay the work, the deal or the plan. | act | | `next_meeting_scheduled` | The people talking agree on when they'll meet next. | act | | `frustration_expressed` | A speaker shows frustration or disappointment with the product, the service or the process. | answer | Enable one, and it becomes your organization's own custom moment, live at once, with the template's `label` and `color`. You can evaluate, revise, relabel and disable it like one you wrote: **cURL** ```bash curl -X POST https://api.sparkle.ai/public/v1/moments/templates/commitment_with_date/enable \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" ``` **TypeScript** ```ts const moment = await sparkle.moments.templates.enable("commitment_with_date"); ``` **Python** ```python moment = requests.post( "https://api.sparkle.ai/public/v1/moments/templates/commitment_with_date/enable", headers={ "X-API-Key": os.environ["SPARKLE_API_KEY"], "Idempotency-Key": str(uuid.uuid4()), }, ).json() ``` **Go** ```go url := "https://api.sparkle.ai/public/v1/moments/templates/commitment_with_date/enable" req, _ := http.NewRequest("POST", url, nil) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Idempotency-Key", rand.Text()) resp, err := http.DefaultClient.Do(req) ``` Enabling a template you already have a custom moment of returns `409`. Source: https://docs.sparkle.ai/docs/guides/custom-moments.md --- # Import a finished transcript > Run a recorded call's transcript through the same detection as a live one. Not every conversation reaches you live. A Zoom cloud recording, a notetaker's export or last quarter's calls arrive as a finished transcript. Import one, and Sparkle reads it the way it would have read the call live: same moment kinds, same timing, the same events on the stream and the webhooks. **@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](https://sparkle.ai/contact). Python and Go have no SDK yet: the cURL, Python and Go tabs call the HTTP API directly. ## 1. Convert the transcript to turns An import takes the same turns as a [live conversation](/docs/concepts/turns), with times in seconds from the start of the recording. Most formats map onto them in a few lines. A Zoom transcript is a WebVTT file in which each cue is one speaker's line: ```text title="acme-renewal.vtt" WEBVTT 1 00:00:00.800 --> 00:00:04.100 Sam Lee: Okay, let's go with the two-year term at the current tier. 2 00:00:05.000 --> 00:00:07.300 Dana Ortiz: Great, that works for us. 3 00:00:21.000 --> 00:00:23.400 Dana Ortiz: And I'll get the SSO fix out by Friday. ``` Each cue becomes one final turn. The name before the colon is the speaker's `name`, and a key made from it is the `speaker`. A cloud recording has no local microphone, so every turn is `remote`: **TypeScript** ```ts title="vtt-to-turns.ts" interface Turn { id: string; final: true; speaker: string; name: string; channel: "remote"; start: number; end: number; text: string; } // "00:01:02.500" or "01:02.500" to seconds. function seconds(stamp: string): number { return stamp.split(":").reduce((total, part) => total * 60 + Number(part), 0); } export function vttToTurns(vtt: string): Turn[] { const turns: Turn[] = []; for (const cue of vtt.split(/\r?\n\r?\n/)) { const lines = cue.trim().split(/\r?\n/); const at = lines.findIndex((line) => line.includes("-->")); if (at === -1) continue; const [start, end] = lines[at].split("-->").map((stamp) => seconds(stamp.trim().split(" ")[0])); const said = lines.slice(at + 1).join(" "); const colon = said.indexOf(": "); const name = colon > 0 ? said.slice(0, colon) : "Unknown speaker"; turns.push({ id: `cue_${turns.length + 1}`, final: true, speaker: name.toLowerCase().replace(/[^a-z0-9]+/g, "_"), name, channel: "remote", start, end, text: colon > 0 ? said.slice(colon + 2) : said, }); } return turns; } ``` **Python** ```python title="vtt_to_turns.py" import re def seconds(stamp: str) -> float: """'00:01:02.500' or '01:02.500' to seconds.""" total = 0.0 for part in stamp.split(":"): total = total * 60 + float(part) return total def vtt_to_turns(vtt: str) -> list[dict]: turns = [] for cue in re.split(r"\r?\n\r?\n", vtt): lines = cue.strip().splitlines() at = next((i for i, line in enumerate(lines) if "-->" in line), None) if at is None: continue start, end = (seconds(s.strip().split(" ")[0]) for s in lines[at].split("-->")) said = " ".join(lines[at + 1 :]) name, sep, text = said.partition(": ") if not sep: name, text = "Unknown speaker", said turns.append( { "id": f"cue_{len(turns) + 1}", "final": True, "speaker": re.sub(r"[^a-z0-9]+", "_", name.lower()), "name": name, "channel": "remote", "start": start, "end": end, "text": text, } ) return turns ``` The three cues above become: ```json [ { "id": "cue_1", "final": true, "speaker": "sam_lee", "name": "Sam Lee", "channel": "remote", "start": 0.8, "end": 4.1, "text": "Okay, let's go with the two-year term at the current tier." }, { "id": "cue_2", "final": true, "speaker": "dana_ortiz", "name": "Dana Ortiz", "channel": "remote", "start": 5.0, "end": 7.3, "text": "Great, that works for us." }, { "id": "cue_3", "final": true, "speaker": "dana_ortiz", "name": "Dana Ortiz", "channel": "remote", "start": 21.0, "end": 23.4, "text": "And I'll get the SSO fix out by Friday." } ] ``` ## 2. Import it Send the turns, up to 5,000 in any order, to `POST /conversations/import`. The other fields are the ones a live conversation takes: `title`, `metadata`, `moment_types` and `webhook_url`. **cURL** ```bash curl https://api.sparkle.ai/public/v1/conversations/import \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d @import.json ``` `import.json` holds the turns and the other fields: ```json title="import.json" { "title": "Acme renewal call (recording)", "webhook_url": "https://example.com/hooks/sparkle", "turns": [ { "id": "cue_1", "final": true, "speaker": "sam_lee", "name": "Sam Lee", "channel": "remote", "start": 0.8, "end": 4.1, "text": "Okay, let's go with the two-year term at the current tier." } ] } ``` **TypeScript** ```ts import { readFile } from "node:fs/promises"; import { vttToTurns } from "./vtt-to-turns"; const { conversation, webhook } = await sparkle.conversations.import({ title: "Acme renewal call (recording)", webhook_url: "https://example.com/hooks/sparkle", turns: vttToTurns(await readFile("acme-renewal.vtt", "utf8")), }); ``` **Python** ```python import os import uuid import requests from vtt_to_turns import vtt_to_turns with open("acme-renewal.vtt") as f: turns = vtt_to_turns(f.read()) imported = requests.post( "https://api.sparkle.ai/public/v1/conversations/import", headers={ "X-API-Key": os.environ["SPARKLE_API_KEY"], "Idempotency-Key": str(uuid.uuid4()), }, json={ "title": "Acme renewal call (recording)", "webhook_url": "https://example.com/hooks/sparkle", "turns": turns, }, ).json() conversation_id = imported["conversation"]["id"] ``` **Go** ```go // turns is a []Turn (the quickstart's Go tab defines Turn), converted from the transcript. payload, _ := json.Marshal(map[string]any{ "title": "Acme renewal call (recording)", "webhook_url": "https://example.com/hooks/sparkle", "turns": turns, }) url := "https://api.sparkle.ai/public/v1/conversations/import" req, _ := http.NewRequest("POST", url, bytes.NewReader(payload)) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Idempotency-Key", rand.Text()) req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) ``` Sparkle answers `202 Accepted` at once, with the conversation `processing`: ```json { "conversation": { "id": "cnv_2kd9c3f6j0m4q8u2y5bg", "tenant_id": "ten_2kd5m0c8w3e7h1p4s9fa", "organization_id": "org_2kd5m0d2y6b0k4n8r1gc", "environment": "test", "status": "processing", "title": "Acme renewal call (recording)", "metadata": {}, "moment_types": [], "moments_count": 0, "progress": { "turns_done": 0, "turns_total": 3 }, "started_at": "2026-12-03T17:00:00Z", "webhook": { "id": "whs_2kd9c3g8l2p6t0x4a7dh", "url": "https://example.com/hooks/sparkle" }, "created_at": "2026-12-03T17:00:00Z", "updated_at": "2026-12-03T17:00:00Z" }, "webhook": { "id": "whs_2kd9c3g8l2p6t0x4a7dh", "url": "https://example.com/hooks/sparkle", "secret": "whsec_4b9e2d7a1c6f0e5b8a3d2c1f0e9b8a7d6c5f4e3d" } } ``` As with a live conversation, `webhook.secret` is shown only in this response. ## 3. Receive the moments Sparkle reads the transcript on its own clock: the quiet windows and cooldowns of each [timing profile](/docs/concepts/timing) are measured in recording time, so you get the moments a live run of the same call would have produced. They arrive as they're let go, on the conversation's [stream](/docs/concepts/delivery#the-stream) and as `moment.detected` webhooks, exactly as they would live. Follow progress with `GET /conversations/{id}`: **cURL** ```bash curl https://api.sparkle.ai/public/v1/conversations/$CONVERSATION_ID \ -H "X-API-Key: $SPARKLE_API_KEY" ``` **TypeScript** ```ts const { status, progress } = await sparkle.conversations.get(conversation.id); ``` **Python** ```python conversation = requests.get( f"https://api.sparkle.ai/public/v1/conversations/{conversation_id}", headers={"X-API-Key": os.environ["SPARKLE_API_KEY"]}, ).json() print(conversation["status"], conversation.get("progress")) ``` **Go** ```go url := "https://api.sparkle.ai/public/v1/conversations/" + conversationID req, _ := http.NewRequest("GET", url, nil) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) resp, err := http.DefaultClient.Do(req) ``` `progress.turns_done` counts the turns read so far. When the last one is read and its moments are out, the conversation's `status` becomes `ended` by itself and `conversation.ended` is sent, last, with the summary. While a conversation is `processing`: * Posting turns to it is refused with [`409`](/docs/api/errors/conflict): an import is the whole transcript. * `POST /conversations/{id}/end` does nothing. It ends on its own. * Only final turns are read. Source: https://docs.sparkle.ai/docs/guides/import.md --- # Capture audio in the browser > Stream a microphone and a meeting tab from a web page, and get turns and moments back. Sparkle can transcribe audio for you. A web page streams the microphone, and optionally a meeting running in another browser tab, and Sparkle turns what it hears into turns on the conversation. The moments arrive the same way as from any other source. ## When to use it | You have | Use | | ------------------------------------------------------------ | --------------------------------------------------------------------------- | | A web app people talk into, or a meeting open in another tab | Browser audio: this guide. | | Your own speech-to-text | [Post turns](/docs/concepts/turns): you send the text, not the audio. | | A bot that joins Zoom, Meet or Teams | The [Recall.ai receiver](/docs/receivers/recall). | | Audio on a server, a phone bridge or a mobile app | The [audio streaming protocol](/docs/api/audio-streaming), without the SDK. | **Audio is never stored** No audio is stored, on disk, in Redis or in logs; only the turns transcribed from it are kept. There is no recording to download or delete later. ## How it works 1. Your page calls `recordAudio` from `@sparkle/sdk/browser`. 2. For each source, the SDK asks your backend for an audio session. 3. Your backend calls `POST /conversations/{id}/audio-sessions` with its API key and returns the session's `url`. 4. The page streams audio to that URL. Interim text and finished turns come back on the same connection, and moments arrive on the conversation's stream and webhooks. The API key never reaches the browser. The page only ever holds a session URL, whose token works once, within 60 seconds. **@sparkle/sdk is in private beta** The browser code and the TypeScript tab use `@sparkle/sdk`, which isn't on npm yet. To try it, [ask us for access](https://sparkle.ai/contact). The cURL, Python and Go tabs call the HTTP API directly. ## 1. Mint sessions on your backend Add a route that the page can call. It should check that the signed-in user may use the conversation, then mint a session and return its `url`. The SDK posts this body to it: | Field | Value | | ---------------- | ---------------------------------------------------------------------- | | `conversationId` | The conversation passed to `recordAudio`. | | `source` | `local` for the microphone, `remote` for the shared tab. | | `encoding` | `linear16`. | | `sample_rate` | `16000`, `24000`, `44100` or `48000`: the rate the browser records at. | | `language` | Only when you passed `language` to `recordAudio`, such as `en`. | Forward everything but `conversationId` as the body of the API call. Each call mints a new session, so send a fresh `Idempotency-Key` every time: **cURL** ```bash curl https://api.sparkle.ai/public/v1/conversations/$CONVERSATION_ID/audio-sessions \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"source": "local", "encoding": "linear16", "sample_rate": 48000}' ``` **TypeScript** ```ts title="audio-session.ts" import { Sparkle, SparkleError } from "@sparkle/sdk"; import { Hono } from "hono"; const sparkle = new Sparkle(); // reads SPARKLE_API_KEY const app = new Hono(); app.post("/api/sparkle/audio-session", async (c) => { const { conversationId, ...params } = await c.req.json(); // Check here that the signed-in user may stream to conversationId. try { // Sends a fresh Idempotency-Key, the same one on its own retries. const { url } = await sparkle.conversations.audio.createSession(conversationId, params); return c.json({ url }); } catch (error) { // Pass a refusal on with its status and code: the SDK in the page reads them to decide on a retry. if (error instanceof SparkleError && error.status > 0) { return Response.json( { status: error.status, code: error.code, detail: error.detail }, { status: error.status } ); } throw error; } }); ``` **Python** ```python title="audio_session.py" import os import uuid import requests from flask import Flask, request app = Flask(__name__) @app.post("/api/sparkle/audio-session") def audio_session(): body = request.get_json() conversation_id = body.pop("conversationId") # Check here that the signed-in user may stream to conversation_id. minted = requests.post( f"https://api.sparkle.ai/public/v1/conversations/{conversation_id}/audio-sessions", headers={ "X-API-Key": os.environ["SPARKLE_API_KEY"], "Idempotency-Key": str(uuid.uuid4()), }, json=body, ) return minted.content, minted.status_code, {"Content-Type": "application/json"} ``` **Go** ```go http.HandleFunc("POST /api/sparkle/audio-session", func(w http.ResponseWriter, r *http.Request) { var body map[string]any if err := json.NewDecoder(r.Body).Decode(&body); err != nil { http.Error(w, "invalid body", http.StatusBadRequest) return } conversationID, _ := body["conversationId"].(string) delete(body, "conversationId") // Check here that the signed-in user may stream to conversationID. payload, _ := json.Marshal(body) endpoint := "https://api.sparkle.ai/public/v1/conversations/" + url.PathEscape(conversationID) + "/audio-sessions" req, _ := http.NewRequestWithContext(r.Context(), "POST", endpoint, bytes.NewReader(payload)) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Idempotency-Key", rand.Text()) req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { http.Error(w, "Sparkle unreachable", http.StatusBadGateway) return } defer resp.Body.Close() w.Header().Set("Content-Type", "application/json") w.WriteHeader(resp.StatusCode) io.Copy(w, resp.Body) }) ``` Sparkle answers `201 Created`: ```json { "url": "wss://api.sparkle.ai/public/v1/conversations/cnv_2kd9c3f6j0m4q8u2y5bg/audio?token=…", "token": "…", "expires_at": "2026-12-03T17:01:00Z" } ``` ## 2. Record in the browser Call `recordAudio` from a click handler: browsers only let a page ask to share a tab in response to one. ```ts import { recordAudio, SparkleAudioError } from "@sparkle/sdk/browser"; const getSession = (request) => fetch("/api/sparkle/audio-session", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(request), }).then(async (response) => { const body = await response.json(); if (!response.ok) throw body; // the API's problem: its status and code tell the SDK what to do return body; }); startButton.addEventListener("click", async () => { try { const recording = await recordAudio(conversationId, { getSession, sources: { mic: true, tab: includeMeetingTab }, onInterim: (text, source) => showInterim(source, text), onTurn: (turn) => showTurn(turn.speaker.key, turn.text), onError: (error) => console.warn(error.code, error.message), onState: (state) => showState(state), // connecting, live, reconnecting, stopped }); stopButton.onclick = () => recording.stop(); } catch (error) { // No microphone, permission refused, or a shared tab without audio. if (error instanceof SparkleAudioError) showError(error.code); } }); ``` | Option | What it does | | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `getSession` | Required. Mints a session on your backend and resolves with `{ url }`. Called once per source, and again for every reconnect. | | `sources` | `mic` streams as `local`, `tab` as `remote`. `true` asks the browser for it; pass a `MediaStream` of your own to use it as it is. The microphone alone when absent. | | `language` | Passed through to `getSession`. | | `onInterim` | What a source is hearing before the turn is final. Each call replaces the last for that source. | | `onTurn` | A finished turn. Sparkle has already stored it: don't post it again as a turn of your own. | | `onError` | A source that stopped on an error. The other source keeps streaming. | | `onState` | The capture's state: `connecting`, `live`, `reconnecting` or `stopped`. | The recording it resolves with has `pause()`, `resume()` and `stop()`: * `pause()` stops sending audio. The connections stay open on keepalives, so `resume()` is instant. * `stop()` asks Sparkle to transcribe what it has already received, waits up to five seconds for the last turns, then closes the connections and releases the microphone and the tab. * A source stays `connecting` until Sparkle is ready, which can take up to 10 seconds. * If the connection drops, or Sparkle restarts, the SDK reconnects with a new session from `getSession`, backing off up to 8 seconds between attempts. Audio from while it was down is dropped, not queued. * A connection that dropped holds its source for up to 30 seconds, so a new session for it can be refused with `conflict.audio_source_streaming` until then, after a page reload too. The SDK keeps trying for about 35 seconds before it gives up with that code. * When the page is closed, the SDK tells Sparkle to stop, as far as the browser lets it. * When the person clicks the browser's own "Stop sharing", the tab source stops; the microphone keeps going. ## Speaker keys Each turn's `speaker.key` says who spoke: | Key | Who | | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | | `local` | The person at the microphone. Their turns have channel `mic`. | | `remote`, or `remote_{n}` | Everyone in the shared tab: the first voice heard is `remote`, each new one after it `remote_1`, `remote_2` and so on. Their turns have channel `remote`. | Voices are told apart within one connection, so after a reconnect `remote_1` may be someone else. `speaker.name` is null: the audio carries no names. ## Browser support The microphone works in current Chrome, Edge, Firefox and Safari. Sharing a tab's audio depends on the browser: | Browser | Tab audio | | ---------------------- | ------------------------------------------------------------------------------------------- | | Chrome, Edge (desktop) | Yes. Pick a tab and turn on "Share tab audio". On Windows and ChromeOS, a whole screen too. | | Firefox | No. The shared tab comes back without audio. | | Safari | No. The shared tab comes back without audio. | | Mobile browsers | No. Phones can't share a tab. | When the shared tab has no audio, `recordAudio` rejects with `audio.no_tab_audio` before asking for the microphone, so you can tell the person to share again with tab audio turned on. Ask people to wear headphones when they share a meeting tab. Through speakers, the microphone also hears the meeting, and the same words come back twice: once as `local` and once as `remote`. Capture needs a secure page (HTTPS, or `localhost` while you develop). If your site sends a Content Security Policy, allow the SDK's audio worklet, which loads from a `blob:` URL (`script-src blob:`, unless your policy already uses `'strict-dynamic'`), and the connection (`connect-src wss://api.sparkle.ai`). ## Errors `recordAudio` rejects, and `onError` is called, with a `SparkleAudioError`. Its `source` says which source failed, and its `code` is one of these, or the API's own code when it refused: | `code` | Meaning | | ------------------------- | ------------------------------------------------------------------------------ | | `audio.unsupported` | The browser can't capture audio here: an old browser, or a page without HTTPS. | | `audio.permission_denied` | The person refused the microphone, or cancelled the tab picker. | | `audio.no_microphone` | No input device was found. | | `audio.no_tab_audio` | The shared tab or screen carries no audio. | | `audio.capture_failed` | The device couldn't be opened for another reason. | | `audio.session_failed` | `getSession` threw an error that carries no `code`. | | `audio.connection_failed` | The first connection closed before Sparkle was ready. | When `getSession` throws the API's problem, its `code` becomes the error's code. After the source has been live once, a `status` of 408, 429 or 5xx makes a reconnect try again instead of giving up, except `503 audio.not_configured`. Once live, a source also reconnects when Sparkle ends its connection with `audio.session_limit`, `audio.backpressure`, `bad_gateway.transcription` or `conflict.audio_source_streaming`. Any other code Sparkle ends it with, such as `audio.idle_timeout` or `conflict.conversation_ended`, stops that source and reaches `onError`. The [audio streaming protocol](/docs/api/audio-streaming#how-a-connection-ends) lists them all. ## Transcription minutes Each source is its own stream, and Sparkle meters [transcription minutes](/docs/concepts/plans#how-transcription-is-metered) per stream: an hour with the microphone and a meeting tab is 120 transcription minutes, the microphone alone 60. Pro and Scale pay $0.012 per stream-minute on live keys, billed per second; see [Billing](/docs/concepts/billing#audio-transcription). Free includes 60 a month on live keys, and test keys and the dashboard have their own monthly allowance. Past the allowance, `getSession` gets a `403` with `limit.transcription_minutes` or `limit.test_transcription_minutes`, and the source stops with that code on `onError`. A source that is already streaming keeps going; a reconnect needs a new session, so after a drop or `audio.session_limit` it stops with the code instead. ## Limits * Audio is 16-bit linear PCM, mono, at 16000, 24000, 44100 or 48000 Hz. The SDK uses the rate the browser records at, and resamples to 48000 any other. * One connection per source per conversation: a second `local` stream to the same conversation is refused while the first is open. * A connection with neither audio nor keepalives for 30 seconds is closed. The SDK sends keepalives while paused. * A session token works once, within 60 seconds of being minted. * One connection runs at most as long as your plan allows. The SDK continues on a new session when it ends, as after a drop. For the wire format, see the [audio streaming protocol](/docs/api/audio-streaming). Source: https://docs.sparkle.ai/docs/guides/browser-audio.md --- # Use Sparkle from your AI agent (MCP) > Connect Claude, Claude Code or another MCP client to Sparkle's MCP server by signing in, and let the agent run conversations, read moments and write custom moments. Sparkle runs an [MCP](https://modelcontextprotocol.io) server at `https://api.sparkle.ai/mcp`. Add it to an agent and the agent calls Sparkle itself: it can list your conversations, read their moments, send a transcript, write a custom moment and test it on a real call. You ask in plain words ("summarise today's decisions") and the agent picks the tools. The server is the [public API](/docs/api) in another shape: every tool does what the matching API operation does, with the same permissions. A client connects in one of two ways: * **Sign in.** The client opens Sparkle in your browser, you pick an organization and an environment, and the client acts with your role in that organization. This is the setup below. * **API key.** The client sends a key in a header. Use it for CI, or a client that can't sign in; see [Use an API key instead](#use-an-api-key-instead). The environment decides what the agent creates: test conversations are never billed, live ones are. As on the API, a connection reads all of the organization's conversations, live ones included. ## Set it up **Claude** In Claude on the web or the desktop app: 1. Open **Customize → Connectors** (**Settings → Connectors** on some plans), then choose **+ Add → Add custom connector**. 2. Enter a name, such as `Sparkle`, and the URL `https://api.sparkle.ai/mcp`. 3. Choose **Connect**. Claude opens Sparkle's sign-in; sign in and pick the organization and environment on the consent screen. Custom connectors are available on the Free (one connector), Pro, Max, Team and Enterprise plans. On Team and Enterprise, an Owner adds the connector under **Organization settings → Connectors**. See Anthropic's [custom connector guide](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp). **Claude Code** Add the server: ```bash claude mcp add --transport http sparkle https://api.sparkle.ai/mcp ``` Then run `/mcp` in Claude Code and choose **Authenticate**. Claude Code opens Sparkle's sign-in in your browser; sign in and pick the organization and environment on the consent screen. `claude mcp add` stores the server in this project. Add `--scope user` to have it in every project. ## What you approve The consent screen shows the app's name, whether Sparkle has verified it, and where it sends you back to: Claude, or for Claude Code an app on your own computer. Approve only a sign-in you started yourself. Then you choose: * **The organization** the app works in. It acts with your role there, and if you lose that role the app loses access with it. * **What it can do.** Read (`sparkle:read`) lists conversations, moments, custom moments and usage. Read & write (`sparkle:write`, which includes read) also creates and ends conversations, sends turns, imports transcripts, and creates and tests custom moments. * **The environment.** Test is the default and never billed. Live is billed. What you can approve depends on your role in the organization: | Role | Read | Read & write | Live | | ------ | ---- | ------------ | ---- | | Viewer | Yes | No | No | | Editor | Yes | Yes | No | | Owner | Yes | Yes | Yes | A company owner counts as an owner in every organization. Access tokens last an hour and the client refreshes them on its own. Refresh tokens rotate on each use and last 30 days. See and disconnect your apps in **Settings → Connected apps** in the dashboard; a disconnected app loses access at once. ## Use an API key instead For CI, or a client that can't sign in, send an API key from **Settings → API keys**. Start with a test key (`spk_test_…`); see [Security](#security) below. A key header turns sign-in off for that server. **Claude Code** Add the server with your key as a bearer token: ```bash claude mcp add --transport http sparkle https://api.sparkle.ai/mcp \ --header "Authorization: Bearer spk_test_…" ``` To share the server with your team without sharing a key, commit a `.mcp.json` that reads the key from each person's environment: ```json title=".mcp.json" { "mcpServers": { "sparkle": { "type": "http", "url": "https://api.sparkle.ai/mcp", "headers": { "Authorization": "Bearer ${SPARKLE_API_KEY}" } } } } ``` Run `/mcp` in a session to check that `sparkle` is connected. **Cursor** Add the server to `.cursor/mcp.json` in your project, or to `~/.cursor/mcp.json` for every project, reading the key from your environment: ```json title=".cursor/mcp.json" { "mcpServers": { "sparkle": { "url": "https://api.sparkle.ai/mcp", "headers": { "Authorization": "Bearer ${env:SPARKLE_API_KEY}" } } } } ``` Then check that `sparkle` shows as connected in Cursor's MCP settings. Any other client that speaks Streamable HTTP works the same way: the URL above, and the key in `Authorization: Bearer spk_…` or `X-API-Key: spk_…`. ## Other MCP clients A client that implements MCP authorization finds the sign-in on its own from the server URL. For reference: | What | Where | | ----------------------------- | ----------------------------------------------------------------- | | Protected resource metadata | `https://api.sparkle.ai/.well-known/oauth-protected-resource/mcp` | | Authorization server metadata | `https://api.sparkle.ai/.well-known/oauth-authorization-server` | | Resource (RFC 8707) | `https://api.sparkle.ai/mcp` | | Scopes | `sparkle:read`, `sparkle:write` (write includes read) | Clients are public clients using PKCE with `S256`. A client identifies itself with a Client ID Metadata Document, or registers through Dynamic Client Registration at `/register`. ## Tools | Tool | What it does | | -------------------------- | -------------------------------------------------------------------------------------------------------- | | `list_conversations` | Lists conversations, newest first, with their moments counted by kind. Filters by status. | | `get_conversation` | One conversation: status, environment, times and moments by kind. | | `list_moments` | A conversation's moments: kind, title, what was said, who, when. Filters by kind and minimum confidence. | | `create_conversation` | Starts a conversation, optionally with its own webhook URL. | | `send_turns` | Sends up to 500 turns to a live conversation. | | `end_conversation` | Ends a conversation, which lets every pending moment go. | | `import_transcript` | Imports a finished transcript, as WebVTT, SRT, `Speaker: line` text, JSON or turns. | | `list_custom_moments` | Lists the organization's custom moments. | | `create_custom_moment` | Defines a custom moment as a draft: when it fires, when it doesn't, examples. | | `evaluate_custom_moment` | Runs a custom moment over a stored conversation or a pasted transcript and shows where it fired. | | `list_custom_moment_fires` | Lists the moments a custom moment detected across conversations. | | `get_usage` | The plan, its limits and this month's usage. | The read tools are marked read-only and the writes are marked as writes, so your client can ask before each write. `end_conversation` is marked destructive: an ended conversation takes no more turns. The server also offers this docs site's quickstart as the resource `sparkle://docs/quickstart`. Results are kept small for the model's context: lists stop at 50 items and say when there are more, and long text is cut and marked `[truncated]`. Ask for a narrower filter, or use the [API](/docs/api) for bulk reads. ## Things to ask > Summarise today's decisions. The agent lists today's conversations, reads the `decision` moments of each, and writes the summary. > Write a custom moment for pricing objections and test it on my last call. The agent drafts `when`, `not_when` and examples, creates `pricing_objection` as a draft, finds your latest conversation and evaluates the draft on it. It shows where the moment fired and the turns it nearly fired on, and suggests changes to the wording. The draft detects nothing live until you make it live, from the dashboard or the [API](/docs/guides/custom-moments). > Import this Zoom transcript and tell me who committed to what. The agent sends the file with `import_transcript`, waits for the conversation to end, and reads its `request.do` and `work_item` moments. ## Security * **Start with test.** Whether you sign in or use a key, the conversations a test connection creates are test ones, never billed, and their events reach only test webhooks. Move to live once you trust what the agent does. A test connection still reads the organization's live conversations, so connect an agent that must not see them to an organization that has none. * **Grant only what the agent needs.** Approve read when the agent only has to read. With a key, its role and scopes bound every tool: a `viewer` key can read but every write is refused, and a key scoped to `conversation:*` can't touch custom moments. * **Approve only a sign-in you started.** Check the app's name and where it sends you back to on the consent screen, and deny anything you don't recognise. * **Keep keys out of shared files.** Read a key from an environment variable, as the `.mcp.json` and Cursor examples above do. Anyone holding the key can do what it can. * **Each message counts as an API request.** Custom moment evaluations share the organization's limit of 10 a minute with the API. * **No tool returns a secret.** Results land in the agent's context, transcripts and logs, so `create_conversation` and `import_transcript` with a `webhook_url` create the webhook but never return its signing secret. To read it, rotate it in the dashboard or with `POST /webhooks/{id}/rotate-secret`. Disconnect an app in **Settings → Connected apps**, or revoke a key in **Settings → API keys**, and the agent loses access at its next message. Source: https://docs.sparkle.ai/docs/guides/mcp.md --- # Recall.ai > Send a Recall.ai meeting bot's live transcript to a conversation. A Recall.ai bot can post its transcript to Sparkle as the meeting happens. Sparkle turns each finished utterance into a turn of your conversation. Use this receiver when your code already creates the conversation and wants its id, its own `webhook_url` or its title up front. When bots start outside your code, a [Recall.ai connection](/docs/connections/recall) creates a conversation per bot for you. **Bots in Sparkle's workspace only** The receiver verifies Recall's signature with the verification secret of Sparkle's Recall.ai workspace, so bots must run in that workspace. For bots in your own Recall.ai workspace, use a [connection](/docs/connections/recall), which keeps your workspace's secret. ## Quickstart ### Create a conversation with a Recall receiver Create a conversation with `"receivers": ["recall"]`: ```bash curl -X POST 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": "Weekly sync", "receivers": ["recall"]}' ``` The response's `receivers` list holds the receiver's `path`, shown only this once. Prefix it with the API's origin to get the receiver URL: ```text https://api.sparkle.ai/public/v1/receivers/recall/ ``` The token in the URL identifies the conversation. Keep the URL on your server like an API key. ### Point the bot at the receiver URL When you create the bot, set a transcript provider in `recording_config.transcript` and add the receiver URL as a real-time webhook endpoint that subscribes to `transcript.data`: ```json { "meeting_url": "https://meet.example.com/abc-defg-hij", "recording_config": { "realtime_endpoints": [ { "type": "webhook", "url": "https://api.sparkle.ai/public/v1/receivers/recall/", "events": ["transcript.data"] } ] } } ``` ### Receive moments Each utterance becomes a turn, and the conversation's moments arrive as [`moment.detected` webhooks](/docs/webhooks) and on its event stream. Add `"webhook_url"` to the create to receive them at a URL of this conversation's own. ## How the receiver reads Recall's events * Only `transcript.data` becomes a turn. `transcript.partial_data` is interim and is ignored, as is every other event. Recall gets a `204` either way. * The participant's `id` is the turn's speaker and their `name` the speaker's name. * The turn's id is the participant's `id` and its start in milliseconds (`:`), which is what a moment's `turn_ids` hold. * The turn starts at its first word's `start_timestamp.relative` and ends at its last word's `end_timestamp.relative`: seconds since the recording started. * A retried event replaces its turn, so a repeat never adds a second one. ## Responses | Status | Meaning | | ------ | ----------------------------------------------------------------------------------------------------------------- | | `204` | Accepted, or ignored. | | `401` | The signature is missing or wrong, it was made more than 5 minutes ago, or the URL's token names no conversation. | | `413` | The body is larger than 1 MB. | | `429` | More than 1,200 requests in a minute to one receiver URL. | The receiver logs each request's event type, Recall's message and bot IDs, and its outcome. It doesn't log the transcript. Source: https://docs.sparkle.ai/docs/receivers/recall.md --- # Deepgram > Send Deepgram live transcription results to a conversation. Sparkle reads the `Results` messages of a Deepgram live transcription stream. Deepgram can post them to the receiver URL itself, or your server can forward them from its WebSocket. Use this receiver when your code already creates the conversation and wants its id, its own `webhook_url` or its title up front. When streams start outside your code, a [Deepgram connection](/docs/connections/deepgram) creates a conversation per stream for you. ## Quickstart ### Create a conversation with a Deepgram receiver Create a conversation with `"receivers": ["deepgram"]`: ```bash curl -X POST 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": "Support call", "receivers": ["deepgram"]}' ``` The response's `receivers` list holds the receiver's `path`, shown only this once. Prefix it with the API's origin to get the receiver URL: ```text https://api.sparkle.ai/public/v1/receivers/deepgram/ ``` **The URL is the credential** The token in the URL is the receiver's only authentication: Deepgram doesn't sign its requests. Anyone who holds the URL can add turns to the conversation, so keep it on your server like an API key. ### Send the results Turn on diarization (`diarize=true`) so turns are split by speaker. Then send the results in one of two ways: **Deepgram callback** Add the receiver URL as the stream's `callback`, URL-encoded. Deepgram then posts each streaming response to it: ```text wss://api.deepgram.com/v1/listen?model=nova-3&diarize=true&callback=https%3A%2F%2Fapi.sparkle.ai%2Fpublic%2Fv1%2Freceivers%2Fdeepgram%2F ``` **Forward from your server** Post each message you read from the WebSocket to the receiver URL, unchanged: ```ts socket.addEventListener("message", (event) => { void fetch(process.env.SPARKLE_RECEIVER_URL!, { method: "POST", headers: { "Content-Type": "application/json" }, body: event.data, }); }); ``` ### Receive moments Final results become turns, and the conversation's moments arrive as [`moment.detected` webhooks](/docs/webhooks) and on its event stream. Add `"webhook_url"` to the create to receive them at a URL of this conversation's own. ## How the receiver reads results * Only `Results` messages with `is_final: true` become turns. Interim results and other message types (`Metadata`, `SpeechStarted`, `UtteranceEnd`) are ignored. The receiver answers `204` either way. * A result is split into one turn per run of words from the same speaker. The turn's text uses `punctuated_word` when present. * The speaker is Deepgram's speaker number, prefixed with the channel when it isn't the first (`1:0`). Without diarization, all words in a channel belong to speaker `0`. * Turn times are Deepgram's word `start` and `end`: seconds since the stream started. * Sending the same result again replaces its turns. **Speaker numbers restart on reconnect** Deepgram numbers speakers per connection. After a reconnect, speaker `0` may be a different person. If you need the same speaker key across reconnects, send turns with your own keys through the conversation's turns endpoint instead. ## Responses | Status | Meaning | | ------ | --------------------------------------------------------- | | `204` | Accepted, or ignored. | | `401` | The URL's token names no conversation. | | `413` | The body is larger than 1 MB. | | `429` | More than 1,200 requests in a minute to one receiver URL. | The receiver checks the token only when a message has a final result to add, so an interim message with a wrong token still gets `204`. Source: https://docs.sparkle.ai/docs/receivers/deepgram.md --- # Recall.ai connection > One URL for every Recall.ai bot in your workspace; each call becomes its own conversation. A Recall.ai connection is one permanent URL your bots post to. Sparkle creates a conversation for each bot on its first transcript event, and ends it when Recall reports the call over. You create no conversations yourself. Use a connection when bots start outside your code and you don't want to create conversations yourself. When your code already creates the conversation and wants its id, its own `webhook_url` or its title up front, use the [per-conversation Recall.ai receiver](/docs/receivers/recall) instead. [Sources](/docs/concepts/sources) compares the two. ## Set it up ### Create the connection Create it with your Recall.ai workspace's verification secret (`whsec_…`), which signs the bots' real-time events and the dashboard's webhooks. You can also create it in the dashboard under **Sources → Connect**. ```bash curl -X POST https://api.sparkle.ai/public/v1/connections \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "vendor": "recall", "name": "Sales calls", "environment": "live", "credentials": { "verification_secret": "whsec_..." } }' ``` | Field | What it does | | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | `vendor` | Required. `recall`. | | `name` | Required. A label, up to 100 characters. | | `environment` | Required. `live` or `test`: the environment of every conversation its calls create. Live ones are billed; test ones count against your test minutes. | | `moment_types` | The [moment kinds](/docs/concepts/moments) its conversations detect. Absent or empty detects every kind. | | `credentials` | `verification_secret`: your workspace's secret. Sparkle keeps it and never returns it; the connection's `has_credentials` says whether one is set. | Without a verification secret, only bots in Sparkle's own Recall.ai workspace verify. Sparkle answers `201 Created` with the connection and its `receiver_url`: ```json { "id": "con_2kd9f3h7k1n5r9v3x6bc", "vendor": "recall", "name": "Sales calls", "environment": "live", "moment_types": [], "status": "active", "has_credentials": true, "last_event_at": null, "last_error_code": null, "receiver_url": "https://api.sparkle.ai/public/v1/receivers/recall/", "…": "…" } ``` This is the only time you see `receiver_url`. Keep it on your server like an API key. If you lose it, or it leaks, `POST /connections/{id}/rotate-url` returns a new one, and the old one stops at once. ### Point each bot at the URL When you create a bot, set a transcript provider in `recording_config.transcript` and add the URL as a real-time webhook endpoint that subscribes to `transcript.data`: ```json { "meeting_url": "https://meet.example.com/abc-defg-hij", "recording_config": { "realtime_endpoints": [ { "type": "webhook", "url": "https://api.sparkle.ai/public/v1/receivers/recall/", "events": ["transcript.data"] } ] } } ``` Every bot gets the same URL. The bot is the call: each bot's events go to its own conversation. ### Add the URL to Recall's webhooks dashboard Recall sends a bot's status events only to the endpoints in its **Webhooks** dashboard, never to the bot's real-time endpoint. Add the same URL there as an endpoint subscribed to `bot.call_ended`, `bot.done` and `bot.fatal`, so the conversation ends with the call. **Workspaces created before 2025-12-15** Older Recall.ai workspaces sign dashboard webhooks with a separate secret per endpoint, not the workspace's verification secret. Sparkle refuses their status events with a `401`, and their calls end after 60 minutes without a turn instead. ### Subscribe to the events A call's conversation has no `webhook_url` of its own: its events go to the organization's [webhook subscriptions](/docs/webhooks). Create one in the connection's environment, since a subscription only receives its own environment's events. ### Send a test call `POST /connections/{id}/test` sends a sample call through the same path a bot's events take, signed as Recall signs it: one utterance asking for work, then the bot's end. It creates a short test conversation, whatever the connection's environment, and works on a disabled connection too. It answers: ```json { "conversation_id": "cnv_2kd9f5k9m3q7u1y5b8de", "error_code": null } ``` `conversation_id` is null and `error_code` says why when the call was refused. Being a test conversation, its events go to your test webhook subscriptions, not your live ones. ## What each call becomes The first `transcript.data` of a bot creates a live conversation in the connection's environment, detecting the connection's moment types: * Its title is `Recall.ai call` and the first 8 characters of the bot's id, such as `Recall.ai call 3f2a9c1e`. * Its metadata names the connection, the vendor and the bot: ```json { "connection_id": "con_2kd9f3h7k1n5r9v3x6bc", "vendor": "recall", "external_ref": "3f2a9c1e-7b4d-4e2a-9c1f-5d8e6b0a2c47" } ``` * `conversation.created` carries that metadata, so your handler can match the conversation to your own record of the bot. * Two first events of one bot arriving together still create one conversation. Each utterance becomes a turn as the [Recall.ai receiver reads it](/docs/receivers/recall#how-the-receiver-reads-recalls-events). `transcript.partial_data` is interim and is ignored, as is every event other than `transcript.data` and the three status events above. ## How a call ends | What happens | `conversation.ended` `reason` | | --------------------------------------------------- | ----------------------------- | | `bot.call_ended`, `bot.done` or `bot.fatal` arrives | `requested` | | No turn arrives for 60 minutes | `idle` | Whichever comes first ends it. A later event of an ended call changes nothing. ## Manage the connection | To | Call | | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- | | Stop taking calls | `PATCH /connections/{id}` with `{"status": "disabled"}`. Recall still gets a `2xx`, and the calls are dropped. `"active"` resumes. | | Change the verification secret | `PATCH` with new `credentials`. An empty `credentials` object removes them. | | Change the moment types | `PATCH` with `moment_types`. Calls that start from then on use them. | | Get a new URL | `POST /connections/{id}/rotate-url`. The old URL stops at once. | | Delete it | `DELETE /connections/{id}`. Its URL stops at once; its calls' conversations stay. | ## When calls don't arrive Check `status` first: a disabled connection drops calls without recording them. `GET /connections/{id}` returns `last_event_at`, when a call's event last went through, and `last_error_code`, why the latest one was not taken. `last_error_code` is null again once an event goes through. | `last_error_code` | Means | | ------------------- | -------------------------------------------------------------------------------------------------------- | | `plan_limit` | Your plan refused the call: its minutes are used up, or it runs as many live conversations as it allows. | | `suspended` | Your company is suspended. | | `invalid_signature` | The signature didn't verify against the connection's secret. | | `failed` | Anything else that kept the call's turns out. | `GET /connections/{id}/events` lists the latest 50 requests that carried a call's turns or its end, newest first: each one's event type, the bot's id, its conversation and its error code. It never holds the transcript. ## Responses | Status | Meaning | | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `204` | Accepted, or ignored. A call refused by your plan, a suspended company, or a disabled connection is a `204` too, so Recall neither retries it nor disables the endpoint. | | `401` | The signature is missing or wrong, or it was made more than 5 minutes ago, or the URL names no connection, such as one replaced by a rotation. | | `413` | The body is larger than 1 MB. | | `429` | More than 20,000 requests in a minute to one connection URL. | Source: https://docs.sparkle.ai/docs/connections/recall.md --- # Deepgram connection > One URL for every Deepgram live stream; each stream becomes its own conversation. A Deepgram connection is one permanent URL your live streams post their results to. Sparkle creates a conversation for each streaming request on its first final result, and ends it when the stream closes. You create no conversations yourself. Use a connection when streams start outside your code and you don't want to create conversations yourself. When your code already creates the conversation and wants its id, its own `webhook_url` or its title up front, use the [per-conversation Deepgram receiver](/docs/receivers/deepgram) instead. [Sources](/docs/concepts/sources) compares the two. ## Set it up ### Create the connection Deepgram takes no credentials. You can also create the connection in the dashboard under **Sources → Connect**. ```bash curl -X POST https://api.sparkle.ai/public/v1/connections \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"vendor": "deepgram", "name": "Support line", "environment": "live"}' ``` | Field | What it does | | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | `vendor` | Required. `deepgram`. | | `name` | Required. A label, up to 100 characters. | | `environment` | Required. `live` or `test`: the environment of every conversation its calls create. Live ones are billed; test ones count against your test minutes. | | `moment_types` | The [moment kinds](/docs/concepts/moments) its conversations detect. Absent or empty detects every kind. | Sparkle answers `201 Created` with the connection and its `receiver_url`: ```json { "id": "con_2kd9g6j0m4q8u2y6b9cf", "vendor": "deepgram", "name": "Support line", "environment": "live", "moment_types": [], "status": "active", "has_credentials": false, "last_event_at": null, "last_error_code": null, "receiver_url": "https://api.sparkle.ai/public/v1/receivers/deepgram/", "…": "…" } ``` This is the only time you see `receiver_url`. If you lose it, or it leaks, `POST /connections/{id}/rotate-url` returns a new one, and the old one stops at once. **The URL is the credential** Deepgram doesn't sign its requests, so the token in the URL is the connection's only authentication. Anyone who holds the URL can start conversations in your organization. Keep it on your server like an API key. ### Send the results Turn on diarization (`diarize=true`) so turns are split by speaker. Then send the messages in one of two ways: **Deepgram callback** Add the URL as the stream's `callback`, URL-encoded. Deepgram then posts each streaming response to it: ```text wss://api.deepgram.com/v1/listen?model=nova-3&diarize=true&callback=https%3A%2F%2Fapi.sparkle.ai%2Fpublic%2Fv1%2Freceivers%2Fdeepgram%2F ``` **Forward from your server** Post each message you read from the WebSocket to the URL, unchanged, the closing `Metadata` message included: ```ts socket.addEventListener("message", (event) => { void fetch(process.env.SPARKLE_CONNECTION_URL!, { method: "POST", headers: { "Content-Type": "application/json" }, body: event.data, }); }); ``` Every stream uses the same URL. The streaming request is the call: each `request_id` gets its own conversation, so a reconnect, which is a new request, starts a new one. ### Subscribe to the events A call's conversation has no `webhook_url` of its own: its events go to the organization's [webhook subscriptions](/docs/webhooks). Create one in the connection's environment, since a subscription only receives its own environment's events. ### Send a test call `POST /connections/{id}/test` sends a sample stream through the same path Deepgram's messages take: one final result asking for work, then the closing `Metadata` message. It creates a short test conversation, whatever the connection's environment, and works on a disabled connection too. It answers: ```json { "conversation_id": "cnv_2kd9f5k9m3q7u1y5b8de", "error_code": null } ``` `conversation_id` is null and `error_code` says why when the call was refused. Being a test conversation, its events go to your test webhook subscriptions, not your live ones. ## What each call becomes The first final result of a streaming request creates a live conversation in the connection's environment, detecting the connection's moment types: * Its title is `Deepgram call` and the first 8 characters of the request id, such as `Deepgram call 6f1b2c3d`. * Its metadata names the connection, the vendor and the request: ```json { "connection_id": "con_2kd9g6j0m4q8u2y6b9cf", "vendor": "deepgram", "external_ref": "6f1b2c3d-0a9e-4b8c-8d7f-2e1a5c4b9d30" } ``` * `conversation.created` carries that metadata, so your handler can match the conversation to your own record of the stream. * Two first results of one stream arriving together still create one conversation. Final results become turns as the [Deepgram receiver reads them](/docs/receivers/deepgram#how-the-receiver-reads-results). Interim results and the other message types are ignored. ## How a call ends | What happens | `conversation.ended` `reason` | | ----------------------------------------------- | ----------------------------- | | The stream's closing `Metadata` message arrives | `requested` | | No turn arrives for 60 minutes | `idle` | Deepgram doesn't document the `Metadata` message as always the last one, so the 60-minute rule is the backstop for a stream that closes without it. Whichever comes first ends the conversation; a later message of an ended call changes nothing. ## Manage the connection | To | Call | | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | | Stop taking calls | `PATCH /connections/{id}` with `{"status": "disabled"}`. Deepgram still gets a `2xx`, and the calls are dropped. `"active"` resumes. | | Change the moment types | `PATCH` with `moment_types`. Calls that start from then on use them. | | Get a new URL | `POST /connections/{id}/rotate-url`. The old URL stops at once. | | Delete it | `DELETE /connections/{id}`. Its URL stops at once; its calls' conversations stay. | ## When calls don't arrive Check `status` first: a disabled connection drops calls without recording them. `GET /connections/{id}` returns `last_event_at`, when a call's message last went through, and `last_error_code`, why the latest one was not taken. `last_error_code` is null again once a message goes through. | `last_error_code` | Means | | ----------------- | -------------------------------------------------------------------------------------------------------- | | `plan_limit` | Your plan refused the call: its minutes are used up, or it runs as many live conversations as it allows. | | `suspended` | Your company is suspended. | | `failed` | Anything else that kept the call's turns out. | `GET /connections/{id}/events` lists the latest 50 requests that carried a call's turns or its end, newest first: each one's message type, the request id, its conversation and its error code. It never holds the transcript. ## Responses | Status | Meaning | | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `204` | Accepted, or ignored. A call refused by your plan or a suspended company is a `204` too, and shows in `last_error_code`. So is a disabled connection's, which records nothing. | | `401` | The URL names no connection, such as one replaced by a rotation. Sparkle checks only when a message has a final result to add, so other messages to it still get `204`. | | `413` | The body is larger than 1 MB. | | `429` | More than 20,000 requests in a minute to one connection URL. | Source: https://docs.sparkle.ai/docs/connections/deepgram.md --- # Webhook connection > One URL any tool can post transcripts to, without code. Sparkle recognises the format. A webhook connection is one permanent URL that any tool able to send a webhook can post transcripts to: a note-taker's "meeting finished" hook, an AssemblyAI or Rev callback relayed by your server, or a Zapier or Make step. Sparkle reads the body in whatever format it recognises and turns it into a conversation. You write no code against the turns API. A connection has one of two modes, chosen when you create it: | Mode | Each request is | It becomes | | ------------ | --------------------------------------------------- | ------------------------------------------------------------------------------------ | | `transcript` | A whole transcript of a finished call | A conversation of its own, read through the gate as an [import](/docs/guides/import) | | `turns` | A batch of turns from a call that is still going on | Turns appended to that call's live conversation | ## Set it up ### Create the connection You can also create it in the dashboard under **Sources → Webhook (any tool)**. ```bash curl -X POST https://api.sparkle.ai/public/v1/connections \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"vendor": "webhook", "name": "Note-taker", "environment": "live", "mode": "transcript", "signed": true}' ``` | Field | What it does | | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `vendor` | Required. `webhook`. | | `name` | Required. A label, up to 100 characters. | | `environment` | Required. `live` or `test`: the environment of every conversation it creates. Live ones are billed; test ones count against your test minutes. | | `mode` | Required. `transcript` or `turns`, as above. `PATCH /connections/{id}` with `mode` changes it. | | `signed` | Sparkle generates a signing secret, and refuses requests not [signed](#signing) with it. Leave it out when the tool can't sign; the URL alone then admits a request. | | `moment_types` | The [moment kinds](/docs/concepts/moments) its conversations detect. Absent or empty detects every kind. | Sparkle answers `201 Created` with the connection, its `receiver_url` and, when signed, its `signing_secret`: ```json { "id": "con_2kd9g6j0m4q8u2y6b9cf", "vendor": "webhook", "mode": "transcript", "has_credentials": true, "receiver_url": "https://api.sparkle.ai/public/v1/receivers/webhook/", "signing_secret": "whsec_…", "…": "…" } ``` This is the only time you see either. `POST /connections/{id}/rotate-url` gives the connection a new URL, and the old one stops at once; the secret stays as it was. ### Point the tool at the URL Have the tool `POST` the transcript to `receiver_url`. It sends no API key. **cURL** ```bash curl -X POST "$RECEIVER_URL" \ -H "Content-Type: text/vtt" \ -H "Sparkle-Call-Id: meeting-4821" \ --data-binary @meeting.vtt ``` **Zapier** Add a **Webhooks by Zapier → POST** action after the trigger that has the transcript. Set the URL to `receiver_url`, the payload type to **Raw** (or **JSON** for a list of utterances), the data to the transcript field, and a `Sparkle-Call-Id` header to the meeting's ID so a rerun of the Zap doesn't import the meeting twice. **Make** Add an **HTTP → Make a request** module. Method `POST`, URL `receiver_url`, body type **Raw**, the content type of what you send (`text/plain`, `text/vtt` or `application/json`), the transcript as the request content, and a `Sparkle-Call-Id` header with the meeting's ID. ### Subscribe to the events A connection's conversations have no `webhook_url` of their own: their events go to the organization's [webhook subscriptions](/docs/webhooks) in the connection's environment. ### Send a test `POST /connections/{id}/test` sends a sample through the connection's own path, signed when the connection is: one utterance asking for work, as a whole transcript, or as a batch and then the call's end. It creates a test conversation, whatever the connection's environment, and answers: ```json { "conversation_id": "cnv_2kd9f5k9m3q7u1y5b8de", "error_code": null } ``` ## Accepted formats Sparkle tells the format from the `Content-Type` and from the body itself, so a tool that sends `text/plain` for everything still works. **Plain text** One `Speaker: line` per utterance, optionally led by an `[m:ss]` or `[h:mm:ss]` stamp. A line without a speaker continues the one before it. ```text Ana Lima: Could you send the notes to the team? [0:07] Bo Chen: Sure, after this call. ``` **WebVTT** `Content-Type: text/vtt`, or any body starting `WEBVTT`. Each cue's text starts with its speaker, as Zoom writes it, or uses a `` voice tag. A cue without a speaker continues the previous one's. ```text WEBVTT 1 00:00:01.000 --> 00:00:03.500 Ana Lima: Could you send the notes to the team? 2 00:00:04.000 --> 00:00:05.000 Bo Chen: Sure, after this call. ``` **SRT** `Content-Type: application/x-subrip`, or any body whose first block is a cue number and a timing line. Speakers are written as in WebVTT. ```text 1 00:00:01,000 --> 00:00:03,500 Ana Lima: Could you send the notes to the team? ``` **JSON utterances** A list of utterances, as a top-level array or under `turns`, `utterances`, `segments` or `sentences`, at the top of an object or up to two objects down (as in `results.utterances`). ```json { "call_id": "meeting-4821", "title": "Renewal call", "utterances": [ { "speaker": "Ana Lima", "text": "Could you send the notes to the team?", "start": 1.0, "end": 3.5 }, { "speaker": 1, "transcript": "Sure, after this call.", "start_ms": 4000, "end_ms": 5000 } ] } ``` | Field | Read from | | ------- | ------------------------------------------------------------------------------------------------ | | Speaker | `speaker` (text or a number; `1` reads as "Speaker 1"), and a name from `speaker_name` or `name` | | Text | `text` or `transcript`. An item without either is skipped. | | Start | `start`, `start_s` or `start_time` in seconds or as `h:mm:ss.ttt`; `start_ms` in milliseconds | | End | The same with `end`. Without one, an utterance lasts as long as its words take. | | ID | `id`. Without one, Sparkle keys the utterance by its speaker, start and text. | Without times, utterances follow one another from zero. An object whose `transcript` or `text` field holds plain text, WebVTT or SRT is read as that format. **Sparkle turns** The turns endpoint's own body, every turn with `id`, `final` and `channel`. It is taken as it is, partial turns included in `turns` mode. ```json { "turns": [ { "id": "t1", "final": true, "speaker": "ana", "name": "Ana Lima", "channel": "remote", "start": 1.0, "end": 3.5, "text": "Could you send the notes to the team?" } ] } ``` ## The call ID A request names its call with the `Sparkle-Call-Id` header, or else a top-level `call_id`, `external_id` or `id` field of a JSON object. The header wins. * **`transcript` mode:** optional. A call ID imports once: sending the same call again answers `204` and imports nothing. Without one, every request is a conversation of its own. An optional top-level `title` names the conversation; otherwise it is `Webhook call` and the start of the call ID. * **`turns` mode:** required. Every batch with the same call ID feeds the same conversation, which the first batch creates. A top-level `"ended": true` ends the call after the batch's own turns; a body of only `{"call_id": "…", "ended": true}` ends it too. A call nobody ends is ended after 60 minutes without a turn. Send each utterance's times when the tool has them: untimed lines count from zero in each batch, and an untimed line a speaker repeats word for word in a later batch is taken as the same turn, sent again. ## Signing A signed connection refuses a request without a valid `Sparkle-Source-Signature` header. It is the scheme of the [webhooks Sparkle sends](/docs/webhooks): ```text Sparkle-Source-Signature: t=1764763200,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd ``` `t` is the Unix time you sign at, and `v1` the hex HMAC-SHA256 of `.`, keyed with the whole secret, `whsec_` included. Sign the exact bytes you send. A signature more than 5 minutes from Sparkle's clock is refused. ```ts import { createHmac } from "node:crypto"; const t = Math.floor(Date.now() / 1000); const v1 = createHmac("sha256", process.env.SPARKLE_SIGNING_SECRET!) .update(`${t}.${body}`) .digest("hex"); await fetch(process.env.SPARKLE_RECEIVER_URL!, { method: "POST", headers: { "Content-Type": "application/json", "Sparkle-Source-Signature": `t=${t},v1=${v1}` }, body, }); ``` `PATCH /connections/{id}` with `{"credentials": {}}` removes the secret, after which the URL alone admits a request. An unsigned connection's URL is its only credential: keep it like an API key. ## Payloads and re-run The connection keeps each request it read, up to the latest 50 of the last 24 hours: `GET /connections/{id}/payloads` lists them, newest first, with the format each was read as, its call ID, its turn count, its conversation, its error code and the first 2 KB of its body. A request whose signature failed is never kept. Deleting the connection, or the conversation a payload fed, deletes the payload. `POST /connections/{id}/payloads/{payload_id}/rerun` runs a kept payload through the connection again, as if it had just arrived, and answers like a test. Use it after fixing what refused it, such as your plan's limit. A whole transcript whose call already has a conversation imports nothing again. ## When transcripts don't arrive `GET /connections/{id}` returns `last_event_at` and `last_error_code`, the reason the latest request was not taken. It is null again once a request goes through. | `last_error_code` | Means | | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | `unrecognized_format` | The body is in none of the formats above. The `422`'s `detail` says what was missing. | | `invalid_payload` | The body was read, but its turns break the [turn contract](/docs/concepts/turns), a `turns` batch named no call, or its call has ended. | | `invalid_signature` | A signed connection got a request without a valid signature. | | `plan_limit` | Your plan refused the call: its minutes are used up, or it runs as many live conversations as it allows. | | `suspended` | Your company is suspended. | | `failed` | Anything else that kept the turns out. The payload is kept: re-run it. | ## Responses and limits | Status | Meaning | | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `204` | Accepted. A call your plan refused, or a suspended company's, is a `204` too, and shows in `last_error_code`. So is a disabled connection's, which records nothing. | | `401` | The URL names no webhook connection, or a signed connection's signature is missing, stale or wrong. | | `413` | The body is larger than 5 MB. | | `422` | [Unprocessable](/docs/api/errors/unprocessable): `unprocessable.transcript_format` for a body in no known format, `unprocessable.transcript_invalid` for one whose turns can't be taken. | | `429` | More than 120 requests in a minute to one connection URL. | A whole transcript holds up to 5,000 turns; a `turns` batch up to 500. Source: https://docs.sparkle.ai/docs/connections/webhook.md --- # Zoom connection > Sign in with Zoom once; each cloud-recorded meeting's transcript becomes a conversation after the meeting. A Zoom connection imports your Zoom meetings after they end. When Zoom finishes a cloud recording's audio transcript, Sparkle imports it as a conversation. There is no URL to paste and no code to write: you sign in with Zoom and allow Sparkle. Each person connects their own Zoom account, so an organization can hold several Zoom connections, each named after its account, such as `Zoom · ana@example.com`. ## Set it up ### Connect Zoom In the dashboard, open **Sources** and choose **Connect Zoom**. ### Pick test or live Pick the environment of the conversations your meetings create. Live ones are billed; test ones count against your test minutes. Test is the default. ### Sign in with Zoom and allow Zoom asks you to sign in and allow Sparkle. You then come back to **Sources**, where the connection shows as active. ## What Zoom needs * A paid Zoom plan with cloud recording. * **Create audio transcript** turned on, under **Settings → Recording & Transcript → Advanced cloud recording settings** in Zoom. * Meetings in English: Zoom makes audio transcripts in English only. Only cloud-recorded meetings are imported. A meeting recorded to your computer never reaches Zoom's cloud, so Sparkle never sees it. ## What happens after a meeting 1. Zoom finishes the meeting's audio transcript and notifies Sparkle. 2. Sparkle downloads the transcript, a VTT file, with your grant. 3. Sparkle imports it as a conversation in the connection's environment, named after the meeting's topic. It shows up a few minutes after Zoom finishes the transcript. From there it is like any [imported transcript](/docs/guides/import): moments are detected, your [webhooks](/docs/webhooks) fire and the Overview counts it. The conversation's metadata names the connection, `vendor: "zoom"` and the meeting's Zoom UUID as `external_ref`. The connection's row under **Sources** shows when the last meeting was imported and, under **Details**, the latest 50 messages from Zoom, each with its conversation. If your plan refuses an import, such as when its minutes are used up, the meeting isn't imported and the row shows why as its last error. ## One organization per Zoom account A Zoom account connects to one organization at a time. Connecting it in a second organization, in this company or another, is refused: disconnect it in the first one, then connect it in the second. Zoom keeps only the latest sign-in of a Zoom account, so even a refused attempt can end the first organization's access at Zoom. When that happens, or when the access expires or the Sparkle app is removed in Zoom, the connection shows **Needs reconnecting** and the organization's owners and editors get an email. Connect Zoom again in that organization to start importing. ## Privacy * Sparkle reads only your Zoom user profile and the list of your meetings' recording files, and downloads only the transcript. Never the audio or the video. * Your Zoom tokens are kept encrypted in Vault and never shown, to you or anyone else. * The transcript's text is stored as the conversation's turns, and kept as long as any conversation's. * **Disconnect**, in the connection's menu under **Sources**, revokes Sparkle's access at Zoom and destroys the tokens. The connection stays, disconnected, with its event log; **Reconnect** signs in again. Deleting the connection revokes access too. * Removing the Sparkle app in Zoom's App Marketplace disconnects it as well. * Deleting your company or the organization revokes access. Meetings already imported stay as conversations until you delete them. Source: https://docs.sparkle.ai/docs/connections/zoom.md --- # Webhooks > Receive signed events, per conversation or for the organization, verify them, and replay a delivery. Sparkle sends events as JSON `POST` requests to URLs you choose, signed so you can check they came from Sparkle. There are three ways to receive them: | Use | When | | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | A conversation's own `webhook_url` | A request-scoped integration: whoever starts the conversation handles its events. Pass `webhook_url` to `POST /conversations`. | | A webhook subscription | A backend that handles every conversation of the organization. Create one with `POST /webhooks`, or in the dashboard under **Webhooks**. | | The conversation's event stream | A live UI. `GET /conversations/{id}/stream` sends `moment.detected`, then `conversation.ended` after the last moment, as server-sent events: the same events, with the same `id`s, the webhooks get. | A subscription and a conversation's own webhook are independent: a conversation with a `webhook_url` in an organization with a subscription sends each of its events to both, one delivery each, with the same event `id`. Nothing is deduplicated across them. ## Test and live Every subscription belongs to one environment, `test` or `live`, and receives only the events of conversations in that environment. A conversation created with a key takes the key's environment (`spk_test_…` or `spk_live_…`), one from a connection takes the connection's, and one from a dashboard import takes the environment you pick; the Playground's, and others started in the dashboard, are `test`. So trying things out with a test key never sends anything to your production endpoint. A conversation's own `webhook_url` isn't filtered: it receives that conversation's events whatever the environment. Set `environment` when you create the subscription. An API key creates subscriptions in its own environment only: leave `environment` out and it takes the key's, and naming the other one is refused with `validation.webhook.environment_mismatch`. In the dashboard, or with a personal access token, you pick either. It can't be changed afterwards: to move an endpoint to the other environment, create a new subscription for it and delete the old one. The dashboard's test inbox subscribes as `test`. To subscribe your production endpoint, create it with a live key: ```bash curl -X POST "https://api.sparkle.ai/public/v1/webhooks" \ -H "X-API-Key: $SPARKLE_LIVE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"url": "https://example.com/webhooks/sparkle", "environment": "live", "events": ["*"]}' ``` Every event carries `livemode`: `true` for a live conversation's events, however it was created, and for pings to a live subscription; `false` otherwise. Check it when one handler serves both environments. ## Events | Event | When | | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------- | | `conversation.created` | A conversation was created. | | `moment.detected` | A conversation's moment was detected. | | `conversation.ended` | An ended conversation let go its last moment: no `moment.detected` for it follows. | | `conversation.deleted` | A conversation was deleted, with everything it held. | | `webhook.ping` | The subscription was created, its URL changed, or you called `POST /webhooks/{id}/test`. Always sent; you can't subscribe to it. | A subscription receives the events it lists in `events`. `"events": ["*"]` receives every event, including event types added after the subscription was made; `*` goes alone, never beside event names. The dashboard subscribes new endpoints this way. A conversation's own webhook receives `conversation.created`, `moment.detected` and `conversation.ended` for that conversation only; its secret and URL are erased when the conversation is deleted, so `conversation.deleted` goes to subscriptions only. The [API reference](/docs/api) documents each event's body under **Webhook events**. ## The event Every event has the same envelope, as a webhook body and as a stream event's data: ```json { "id": "evt_2jxsy8cc8v0348asy6t1", "object": "event", "type": "moment.detected", "livemode": false, "created_at": "2026-12-03T15:04:05Z", "data": { "id": "mom_…", "object": "moment", "…": "…" } } ``` * `id` is the event. It stays the same on every retry and on a replay, and when one event goes to several URLs. Use it to drop repeats. * `type` is the event, which the `Sparkle-Event` header repeats. * `livemode` is `true` for a live conversation's events and for a ping to a live subscription ([test and live](#test-and-live)). * `created_at` is when it happened, to the second. * `data` depends on the type: | Event | `data` | | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `moment.detected` | The moment, as `GET /conversations/{id}/moments` lists it. | | `conversation.created` | The conversation resource, the shape `GET /conversations/{id}` returns. | | `conversation.ended` | `{conversation, summary, reason}`: the ended conversation; `summary` with `moments_count`, `moments_by_kind` (a count per kind, `{}` when there were none), `duration_s` (from `started_at` to `ended_at`) and `turns_count` (final turns); and `reason`, why it ended: `requested`, `idle`, `completed` or `failed` ([lifecycle](/docs/concepts/conversations#lifecycle)). | | `conversation.deleted` | `{"id": "cnv_…", "object": "conversation", "deleted": true}` | | `webhook.ping` | `{}` | A moment looks like this: ```json { "id": "mom_2jxsy8cc8v0348asy6t1", "object": "moment", "conversation_id": "cnv_2jxsy8cc8v0348asy6t1", "kind": "request.do", "title": null, "text": "Can you send the summary to the board by Friday?", "speaker": { "key": "dana", "name": "Dana" }, "at": 24, "confidence": 0.9, "turn_ids": ["t5"], "settled_ms": 0, "classifier": "typesafe:…", "definition": null, "created_at": "2026-12-03T15:04:05.123456Z" } ``` `at` is seconds from the conversation's `started_at`, as a turn's `start` and `end` are, and `turn_ids` are the ids you sent the turns with. `speaker.name` is `null` when the turn had no name. `definition` names the custom moment type it was detected as, with the `label` and `color` it had then, and is `null` for a built-in kind. `title` is always `null` for now. ### Ordering Sparkle emits a conversation's `conversation.ended` after its last `moment.detected`, but each delivery is sent and retried on its own, so they can arrive in any order. Treat a conversation as complete once you hold `summary.moments_count` of its moments, counted by moment `id`. The event stream is one ordered stream, so on it `conversation.ended` always comes after the moments. ## Headers | Header | Value | | ------------------- | ---------------------------------------------------------------------------------- | | `Sparkle-Event` | The event type, such as `moment.detected`. | | `Sparkle-Delivery` | The delivery ID, the same on every retry; a replay is a new delivery with its own. | | `Sparkle-Signature` | `t=,v1=`, signed again on each attempt. | ## Verify the signature The `v1` value is the HMAC-SHA256 of `.`. The key is the signing secret exactly as the API returned it, `whsec_` prefix included, as UTF-8 bytes: the subscription's or, for a conversation's own webhook, the `webhook.secret` its create returned. To verify a delivery: 1. Read the body as raw text, before any JSON parsing. Re-encoded JSON won't match. 2. Compute the HMAC of the `t` value, a `.`, and the raw body, and compare it with each `v1` value in constant time. 3. Reject the request when `t` is more than 5 minutes from your clock. This stops a captured request from being replayed later. ```ts title="verify.ts" import { createHmac, timingSafeEqual } from "node:crypto"; const TOLERANCE_SECONDS = 5 * 60; export function verifySparkleSignature( secret: string, header: string, rawBody: string, nowSeconds = Math.floor(Date.now() / 1000) ): boolean { let timestamp = ""; const signatures: Buffer[] = []; for (const part of header.split(",")) { const [key, value = ""] = part.trim().split("="); if (key === "t") timestamp = value; if (key === "v1") signatures.push(Buffer.from(value, "hex")); } const signedAt = Number(timestamp); if (!Number.isInteger(signedAt) || signatures.length === 0) return false; if (Math.abs(nowSeconds - signedAt) > TOLERANCE_SECONDS) return false; const expected = createHmac("sha256", secret).update(`${timestamp}.${rawBody}`).digest(); return signatures.some((sig) => sig.length === expected.length && timingSafeEqual(sig, expected)); } ``` ```ts title="route.ts" export async function POST(request: Request): Promise { const body = await request.text(); const signature = request.headers.get("Sparkle-Signature") ?? ""; if (!verifySparkleSignature(process.env.SPARKLE_WEBHOOK_SECRET!, signature, body)) { return new Response("invalid signature", { status: 400 }); } const event = JSON.parse(body); // Drop an event.id already handled, handle event.type, then answer 2xx quickly. Do slow work // after responding. return new Response(null, { status: 204 }); } ``` ### Rotate the secret Rotating a subscription's secret, in the dashboard or with `POST /webhooks/{id}/rotate-secret`, returns a new secret once. The replaced secret keeps signing beside it for a day, so each delivery then carries two signatures, the new secret's first: ``` Sparkle-Signature: t=1764763200,v1=,v1= ``` A receiver that accepts any matching `v1`, as the sample above and the SDK's `verify` do, keeps accepting deliveries while you deploy the new secret. Set `expires_in` to choose the overlap in seconds, up to `604800` (7 days), or `0` to stop the old secret at once, as after a leak. Once the overlap ends, only the new secret signs. The test endpoint signs with the new secret alone. ## Retries Answer with a `2xx` within 30 seconds. Sparkle stores up to 10 KB of your response on the delivery. * A network error, a timeout, a `429` or a `5xx` is retried: up to 5 attempts, the first at once and the next after 1, 2, 4 and 8 minutes. * Any other `4xx` fails the delivery at once, without retries. * A `3xx` fails it at once too: redirects aren't followed, so give the URL the endpoint answers on. * Each attempt goes to the subscription's URL as it is then, so changing the URL redirects the retries still to come. * Sparkle only delivers to addresses on the public internet. A URL naming a private, loopback or link-local address is refused when you create the webhook, and one whose hostname resolves to such an address fails its delivery at once, without retries. Because an event can arrive more than once, deduplicate on its `id`. ## Deliveries and replay `GET /webhooks/{id}/deliveries` lists a subscription's deliveries, newest first. Each delivery shows its `status` (`pending`, `success`, `failed`, or `skipped` while the subscription was [paused](#failing-endpoints)), `attempt_count`, and the last attempt's `http_status` and `duration_ms`. A conversation's own webhook is a subscription too: its `id` is the conversation's `webhook.id`, and its deliveries list and replay the same way. It isn't in `GET /webhooks`, which lists the organization's subscriptions. To send a delivery again, for example after fixing your endpoint, replay it: ```bash curl -X POST "https://api.sparkle.ai/public/v1/webhooks/$WEBHOOK_ID/deliveries/$DELIVERY_ID/replay" \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" ``` The replay is a new delivery with its own `Sparkle-Delivery` ID and a `replay_of` field naming the original. It sends the original body, event `id` included, to the subscription's current URL, even if the subscription is inactive, and is signed and retried like any other delivery. Sending the same `Idempotency-Key` again returns the first replay and sends nothing. ## Failing endpoints When a subscription's deliveries keep failing, Sparkle warns you, then pauses it so a broken endpoint stops taking retries: * A delivery that ends failed marks the endpoint failing, and its `failing_since` records when; any successful delivery clears it. A failed `webhook.ping` doesn't count. * While it fails, the organization's owners and editors, and the company's owners, get a warning email at most once a day: when a delivery used up its retries, or when the last 5 deliveries all failed. It says when the endpoint will be paused. * After 3 days with no successful delivery, the next failure pauses the subscription and they get an email saying so. Its `is_active` turns `false` and `paused_at` records when; `failing_since` stays as it was. While paused, the subscription's events are still recorded as deliveries with the status `skipped`: nothing is sent and no attempt is made, but each keeps its body so you can replay it. A subscription you switch off yourself, with `is_active: false`, isn't paused: its events aren't recorded for it at all. In the dashboard, the **Webhooks** list marks a failing or paused endpoint, and the endpoint's page says when it will be paused, or when it was. Its deliveries can be filtered to the skipped ones. ### Re-enable and replay Fix the endpoint first: send a test event from its page, or call `POST /webhooks/{id}/test`, until it answers `2xx`. Then, on the endpoint's page in the dashboard, choose **Re-enable**, and then **Replay skipped deliveries** beside its deliveries. Owners and editors can do both. With the API, re-enable it by setting `is_active` back to `true`: ```bash curl -X PUT "https://api.sparkle.ai/public/v1/webhooks/$WEBHOOK_ID" \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"is_active": true}' ``` Re-enabling clears `paused_at` and `failing_since`, so the 3 days start again from the next failure. The skipped deliveries stay skipped until you replay them with `POST /webhooks/{id}/deliveries/replay-skipped`. Each call replays up to 500, oldest first, each as a new delivery whose `replay_of` names the skipped one, and answers `{"replayed": 500, "has_more": true}`. Call it again while `has_more` is `true`; a skipped delivery already replayed is left out, so a call never replays one twice: **cURL** ```bash curl -X POST "https://api.sparkle.ai/public/v1/webhooks/$WEBHOOK_ID/deliveries/replay-skipped" \ -H "X-API-Key: $SPARKLE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" ``` **TypeScript** ```ts let hasMore = true; while (hasMore) { const result = await sparkle.webhooks.deliveries.replaySkipped(webhookId); console.log(`replayed ${result.replayed}`); hasMore = result.has_more; } ``` **Python** ```python url = f"https://api.sparkle.ai/public/v1/webhooks/{webhook_id}/deliveries/replay-skipped" while True: response = requests.post( url, headers={ "X-API-Key": os.environ["SPARKLE_API_KEY"], "Idempotency-Key": str(uuid.uuid4()), }, ) response.raise_for_status() result = response.json() print("replayed", result["replayed"]) if not result["has_more"]: break ``` **Go** ```go url := "https://api.sparkle.ai/public/v1/webhooks/" + webhookID + "/deliveries/replay-skipped" for { req, _ := http.NewRequest("POST", url, nil) req.Header.Set("X-API-Key", os.Getenv("SPARKLE_API_KEY")) req.Header.Set("Idempotency-Key", rand.Text()) resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } var result struct { Replayed int `json:"replayed"` HasMore bool `json:"has_more"` } err = json.NewDecoder(resp.Body).Decode(&result) resp.Body.Close() if err != nil { log.Fatal(err) } fmt.Println("replayed", result.Replayed) if !result.HasMore { break } } ``` Each call needs its own `Idempotency-Key`: sending one again returns that call's answer and replays nothing more. Replays are sent even while the subscription is paused, so re-enable it first, or they go to an endpoint that may still be failing. Every delivery, retried and skipped ones included, is kept for 30 days from its event and then deleted. Replay skipped deliveries within that window: a skipped delivery older than 30 days is gone and can't be sent. Source: https://docs.sparkle.ai/docs/webhooks.md --- # API reference > Every endpoint and webhook event of the Sparkle API, generated from its OpenAPI spec. The pages in this section are generated from the OpenAPI spec, so they always match the API the server exposes. The spec itself is at [`/openapi/v1.yaml`](https://docs.sparkle.ai/openapi/v1.yaml), and every page here is also markdown at its URL plus `.md`. * **Base URL:** `https://api.sparkle.ai/public/v1` * **Authentication:** your organization's API key in the `X-API-Key` header. * **Writes:** every `POST` and `PUT` takes an `Idempotency-Key` header. * **Lists:** cursor-paginated. Pass `page_info.end_cursor` as `cursor`, and up to 100 items as `limit`. * **Errors:** RFC 9457 problem details, described under [Errors](/docs/api/errors). * **Changes:** listed in the [API changelog](/docs/api/changelog), with how breaking changes are announced. Source: https://docs.sparkle.ai/docs/api.md --- # API changelog > Changes to Sparkle's public API, its webhook events and the audio socket, newest first. Changes to the API at `https://api.sparkle.ai/public/v1`, the events it sends and the audio socket, newest first. Product news is on the [Sparkle changelog](https://sparkle.ai/changelog). ## Versioning and deprecation Every endpoint sits under `/public/v1`. Changes that add to the API ship within `v1` without notice: new endpoints, new optional request fields, new response fields, new event types and new values in an existing field. Write clients that ignore fields, event types and values they don't know, as the docs ask for a `conversation.ended` [reason](/docs/concepts/conversations#lifecycle) and the [audio socket's](/docs/api/audio-streaming#2-stream) messages. A subscription to `*` receives event types added later without a change on your side. A change that breaks a documented behavior of the public API is announced in this changelog and by email to each company's owners, at least 90 days before it takes effect, except where security or the law requires otherwise. The entry says what changes, when, and what to do instead. {/* TODO(amalucelli): 90-day notice period proposed; confirm against the Terms before launch. */} ## 2026-12-03 The public API as it stands: conversations and their turns, moments and custom moments, webhooks, audio, connections, the plan and the MCP server. ### Across the API * Authentication with an API key in the `X-API-Key` header: `spk_test_…` for the test environment, never billed, and `spk_live_…` for live. A personal access token (`pat_…`) works in the same header. A key acts in one organization. See [Security and data](/docs/concepts/security#api-keys). * [Get the authenticated principal](/docs/api/reference/authentication/getMe) — `GET /me` * Every `POST`, `PUT` and `PATCH` requires an `Idempotency-Key` header, so a retried request is not processed twice. * Most lists are cursor-paginated: pass `page_info.end_cursor` as `cursor`, and up to 100 items as `limit`. A paginated list also carries a `Link` header. * Errors are RFC 9457 problem details with a stable `code`, which the `X-Error-Code` header repeats. See [Errors](/docs/api/errors). ### Resources **Conversations** A conversation takes the environment of the key that creates it. Pass `webhook_url` to give it its own webhook, and `receivers` to get a receiver path per vendor. See [Conversations and sources](/docs/concepts/conversations). * [List conversations](/docs/api/reference/conversations/listConversations) — `GET /conversations` * [Create a conversation](/docs/api/reference/conversations/createConversation) — `POST /conversations` * [Get a conversation](/docs/api/reference/conversations/getConversation) — `GET /conversations/{id}` * [Delete a conversation](/docs/api/reference/conversations/deleteConversation) — `DELETE /conversations/{id}`. Erases its turns, its moments and the deliveries that carry them, and sends `conversation.deleted`. **Turns** * [Add turns](/docs/api/reference/conversations/addConversationTurns) — `POST /conversations/{id}/turns`. A turn sent again under the same `id` replaces it, and only final turns reach detection, so repeating a batch is safe. See [The turn contract](/docs/concepts/turns). * [List turns](/docs/api/reference/conversations/listConversationTurns) — `GET /conversations/{id}/turns`, partial ones included, in start order **Moments** The ten built-in kinds are described under [Moments](/docs/concepts/moments), and when each is let go under [Timing profiles](/docs/concepts/timing). * [List moments](/docs/api/reference/conversations/listConversationMoments) — `GET /conversations/{id}/moments`, in the order they were let go * [Follow moments in real time](/docs/api/reference/conversations/openConversationStream) — `GET /conversations/{id}/stream`. Server-sent events: `moment.detected`, then `conversation.ended` after the last moment. Send an event's `id` back as `Last-Event-ID` to resume after it. **Import** * [Import a finished transcript](/docs/api/reference/conversations/importConversation) — `POST /conversations/import`. Runs a whole transcript through the same detection as a live call, on the transcript's own clock. The conversation is `processing` until it ends by itself, or with `reason: failed` if the import can't be recovered. See [Import a finished transcript](/docs/guides/import). **Ending a conversation** * [End a conversation](/docs/api/reference/conversations/endConversation) — `POST /conversations/{id}/end`. Lets every pending moment go, then sends `conversation.ended`. * A live conversation also ends by itself once no turn has arrived for 60 minutes and no audio socket is open. * `conversation.ended` carries `reason`, one of `requested`, `idle`, `completed` or `failed`. `failed` is new: an import that can't be recovered ends with it. Treat a value you don't know as `requested`. See [Lifecycle](/docs/concepts/conversations#lifecycle). **Deliveries** * [List a conversation's webhook deliveries](/docs/api/reference/conversations/listConversationDeliveries) — `GET /conversations/{id}/deliveries`, to the organization's subscriptions and to the conversation's own webhook, newest first **Custom moments** A moment kind you define in plain English, tested on a transcript, then run beside the live version before it replaces it. See [Custom moments](/docs/guides/custom-moments). * [List custom moments](/docs/api/reference/custom-moments/listCustomMoments) — `GET /moments` * [Define a custom moment](/docs/api/reference/custom-moments/createCustomMoment) — `POST /moments`. It starts as a draft at version 1. * [Get a custom moment](/docs/api/reference/custom-moments/getCustomMoment) — `GET /moments/{id}` * [Update a custom moment](/docs/api/reference/custom-moments/updateCustomMoment) — `PUT /moments/{id}`. Once it has a `live_version`, a change to its definition writes the next version as a draft, and the live version keeps running. * [Delete a custom moment](/docs/api/reference/custom-moments/deleteCustomMoment) — `DELETE /moments/{id}`. Moments it detected keep its name as their kind. * [List templates](/docs/api/reference/custom-moments/listCustomMomentTemplates) — `GET /moments/templates` * [Enable a template](/docs/api/reference/custom-moments/enableCustomMomentTemplate) — `POST /moments/templates/{key}/enable`, live at once * [Evaluate an unsaved custom moment](/docs/api/reference/custom-moments/evaluateCustomMomentDraft) — `POST /moments/evaluate` * [Evaluate a custom moment](/docs/api/reference/custom-moments/evaluateCustomMoment) — `POST /moments/{id}/evaluate`, its current or an earlier version. Both evaluations run over up to 1,000 turns and return where it fired, the threshold a turn needed and up to 3 `near_misses`: the turns that scored highest without firing, each with its score and a `reason`, `below_threshold` or `settled_away`. With expected labels, they also return hits, misses, false fires and precision. * [List versions](/docs/api/reference/custom-moments/listCustomMomentVersions) — `GET /moments/{id}/versions`. While a version runs in shadow, compares it with the live version on the same conversations. * [Run a version in shadow](/docs/api/reference/custom-moments/shadowCustomMomentVersion) — `POST /moments/{id}/versions/{n}/shadow`. Its moments are stored for the comparison and never sent to streams or webhooks. * [Stop a shadow](/docs/api/reference/custom-moments/stopCustomMomentShadow) — `DELETE /moments/{id}/versions/{n}/shadow`. The version returns to draft. * [Promote a version](/docs/api/reference/custom-moments/promoteCustomMomentVersion) — `POST /moments/{id}/versions/{n}/promote`. The live version is archived and a shadow of this one ends. * [List a custom moment's fires](/docs/api/reference/custom-moments/listCustomMomentFires) — `GET /moments/{id}/fires`, across the organization's conversations. Shadow fires only with `include_shadow=true`. **Webhooks** Each subscription belongs to the `test` or `live` environment and receives only that environment's events; an API key creates subscriptions in its own environment. `events: ["*"]` receives every event, those added later included. See [Webhooks](/docs/webhooks). * [List webhook subscriptions](/docs/api/reference/webhooks/listWebhookSubscriptions) — `GET /webhooks` * [Create a webhook subscription](/docs/api/reference/webhooks/createWebhookSubscription) — `POST /webhooks`. The signing secret appears only in this response. * [Get a webhook subscription](/docs/api/reference/webhooks/getWebhookSubscription) — `GET /webhooks/{id}` * [Update a webhook subscription](/docs/api/reference/webhooks/updateWebhookSubscription) — `PUT /webhooks/{id}` * [Delete a webhook subscription](/docs/api/reference/webhooks/deleteWebhookSubscription) — `DELETE /webhooks/{id}` * [List webhook deliveries](/docs/api/reference/webhooks/listWebhookDeliveries) — `GET /webhooks/{id}/deliveries` * [Replay a webhook delivery](/docs/api/reference/webhooks/replayWebhookDelivery) — `POST /webhooks/{id}/deliveries/{deliveryId}/replay`, as a new delivery whose `replay_of` names the original * [Test a webhook subscription](/docs/api/reference/webhooks/testWebhookSubscription) — `POST /webhooks/{id}/test`, which sends a `webhook.ping` * Deliveries carry `Sparkle-Event`, `Sparkle-Delivery` and `Sparkle-Signature`, an HMAC-SHA256 of the timestamp and the raw body. See [Verify the signature](/docs/webhooks#verify-the-signature). * Rotating a subscription's secret, in the dashboard, keeps the replaced secret signing beside the new one for a day by default, up to 7 days, so each delivery carries both signatures while you switch. See [Rotate the secret](/docs/webhooks#rotate-the-secret). * A network error, a timeout, a `429` or a `5xx` is retried, up to 5 attempts; any other `4xx` or a `3xx` fails the delivery at once. See [Retries](/docs/webhooks#retries). **Webhook events** Every event has the same envelope, with `livemode` set to `true` for a live conversation's events and for a ping to a live subscription. * [`conversation.created`](/docs/api/reference/webhook-events/conversationCreated) * [`moment.detected`](/docs/api/reference/webhook-events/momentDetected) * [`conversation.ended`](/docs/api/reference/webhook-events/conversationEnded), with the summary and the `reason` * [`conversation.deleted`](/docs/api/reference/webhook-events/conversationDeleted) * [`webhook.ping`](/docs/api/reference/webhook-events/webhookPing), always sent; it can't be subscribed to **Audio** * [Create an audio session](/docs/api/reference/conversations/createAudioSession) — `POST /conversations/{id}/audio-sessions`. Returns a one-time WebSocket URL, valid for 60 seconds. * The audio socket: stream 16-bit PCM and get interim text and finished turns back on the same connection. See [Audio streaming protocol](/docs/api/audio-streaming), and [Capture audio in the browser](/docs/guides/browser-audio) for the browser SDK. **Connections** A connection turns every call a vendor sends into a conversation of its own, in the connection's environment. Vendors: `recall`, `deepgram`, `webhook` and `zoom`. See [Recall.ai](/docs/connections/recall), [Deepgram](/docs/connections/deepgram), [Webhook](/docs/connections/webhook) and [Zoom](/docs/connections/zoom); a Zoom connection is made in the dashboard by signing in with Zoom. * [List connections](/docs/api/reference/connections/listConnections) — `GET /connections` * [Create a connection](/docs/api/reference/connections/createConnection) — `POST /connections`. The receiver URL appears only in this response. * [Get a connection](/docs/api/reference/connections/getConnection) — `GET /connections/{id}` * [Update a connection](/docs/api/reference/connections/updateConnection) — `PATCH /connections/{id}` * [Delete a connection](/docs/api/reference/connections/deleteConnection) — `DELETE /connections/{id}` * [Rotate the receiver URL](/docs/api/reference/connections/rotateConnectionURL) — `POST /connections/{id}/rotate-url`. The old URL stops at once. * [Send a test call](/docs/api/reference/connections/testConnection) — `POST /connections/{id}/test`, as a test conversation * [List a connection's events](/docs/api/reference/connections/listConnectionEvents) — `GET /connections/{id}/events`, the latest 50 * [List a webhook connection's payloads](/docs/api/reference/connections/listConnectionPayloads) — `GET /connections/{id}/payloads`, from the last 24 hours * [Re-run a webhook connection's payload](/docs/api/reference/connections/rerunConnectionPayload) — `POST /connections/{id}/payloads/{payload_id}/rerun` For a single conversation, the `receivers` of `POST /conversations` give it its own [Recall.ai](/docs/receivers/recall) or [Deepgram](/docs/receivers/deepgram) receiver path. **Plan** * [Get the plan](/docs/api/reference/plan/getPlan) — `GET /plan`. The company's plan, its limits and the usage counted against them. See [Plans & limits](/docs/concepts/plans). **MCP server** * `POST https://api.sparkle.ai/mcp`, beside the public API rather than under `/public/v1`: an MCP server, over stateless Streamable HTTP, for agents such as Claude Code, Claude Desktop and Cursor. Its tools run conversations, read their moments and write custom moments through the same operations as the API. Clients connect by signing in with OAuth (PKCE, Client ID Metadata Documents or Dynamic Client Registration), choosing the organization and environment on Sparkle's consent screen, or with an API key as a bearer token or in `X-API-Key`. It acts in that organization and environment; a personal access token is refused. Source: https://docs.sparkle.ai/docs/api/changelog.md --- # Audio streaming protocol > Stream raw audio to a conversation over a WebSocket, from a server, a phone bridge or a mobile app. The [browser SDK](/docs/guides/browser-audio) speaks this protocol for you. Use it directly when your audio isn't in a browser: a server processing a call, a phone bridge, or a mobile app. Each audio source is one WebSocket. Sparkle transcribes what you send, stores the turns, and sends interim text and finished turns back on the same connection. No audio is stored, on disk, in Redis or in logs; only the turns transcribed from it are kept. ## 1. Mint a session `POST /conversations/{id}/audio-sessions`, with your API key: | Field | Value | | ------------- | ----------------------------------------------------------------------- | | `source` | `local` for the person running the capture, `remote` for everyone else. | | `encoding` | `linear16`: 16-bit signed PCM, little-endian, mono. | | `sample_rate` | `16000`, `24000`, `44100` or `48000`. | | `language` | Optional, such as `en`. | It answers `201` with `url`, `token` and `expires_at`. The `url` is the WebSocket to open, with the token in its query. The token works once, within 60 seconds: mint a new session for every connection, reconnects included. A refusal is an [error](/docs/api/errors) with one of the codes under [Refusals](#refusals). ## 2. Stream Open the `url` and wait for `{"type":"ready"}` before sending audio. Sparkle connects to its transcriber first, so `ready` can take up to 10 seconds; don't give up sooner. **You send:** | Frame | Content | | ------ | --------------------------------------------------------------------------------------------------------- | | Binary | PCM at the declared rate, up to 64 KB per frame. Send about 100 ms per frame, as it is captured. | | Text | `{"type":"keepalive"}` every 5 seconds while no audio flows, such as while muted. | | Text | `{"type":"stop"}` when you're done: Sparkle transcribes what it has, sends the last turns, then `closed`. | **Sparkle sends**, as JSON text frames: | `type` | Fields | Meaning | | --------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | `ready` | | Start sending audio. | | `interim` | `source`, `text` | What is being heard; the next interim replaces it. | | `turn` | `turn`: `id`, `speaker` (`key`, `name`), `text`, `start_s`, `end_s` | A finished turn, already stored. Times are seconds on the conversation's clock. | | `error` | `code`, `message` | Why the connection is ending. The close frame follows it; `closed` doesn't. | | `closed` | | After your `stop`, or before the server shuts down. The close frame follows. | Ignore message types you don't know: new ones may be added. Sparkle may skip `interim` messages when your side reads slowly; the next one replaces them anyway. `turn` messages are never skipped. Speaker keys are `local` for a `local` source. On a `remote` source, the first voice heard is `remote` and each new one after it `remote_1`, `remote_2` and so on, counted per connection. `speaker.name` can be null. ## How a connection ends Sparkle closes the socket with one of these close codes. When it ends on an error, the `error` message comes first and the close frame's reason repeats its `code`, so a client that missed the message can still read it. | Close code | `code` | Retry? | | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | | `1000` | None: `closed` came first, after your `stop`. | No: you're done. | | `1001` | None: `closed` came first, and the server is shutting down. The turns already heard are stored. | Yes, on a new session. | | `1003` | `audio.invalid_message`: a text frame wasn't `keepalive` or `stop`. | No. Fix the client. | | `1008` | `audio.idle_timeout`: neither audio nor a keepalive arrived for 30 seconds. | No. | | `1008` | `audio.session_limit`: the socket ran as long as [your plan](/docs/concepts/plans) lets one run. | Yes, on a new session. | | `1008` | `conflict.audio_source_streaming`: another socket took over this source. | Yes, on a new session, with backoff (see below). | | `1008` | `limit.transcription_minutes` or `limit.test_transcription_minutes`: the month's transcription minutes ran out before this socket metered any audio. | No. | | `1008` | A refusal, such as `conflict.conversation_ended` or a `limit.*` code: the turns heard could not be stored. | No. | | `1009` | `audio.frame_too_large`: a binary frame was over 64 KB. | No. Send smaller frames. | | `1011` | `bad_gateway.transcription`: the transcriber couldn't be reached. | Yes, on a new session, with backoff. | | `1011` | `internal.server_error`: the turns heard could not be stored. | No. | | `1013` | `audio.backpressure`: turns arrived faster than they could be stored. | Yes, on a new session, with backoff. | A connection that drops without a close frame (`1006` in a browser) is retryable too. ## Refusals Minting a session, and opening the socket, are refused with an HTTP status and an [error](/docs/api/errors) body. A browser can't read why a socket's handshake failed, so minting checks everything opening does, except the token: | Status | `code` | When | | ------------ | ---------------------------------- | --------------------------------------------------------------------------------------- | | `503` | `audio.not_configured` | This deployment transcribes no audio. Don't retry; [send turns](/docs/concepts/turns). | | `401` | `unauthorized.audio_token` | Opening only: the token is unknown, already used, or past `expires_at`. Mint a new one. | | `409` | `conflict.audio_source_streaming` | A socket is already streaming this source of the conversation. | | `409` | `conflict.conversation_ended` | The conversation has ended, or is an import still being processed. | | `400` | `validation.audio.*` | `source`, `encoding`, `sample_rate` or `language` isn't one Sparkle takes. | | `403` | `limit.transcription_minutes` | A live key on Free, after the month's 60 transcription minutes. | | `403` | `limit.test_transcription_minutes` | A test key or the dashboard, after the month's test transcription minutes. | | `403`, `429` | `limit.*` | A [plan limit](/docs/concepts/plans#at-a-limit), such as the month's minutes. | | `404` | `not_found.conversation` | The conversation doesn't exist, or belongs to another organization. | A socket holds its source while it streams, and a socket that drops without closing keeps holding it for up to 30 seconds. So a reconnect right after a drop can be refused with `conflict.audio_source_streaming` until then: retry it with backoff for about 35 seconds before giving up. ## Transcription minutes Every second of audio Sparkle's transcriber accepts counts toward the company's [transcription minutes](/docs/concepts/plans#how-transcription-is-metered), per socket: streaming a call's `local` and `remote` sources meters its length twice. Pro and Scale pay $0.012 per stream-minute on live keys, billed per second. Free includes 60 a month on live keys, and test keys have their own monthly allowance; past either, new sessions are refused with `limit.transcription_minutes` or `limit.test_transcription_minutes`. A socket that is already streaming is never cut off for transcription minutes. One that has not yet metered any audio when they run out closes with the code instead, as a new session would be refused. ## Limits * One connection per source per conversation. * A connection with neither audio nor keepalives for 30 seconds is closed. * A binary frame holds at most 64 KB. * One connection runs at most as long as your plan allows; continue on a new session after it. ## Example: stream a WAV file A Node 22 script, with no dependencies, that streams a 16-bit mono WAV file in real time and prints the turns. Convert other audio first, for example with `ffmpeg -i call.mp3 -ac 1 -ar 16000 -sample_fmt s16 call.wav`. ```js title="stream-wav.mjs" import { readFile } from "node:fs/promises"; import { setTimeout as sleep } from "node:timers/promises"; const [conversationId, path] = process.argv.slice(2); const wav = await readFile(path); // A WAV file is a list of chunks: "fmt " describes the audio, "data" holds it. let format; let pcm; for (let at = 12; at + 8 <= wav.length;) { const id = wav.toString("ascii", at, at + 4); const size = wav.readUInt32LE(at + 4); const body = wav.subarray(at + 8, at + 8 + size); if (id === "fmt ") { format = { pcm: body.readUInt16LE(0) === 1, channels: body.readUInt16LE(2), rate: body.readUInt32LE(4), bits: body.readUInt16LE(14), }; } if (id === "data") pcm = body; at += 8 + size + (size % 2); } if (!format?.pcm || format.channels !== 1 || format.bits !== 16 || !pcm) { throw new Error("Expected 16-bit mono PCM: convert it with ffmpeg first."); } const minted = await fetch( `https://api.sparkle.ai/public/v1/conversations/${conversationId}/audio-sessions`, { method: "POST", headers: { "X-API-Key": process.env.SPARKLE_API_KEY, "Idempotency-Key": crypto.randomUUID(), "Content-Type": "application/json", }, body: JSON.stringify({ source: "remote", encoding: "linear16", sample_rate: format.rate }), } ); if (!minted.ok) throw new Error(`audio session: ${minted.status} ${await minted.text()}`); const { url } = await minted.json(); const socket = new WebSocket(url); socket.addEventListener("message", async (event) => { const message = JSON.parse(event.data); switch (message.type) { case "ready": { const frame = (format.rate / 10) * 2; // 100 ms of 16-bit samples for (let at = 0; at < pcm.length; at += frame) { socket.send(pcm.subarray(at, at + frame)); await sleep(100); } socket.send(JSON.stringify({ type: "stop" })); break; } case "turn": { const { start_s, speaker, text } = message.turn; console.log(`[${start_s.toFixed(1)}s] ${speaker.key}: ${text}`); break; } case "error": console.error(message.code, message.message); break; case "closed": socket.close(); break; } }); ``` ```bash SPARKLE_API_KEY=spk_test_… node stream-wav.mjs cnv_2kd9c3f6j0m4q8u2y5bg call.wav ``` Source: https://docs.sparkle.ai/docs/api/audio-streaming.md --- # Get the authenticated principal `GET https://api.sparkle.ai/public/v1/me` Authenticate with your API key in the `X-API-Key` header. Returns the API key or personal access token the request used, with the company and organization it acts in. Useful to check that authentication works. ## Responses ### 200 OK `application/json`, AuthenticatedPrincipal: - `allowed_organization_ids` (string[]): Organizations the personal access token can reach - `email` (string): The personal access token's user email - `organization_id` (string): The request's organization - `principal_id` (string, required): The API key, or the token's user - `role` (string): The API key's role. One of: `owner`, `editor`, `viewer`. - `scopes` (string[]): The API key's scopes (resource:action); empty when the key acts with its whole role - `tenant_id` (string, required): The company - `type` (string, required): Credential type. One of: `api_key`, `personal_access_token`. - `user_id` (string): The personal access token's user Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/authentication/getMe.md --- # List connections `GET https://api.sparkle.ai/public/v1/connections` Authenticate with your API key in the `X-API-Key` header. Lists the organization's connections, newest first, with cursor pagination. ## Parameters - `cursor` (query): Opaque pagination cursor, from the previous response's page_info.end_cursor. - `limit` (query): Items per page, up to 100; more is 100. Absent, or less than 1, is 10. ## Responses ### 200 OK `application/json`, PageConnection: - `items` (Connection[], required) - `created_at` (string, required): When it was created - `environment` (string, required): The environment of the conversations its calls create: live ones bill, test ones count against the test minutes. One of: `test`, `live`. - `has_credentials` (boolean, required): Whether the vendor credentials are set, or for a webhook connection whether requests must be signed; they are never returned - `id` (string, required): Unique connection ID - `last_error_code` (string or null, required): Why the latest event was not taken; null once an event goes through. One of: `plan_limit`, `suspended`, `invalid_signature`, `failed`, `unrecognized_format`, `invalid_payload`, `reconnect_required`. - `last_event_at` (string or null, required): When a call's event last went through, to the minute; null before the first - `mode` (string or null, required): Webhook connections only: whether each request is a whole transcript or a batch of a live call's turns; null for other vendors. One of: `transcript`, `turns`. - `moment_types` (string[], required): The moment types its conversations detect; empty detects every type - `name` (string, required): A label for the connection - `organization_id` (string, required): The organization - `status` (string, required): active takes calls; disabled answers the vendor and drops them; disconnected is a Zoom connection whose grant was revoked. One of: `active`, `disabled`, `disconnected`. - `tenant_id` (string, required): The company - `updated_at` (string, required): When it was last changed - `vendor` (string, required): Where its calls come from. One of: `recall`, `deepgram`, `webhook`, `zoom`. - `page_info` (PageInfo, required) - `end_cursor` (string or null, required): Cursor for the next page. Pass it as the cursor parameter of the next request. - `has_next_page` (boolean, required): Whether there are more results after this page - `has_previous_page` (boolean, required): Whether there are results before this page - `start_cursor` (string or null, required): Cursor of the current page's first item - `total` (integer): Total of items matching the filters; only on the first page Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/connections/listConnections.md --- # List a connection's events `GET https://api.sparkle.ai/public/v1/connections/{id}/events` Authenticate with your API key in the `X-API-Key` header. Lists the latest 50 requests to the connection's URL that carried a call's turns or its end, newest first: each one's type, the vendor's call ID, its conversation and why it was refused. Never the transcript. Kept as long as Sparkle's inbound webhook log. ## Parameters - `id` (path, required): Connection ID ## Responses ### 200 OK `application/json`, ConnectionEventList: - `items` (ConnectionEvent[], required): Up to the latest 50, newest first - `conversation_id` (string or null, required): The conversation the call feeds; null when none was created - `error_code` (string or null, required): Why it was not taken; null when it went through. One of: `plan_limit`, `suspended`, `invalid_signature`, `failed`, `unrecognized_format`, `invalid_payload`, `reconnect_required`. - `event_type` (string, required): The vendor's event or message type - `external_ref` (string or null, required): The vendor's ID of the call: Recall's bot, Deepgram's request - `id` (string, required): Unique event ID - `received_at` (string, required): When it arrived Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/connections/listConnectionEvents.md --- # List a webhook connection's payloads `GET https://api.sparkle.ai/public/v1/connections/{id}/payloads` Authenticate with your API key in the `X-API-Key` header. Lists what a webhook connection kept of the requests to its URL in the last 24 hours, up to the latest 50, newest first: each one's format, call ID, turns, conversation and why it was refused, with the first 2 KB of its body. A request whose signature failed is never kept. ## Parameters - `id` (path, required): Connection ID ## Responses ### 200 OK `application/json`, ConnectionPayloadList: - `items` (ConnectionPayload[], required): Up to the latest 50 of the last 24 hours, newest first - `call_id` (string or null, required): The call ID the request named, by header or field, or the one Sparkle gave a whole transcript that named none; null when it was refused before a call was known - `connection_id` (string, required): The connection whose URL received it - `content_type` (string, required): The request's Content-Type, empty when none was sent - `conversation_id` (string or null, required): The conversation it fed; null when none took it - `ended` (boolean, required): Whether it ended its call - `error_code` (string or null, required): Why it was not taken; null when it went through. One of: `plan_limit`, `suspended`, `invalid_signature`, `failed`, `unrecognized_format`, `invalid_payload`, `reconnect_required`. - `format` (string or null, required): The format the body was read as; null when it was in none Sparkle reads. One of: `sparkle`, `json`, `vtt`, `srt`, `text`. - `id` (string, required): Unique payload ID, the same as its event's - `preview` (string, required): The start of the body, up to 2 KB, as text - `received_at` (string, required): When it arrived - `size_bytes` (integer, required): The body's size as it arrived - `truncated` (boolean, required): Whether the preview is shorter than the body - `turns` (integer, required): How many turns were read from it Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/connections/listConnectionPayloads.md --- # Create a connection `POST https://api.sparkle.ai/public/v1/connections` Authenticate with your API key in the `X-API-Key` header. Sets up a connection to a transcript vendor and returns its receiver URL, shown only in this response. Every call the vendor sends to the URL becomes a conversation of its own, in the connection's environment, and the vendor's end of the call ends it. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. ## Request body `application/json`, CreateConnectionRequest: - `credentials` (ConnectionCredentials): The vendor's credentials, kept in Vault and never returned - `verification_secret` (string): Recall.ai only: your workspace's verification secret (whsec_…), which signs the bot's real-time events and the dashboard's bot status webhooks - `environment` (string, required): The environment of the conversations its calls create: live ones bill, test ones count against the test minutes. One of: `test`, `live`. - `mode` (string): Webhook connections only, and required for them: transcript imports each request as a conversation of its own; turns appends each request to the live call its call ID names. One of: `transcript`, `turns`. - `moment_types` (string[]): The moment types its conversations detect; absent or empty detects every type - `name` (string, required): A label for the connection - `signed` (boolean): Webhook connections only: Sparkle generates a signing secret, shown once in the response, and refuses requests not signed with it - `vendor` (string, required): Where its calls come from. One of: `recall`, `deepgram`, `webhook`, `zoom`. ## Responses ### 201 Created `application/json`, CreatedConnection: - `created_at` (string, required): When it was created - `environment` (string, required): The environment of the conversations its calls create: live ones bill, test ones count against the test minutes. One of: `test`, `live`. - `has_credentials` (boolean, required): Whether the vendor credentials are set, or for a webhook connection whether requests must be signed; they are never returned - `id` (string, required): Unique connection ID - `last_error_code` (string or null, required): Why the latest event was not taken; null once an event goes through. One of: `plan_limit`, `suspended`, `invalid_signature`, `failed`, `unrecognized_format`, `invalid_payload`, `reconnect_required`. - `last_event_at` (string or null, required): When a call's event last went through, to the minute; null before the first - `mode` (string or null, required): Webhook connections only: whether each request is a whole transcript or a batch of a live call's turns; null for other vendors. One of: `transcript`, `turns`. - `moment_types` (string[], required): The moment types its conversations detect; empty detects every type - `name` (string, required): A label for the connection - `organization_id` (string, required): The organization - `receiver_url` (string): The URL to give the vendor. Its token is the connection's credential, shown only here. - `signing_secret` (string): A signed webhook connection's secret, shown only when it is created: sign each request's raw body with it in the Sparkle-Source-Signature header - `status` (string, required): active takes calls; disabled answers the vendor and drops them; disconnected is a Zoom connection whose grant was revoked. One of: `active`, `disabled`, `disconnected`. - `tenant_id` (string, required): The company - `updated_at` (string, required): When it was last changed - `vendor` (string, required): Where its calls come from. One of: `recall`, `deepgram`, `webhook`, `zoom`. Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/connections/createConnection.md --- # Get a connection `GET https://api.sparkle.ai/public/v1/connections/{id}` Authenticate with your API key in the `X-API-Key` header. Returns one connection, with when its last event went through and its last error. ## Parameters - `id` (path, required): Connection ID ## Responses ### 200 OK `application/json`, Connection: - `created_at` (string, required): When it was created - `environment` (string, required): The environment of the conversations its calls create: live ones bill, test ones count against the test minutes. One of: `test`, `live`. - `has_credentials` (boolean, required): Whether the vendor credentials are set, or for a webhook connection whether requests must be signed; they are never returned - `id` (string, required): Unique connection ID - `last_error_code` (string or null, required): Why the latest event was not taken; null once an event goes through. One of: `plan_limit`, `suspended`, `invalid_signature`, `failed`, `unrecognized_format`, `invalid_payload`, `reconnect_required`. - `last_event_at` (string or null, required): When a call's event last went through, to the minute; null before the first - `mode` (string or null, required): Webhook connections only: whether each request is a whole transcript or a batch of a live call's turns; null for other vendors. One of: `transcript`, `turns`. - `moment_types` (string[], required): The moment types its conversations detect; empty detects every type - `name` (string, required): A label for the connection - `organization_id` (string, required): The organization - `status` (string, required): active takes calls; disabled answers the vendor and drops them; disconnected is a Zoom connection whose grant was revoked. One of: `active`, `disabled`, `disconnected`. - `tenant_id` (string, required): The company - `updated_at` (string, required): When it was last changed - `vendor` (string, required): Where its calls come from. One of: `recall`, `deepgram`, `webhook`, `zoom`. Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/connections/getConnection.md --- # Update a connection `PATCH https://api.sparkle.ai/public/v1/connections/{id}` Authenticate with your API key in the `X-API-Key` header. Send only the fields to change. New credentials replace the stored ones, and an empty `credentials` object removes them. Moment types apply to the calls that start from then on. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Connection ID ## Request body `application/json`, UpdateConnectionRequest: - `credentials` (ConnectionCredentials): The vendor's credentials, replacing the stored ones; an empty object removes them, and for a webhook connection its signing secret, so its requests need no signature - `verification_secret` (string): Recall.ai only: your workspace's verification secret (whsec_…), which signs the bot's real-time events and the dashboard's bot status webhooks - `mode` (string): Webhook connections only: what each request carries from now on. One of: `transcript`, `turns`. - `moment_types` (string[]): The moment types the conversations it creates from now on detect; empty detects every type - `name` (string): A label for the connection - `status` (string): active takes calls; disabled answers the vendor and drops them. One of: `active`, `disabled`, `disconnected`. ## Responses ### 200 OK `application/json`, Connection: - `created_at` (string, required): When it was created - `environment` (string, required): The environment of the conversations its calls create: live ones bill, test ones count against the test minutes. One of: `test`, `live`. - `has_credentials` (boolean, required): Whether the vendor credentials are set, or for a webhook connection whether requests must be signed; they are never returned - `id` (string, required): Unique connection ID - `last_error_code` (string or null, required): Why the latest event was not taken; null once an event goes through. One of: `plan_limit`, `suspended`, `invalid_signature`, `failed`, `unrecognized_format`, `invalid_payload`, `reconnect_required`. - `last_event_at` (string or null, required): When a call's event last went through, to the minute; null before the first - `mode` (string or null, required): Webhook connections only: whether each request is a whole transcript or a batch of a live call's turns; null for other vendors. One of: `transcript`, `turns`. - `moment_types` (string[], required): The moment types its conversations detect; empty detects every type - `name` (string, required): A label for the connection - `organization_id` (string, required): The organization - `status` (string, required): active takes calls; disabled answers the vendor and drops them; disconnected is a Zoom connection whose grant was revoked. One of: `active`, `disabled`, `disconnected`. - `tenant_id` (string, required): The company - `updated_at` (string, required): When it was last changed - `vendor` (string, required): Where its calls come from. One of: `recall`, `deepgram`, `webhook`, `zoom`. Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/connections/updateConnection.md --- # Delete a connection `DELETE https://api.sparkle.ai/public/v1/connections/{id}` Authenticate with your API key in the `X-API-Key` header. Deletes the connection, its event log and its credentials. Its URL stops at once; the conversations its calls created stay. ## Parameters - `id` (path, required): Connection ID ## Responses ### 204 No Content Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/connections/deleteConnection.md --- # Re-run a webhook connection's payload `POST https://api.sparkle.ai/public/v1/connections/{id}/payloads/{payload_id}/rerun` Authenticate with your API key in the `X-API-Key` header. Runs a kept payload through the connection again, as if it had just arrived, and returns what came of it. A whole transcript whose call already has a conversation imports nothing again. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Connection ID - `payload_id` (path, required): Payload ID ## Responses ### 200 OK `application/json`, ConnectionTestResult: - `conversation_id` (string or null, required): The test call's conversation, a test one whatever the connection's environment; null when the call was refused - `error_code` (string or null, required): Why the test call was refused; null when it went through. One of: `plan_limit`, `suspended`, `invalid_signature`, `failed`, `unrecognized_format`, `invalid_payload`, `reconnect_required`. Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/connections/rerunConnectionPayload.md --- # Rotate the receiver URL `POST https://api.sparkle.ai/public/v1/connections/{id}/rotate-url` Authenticate with your API key in the `X-API-Key` header. Gives the connection a new receiver URL, shown only in this response. The old URL stops at once: update it in the vendor's settings before calls resume. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Connection ID ## Responses ### 200 OK `application/json`, CreatedConnection: - `created_at` (string, required): When it was created - `environment` (string, required): The environment of the conversations its calls create: live ones bill, test ones count against the test minutes. One of: `test`, `live`. - `has_credentials` (boolean, required): Whether the vendor credentials are set, or for a webhook connection whether requests must be signed; they are never returned - `id` (string, required): Unique connection ID - `last_error_code` (string or null, required): Why the latest event was not taken; null once an event goes through. One of: `plan_limit`, `suspended`, `invalid_signature`, `failed`, `unrecognized_format`, `invalid_payload`, `reconnect_required`. - `last_event_at` (string or null, required): When a call's event last went through, to the minute; null before the first - `mode` (string or null, required): Webhook connections only: whether each request is a whole transcript or a batch of a live call's turns; null for other vendors. One of: `transcript`, `turns`. - `moment_types` (string[], required): The moment types its conversations detect; empty detects every type - `name` (string, required): A label for the connection - `organization_id` (string, required): The organization - `receiver_url` (string): The URL to give the vendor. Its token is the connection's credential, shown only here. - `signing_secret` (string): A signed webhook connection's secret, shown only when it is created: sign each request's raw body with it in the Sparkle-Source-Signature header - `status` (string, required): active takes calls; disabled answers the vendor and drops them; disconnected is a Zoom connection whose grant was revoked. One of: `active`, `disabled`, `disconnected`. - `tenant_id` (string, required): The company - `updated_at` (string, required): When it was last changed - `vendor` (string, required): Where its calls come from. One of: `recall`, `deepgram`, `webhook`, `zoom`. Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/connections/rotateConnectionURL.md --- # Send a test call `POST https://api.sparkle.ai/public/v1/connections/{id}/test` Authenticate with your API key in the `X-API-Key` header. Sends a sample call of the connection's vendor through its receiver path, signed as the vendor signs it: one turn asking for work, then the call's end. The call becomes a test conversation, whatever the connection's environment, so its moments arrive as any call's do. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Connection ID ## Responses ### 200 OK `application/json`, ConnectionTestResult: - `conversation_id` (string or null, required): The test call's conversation, a test one whatever the connection's environment; null when the call was refused - `error_code` (string or null, required): Why the test call was refused; null when it went through. One of: `plan_limit`, `suspended`, `invalid_signature`, `failed`, `unrecognized_format`, `invalid_payload`, `reconnect_required`. Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/connections/testConnection.md --- # List conversations `GET https://api.sparkle.ai/public/v1/conversations` Authenticate with your API key in the `X-API-Key` header. Lists the organization's conversations, newest first, with cursor pagination. ## Parameters - `cursor` (query): Opaque pagination cursor, from the previous response's page_info.end_cursor. - `limit` (query): Items per page, up to 100; more is 100. Absent, or less than 1, is 10. ## Responses ### 200 OK `application/json`, PageConversationListItem: - `items` (ConversationListItem[], required) - `created_at` (string, required): When it was created - `ended_at` (string): When it was ended - `environment` (string, required): The environment of the API key that created it; test from the dashboard. One of: `test`, `live`. - `id` (string, required): Unique conversation ID - `metadata` (object, required): Your own data, returned as sent - `moment_types` (string[], required): The moment types it detects, built-in kinds and custom moments' names; empty detects every built-in kind and every live custom moment - `moments_by_kind` (object, required): Moments detected per kind, as moments_count counts them: a custom moment under its name; a kind with none is absent - `moments_count` (integer, required): Moments detected so far - `organization_id` (string, required): The organization - `origin` (string, required): How it was created: api with an API key or personal access token, playground from the dashboard, import from a whole transcript, connection by a connection's call. Audio streamed into it shows in usage.transcription_seconds. One of: `api`, `playground`, `import`, `connection`. - `progress` (ImportProgress): How far an imported transcript has been read; absent on a live conversation - `turns_done` (integer, required): Turns read through the gate so far - `turns_total` (integer, required): Turns the transcript was imported with - `started_at` (string, required): Time zero of the conversation's clock: turn times are seconds from it - `status` (string, required): live while it takes turns, processing while an imported transcript is read, ended once ended. One of: `live`, `processing`, `ended`. - `tenant_id` (string, required): The company - `title` (string, required): A label for the conversation log - `updated_at` (string, required): When it last changed - `usage` (ConversationUsage, required): What it has used so far of the month's minutes and transcription. A test conversation's usage counts against the test allowances and is never billed - `metered_seconds` (integer, required): Seconds it counts toward the month's minutes: the longest of its final turns' span, their words at 150 a minute, and the audio its longer stream sent, rounded up to the second - `transcription_seconds` (number, required): Seconds of audio Sparkle's audio API transcribed for it, each stream counted, to the fraction; 0 when its turns arrived as text - `webhook` (ConversationHook): Its own webhook, when created with a webhook_url - `id` (string, required): The subscription; its deliveries list at GET /webhooks/{id}/deliveries - `url` (string, required): Where the conversation's events are delivered - `page_info` (PageInfo, required) - `end_cursor` (string or null, required): Cursor for the next page. Pass it as the cursor parameter of the next request. - `has_next_page` (boolean, required): Whether there are more results after this page - `has_previous_page` (boolean, required): Whether there are results before this page - `start_cursor` (string or null, required): Cursor of the current page's first item - `total` (integer): Total of items matching the filters; only on the first page Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/conversations/listConversations.md --- # List webhook deliveries `GET https://api.sparkle.ai/public/v1/conversations/{id}/deliveries` Authenticate with your API key in the `X-API-Key` header. Lists the webhook deliveries of the conversation's events, newest first, with cursor pagination: to the organization's subscriptions and to its own webhook, each named by its subscription and the host of its URL. ## Parameters - `id` (path, required): Conversation ID - `cursor` (query): Opaque pagination cursor, from the previous response's page_info.end_cursor. - `limit` (query): Items per page, up to 100; more is 100. Absent, or less than 1, is 10. ## Responses ### 200 OK `application/json`, PageConversationDelivery: - `items` (ConversationDelivery[], required) - `attempt_count` (integer, required): Delivery attempts made - `completed_at` (string): When it succeeded or failed for good - `created_at` (string, required): When the delivery was created - `duration_ms` (integer): How long the last attempt took, in milliseconds - `event_type` (string, required): The event type. One of: `moment.detected`, `conversation.created`, `conversation.ended`, `conversation.deleted`, `webhook.ping`. - `http_status` (integer): HTTP status the endpoint answered the last attempt with, when there was one - `id` (string, required): Unique delivery ID - `next_retry_at` (string): When the next attempt runs, if any - `payload` (object, required): The payload sent - `replay_of` (string): The delivery this one replays, while that delivery is kept - `response_body` (string): Body the endpoint answered with, or why the last attempt failed - `status` (string, required): Delivery status. One of: `pending`, `success`, `failed`, `skipped`. - `subscription_id` (string, required): The webhook subscription - `url_host` (string, required): Host of the subscription's URL, with its port when it names one - `page_info` (PageInfo, required) - `end_cursor` (string or null, required): Cursor for the next page. Pass it as the cursor parameter of the next request. - `has_next_page` (boolean, required): Whether there are more results after this page - `has_previous_page` (boolean, required): Whether there are results before this page - `start_cursor` (string or null, required): Cursor of the current page's first item - `total` (integer): Total of items matching the filters; only on the first page Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/conversations/listConversationDeliveries.md --- # List moments `GET https://api.sparkle.ai/public/v1/conversations/{id}/moments` Authenticate with your API key in the `X-API-Key` header. Lists the conversation's moments in the order they were let go, with cursor pagination. ## Parameters - `id` (path, required): Conversation ID - `cursor` (query): Opaque pagination cursor, from the previous response's page_info.end_cursor. - `limit` (query): Items per page, up to 100; more is 100. Absent, or less than 1, is 10. ## Responses ### 200 OK `application/json`, PageMoment: - `items` (Moment[], required) - `at` (number, required): When that turn ended, in seconds from the conversation's started_at, as a turn's start and end are - `classifier` (string, required): The classifier that read the turn - `confidence` (number, required): The classifier's probability for the moment, 0 to 1 - `conversation_id` (string, required): The conversation - `created_at` (string, required): When it was recorded - `definition` (MomentDefinitionRef or null, required): The custom moment type it was detected as; null for a built-in kind - `color` (string, required): The custom moment's color when it detected the moment. One of: `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink`, `gray`. - `id` (string, required): The custom moment type - `label` (string, required): The custom moment's display name when it detected the moment - `version` (integer, required): The version of it that detected the moment - `id` (string, required): Unique moment ID - `kind` (string, required): What happened: a built-in kind, or the name of the custom moment it was detected as - `object` (string, required): Always moment. One of: `moment`. - `settled_ms` (integer, required): How long after the turn ended the moment was let go, in conversation time - `speaker` (MomentSpeaker, required): Who said it - `key` (string, required): The speaker key the turn was sent with - `name` (string or null, required): The name the turn was sent with; null when none was - `text` (string, required): The turn that set it off, consecutive turns of one speaker merged - `title` (string or null, required): A short line saying what happened, after who said it: Dana · Ship the SSO fix by Friday. Null when no title was written in time - `turn_ids` (string[], required): The ids your turns were sent with, of the turns the text was merged from - `page_info` (PageInfo, required) - `end_cursor` (string or null, required): Cursor for the next page. Pass it as the cursor parameter of the next request. - `has_next_page` (boolean, required): Whether there are more results after this page - `has_previous_page` (boolean, required): Whether there are results before this page - `start_cursor` (string or null, required): Cursor of the current page's first item - `total` (integer): Total of items matching the filters; only on the first page Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/conversations/listConversationMoments.md --- # List turns `GET https://api.sparkle.ai/public/v1/conversations/{id}/turns` Authenticate with your API key in the `X-API-Key` header. Lists the conversation's stored turns, partial ones included, in start order. ## Parameters - `id` (path, required): Conversation ID - `cursor` (query): Opaque pagination cursor, from the previous response's page_info.end_cursor. - `limit` (query): Items per page, up to 100; more is 100. Absent, or less than 1, is 10. ## Responses ### 200 OK `application/json`, PageTurn: - `items` (Turn[], required) - `channel` (string, required): mic or remote. One of: `mic`, `remote`. - `client_turn_id` (string, required): The ID the source sent it with - `conversation_id` (string, required): The conversation - `created_at` (string, required): When it was first stored - `end_s` (number, required): Seconds from the source's started_at when it ended - `final` (boolean, required): Whether it is finished; only final turns reach the gate - `id` (string, required): Unique turn ID; moments name the turns they read by it - `revision` (integer, required): 1, plus one for each time it was replaced - `source_id` (string, required): The source that sent it - `source_kind` (string, required): What kind of source sent it. One of: `turns`, `recall`, `deepgram`, `webhook`, `zoom`. - `speaker_key` (string, required): The speaker key it was sent with - `speaker_name` (string, required): The speaker's name, empty when not sent - `start_s` (number, required): Seconds from the source's started_at when it began - `text` (string, required): What was said - `updated_at` (string, required): When it was last replaced - `page_info` (PageInfo, required) - `end_cursor` (string or null, required): Cursor for the next page. Pass it as the cursor parameter of the next request. - `has_next_page` (boolean, required): Whether there are more results after this page - `has_previous_page` (boolean, required): Whether there are results before this page - `start_cursor` (string or null, required): Cursor of the current page's first item - `total` (integer): Total of items matching the filters; only on the first page Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/conversations/listConversationTurns.md --- # Create a conversation `POST https://api.sparkle.ai/public/v1/conversations` Authenticate with your API key in the `X-API-Key` header. Starts a conversation that takes turns at once, in the environment of the API key. Each vendor named in receivers gets a receiver path, shown only in this response. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. ## Request body `application/json`, CreateConversationRequest: - `metadata` (object): Your own data, returned as sent; up to 16 KB as JSON - `moment_types` (string[]): The moment types to detect; absent or empty detects every type - `receivers` (string[]): Vendors that will post the transcript (recall, deepgram); each gets a receiver path in the response - `started_at` (string): Time zero of the conversation's clock, which turn times count from; now when absent - `title` (string): A label for the conversation log - `webhook_url` (string): An https URL that receives this conversation's events, signed with a secret shown once in the response. http is accepted for localhost only. ## Responses ### 201 Created `application/json`, CreatedConversation: - `conversation` (Conversation or null, required) - `created_at` (string, required): When it was created - `ended_at` (string): When it was ended - `environment` (string, required): The environment of the API key that created it; test from the dashboard. One of: `test`, `live`. - `id` (string, required): Unique conversation ID - `metadata` (object, required): Your own data, returned as sent - `moment_types` (string[], required): The moment types it detects, built-in kinds and custom moments' names; empty detects every built-in kind and every live custom moment - `moments_count` (integer, required): Moments detected so far - `organization_id` (string, required): The organization - `origin` (string, required): How it was created: api with an API key or personal access token, playground from the dashboard, import from a whole transcript, connection by a connection's call. Audio streamed into it shows in usage.transcription_seconds. One of: `api`, `playground`, `import`, `connection`. - `progress` (ImportProgress): How far an imported transcript has been read; absent on a live conversation - `turns_done` (integer, required): Turns read through the gate so far - `turns_total` (integer, required): Turns the transcript was imported with - `started_at` (string, required): Time zero of the conversation's clock: turn times are seconds from it - `status` (string, required): live while it takes turns, processing while an imported transcript is read, ended once ended. One of: `live`, `processing`, `ended`. - `tenant_id` (string, required): The company - `title` (string, required): A label for the conversation log - `updated_at` (string, required): When it last changed - `usage` (ConversationUsage, required): What it has used so far of the month's minutes and transcription. A test conversation's usage counts against the test allowances and is never billed - `metered_seconds` (integer, required): Seconds it counts toward the month's minutes: the longest of its final turns' span, their words at 150 a minute, and the audio its longer stream sent, rounded up to the second - `transcription_seconds` (number, required): Seconds of audio Sparkle's audio API transcribed for it, each stream counted, to the fraction; 0 when its turns arrived as text - `webhook` (ConversationHook): Its own webhook, when created with a webhook_url - `id` (string, required): The subscription; its deliveries list at GET /webhooks/{id}/deliveries - `url` (string, required): Where the conversation's events are delivered - `receivers` (ConversationReceiver[], required): One per vendor named in receivers - `kind` (string, required): The vendor. One of: `turns`, `recall`, `deepgram`, `webhook`, `zoom`. - `path` (string): Path under the API's origin to give the vendor. It carries the receiver's token and is shown only here. - `webhook` (ConversationCreatedWebhook): The conversation's own webhook, when created with a webhook_url - `id` (string, required): The subscription; its deliveries list at GET /webhooks/{id}/deliveries - `secret` (string): Signs each delivery as a subscription's secret does. Shown only here. - `url` (string, required): Where the conversation's events are delivered Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/conversations/createConversation.md --- # Create an audio session `POST https://api.sparkle.ai/public/v1/conversations/{id}/audio-sessions` Authenticate with your API key in the `X-API-Key` header. Grants a WebSocket that streams one source of the conversation's audio, local for the microphone or remote for everyone else, to be transcribed into its turns. Hand url to the browser that captures the audio: it opens the socket once, within a minute, with no API key. One socket streams each source at a time. No audio is stored. Each stream's audio counts toward the month's transcription minutes, so a microphone and a tab count twice. Once the plan's allowance for the key's environment is used, a new session is refused with limit.transcription_minutes or limit.test_transcription_minutes; a socket already streaming runs on. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Conversation ID ## Request body `application/json`, AudioCreateSessionRequest: - `encoding` (string, required): How the binary frames encode audio: linear16 is raw 16-bit little-endian PCM, mono. One of: `linear16`. - `language` (string): The language spoken, a language code such as en or pt-BR, or multi to detect it; en when left out - `sample_rate` (integer, required): The audio's samples per second. One of: `16000`, `24000`, `44100`, `48000`. - `source` (string, required): local for the capturing person's microphone, remote for everyone else. One of: `local`, `remote`. ## Responses ### 201 Created `application/json`, AudioCreatedSession: - `expires_at` (string, required): When the token stops opening a socket; a socket opened before then runs on - `token` (string): Opens one socket, once, until expires_at; it is already in url - `url` (string): The socket to open, with the token in its query; give it to the browser as is Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/conversations/createAudioSession.md --- # Get a conversation `GET https://api.sparkle.ai/public/v1/conversations/{id}` Authenticate with your API key in the `X-API-Key` header. Returns one conversation. ## Parameters - `id` (path, required): Conversation ID ## Responses ### 200 OK `application/json`, Conversation: - `created_at` (string, required): When it was created - `ended_at` (string): When it was ended - `environment` (string, required): The environment of the API key that created it; test from the dashboard. One of: `test`, `live`. - `id` (string, required): Unique conversation ID - `metadata` (object, required): Your own data, returned as sent - `moment_types` (string[], required): The moment types it detects, built-in kinds and custom moments' names; empty detects every built-in kind and every live custom moment - `moments_count` (integer, required): Moments detected so far - `organization_id` (string, required): The organization - `origin` (string, required): How it was created: api with an API key or personal access token, playground from the dashboard, import from a whole transcript, connection by a connection's call. Audio streamed into it shows in usage.transcription_seconds. One of: `api`, `playground`, `import`, `connection`. - `progress` (ImportProgress): How far an imported transcript has been read; absent on a live conversation - `turns_done` (integer, required): Turns read through the gate so far - `turns_total` (integer, required): Turns the transcript was imported with - `started_at` (string, required): Time zero of the conversation's clock: turn times are seconds from it - `status` (string, required): live while it takes turns, processing while an imported transcript is read, ended once ended. One of: `live`, `processing`, `ended`. - `tenant_id` (string, required): The company - `title` (string, required): A label for the conversation log - `updated_at` (string, required): When it last changed - `usage` (ConversationUsage, required): What it has used so far of the month's minutes and transcription. A test conversation's usage counts against the test allowances and is never billed - `metered_seconds` (integer, required): Seconds it counts toward the month's minutes: the longest of its final turns' span, their words at 150 a minute, and the audio its longer stream sent, rounded up to the second - `transcription_seconds` (number, required): Seconds of audio Sparkle's audio API transcribed for it, each stream counted, to the fraction; 0 when its turns arrived as text - `webhook` (ConversationHook): Its own webhook, when created with a webhook_url - `id` (string, required): The subscription; its deliveries list at GET /webhooks/{id}/deliveries - `url` (string, required): Where the conversation's events are delivered Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/conversations/getConversation.md --- # Delete a conversation `DELETE https://api.sparkle.ai/public/v1/conversations/{id}` Authenticate with your API key in the `X-API-Key` header. Erases the conversation with its turns, its moments and the webhook deliveries that carry them. ## Parameters - `id` (path, required): Conversation ID ## Responses ### 204 No Content Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/conversations/deleteConversation.md --- # Import a finished transcript `POST https://api.sparkle.ai/public/v1/conversations/import` Authenticate with your API key in the `X-API-Key` header. Creates a conversation, in the environment of the API key, from a whole transcript and runs it through the same gate as a live one, on the transcript's own clock, settle windows and all. It answers at once with the conversation processing; its moments arrive on the stream and the webhooks as they are let go, progress counts the turns read, and the conversation ends by itself, conversation.ended last. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. ## Request body `application/json`, ImportConversationRequest: - `metadata` (object): Your own data, returned as sent; up to 16 KB as JSON - `moment_types` (string[]): The moment types to detect; absent or empty detects every type - `title` (string): A label for the conversation log - `turns` (ConversationTurnRequest[], required): The whole transcript, up to 5,000 turns in any order, times in seconds from its start. Only final turns are read. - `channel` (string, required): mic for whoever runs the capture, remote for everyone else. One of: `mic`, `remote`. - `end` (number, required): Seconds from the conversation's started_at when the turn ended - `final` (boolean, required): Whether the turn is finished. Only final turns reach the gate; a partial turn waits until its final version replaces it. - `id` (string, required): Your ID for the turn; sending it again replaces the turn - `name` (string): The speaker's name, when known - `speaker` (string, required): A stable key for who is speaking: the same key is the same person - `start` (number, required): Seconds from the conversation's started_at when the turn began - `text` (string, required): What was said - `webhook_url` (string): An https URL that receives this conversation's events, signed with a secret shown once in the response. http is accepted for localhost only. ## Responses ### 202 Accepted `application/json`, ImportedConversation: - `conversation` (Conversation or null, required) - `created_at` (string, required): When it was created - `ended_at` (string): When it was ended - `environment` (string, required): The environment of the API key that created it; test from the dashboard. One of: `test`, `live`. - `id` (string, required): Unique conversation ID - `metadata` (object, required): Your own data, returned as sent - `moment_types` (string[], required): The moment types it detects, built-in kinds and custom moments' names; empty detects every built-in kind and every live custom moment - `moments_count` (integer, required): Moments detected so far - `organization_id` (string, required): The organization - `origin` (string, required): How it was created: api with an API key or personal access token, playground from the dashboard, import from a whole transcript, connection by a connection's call. Audio streamed into it shows in usage.transcription_seconds. One of: `api`, `playground`, `import`, `connection`. - `progress` (ImportProgress): How far an imported transcript has been read; absent on a live conversation - `turns_done` (integer, required): Turns read through the gate so far - `turns_total` (integer, required): Turns the transcript was imported with - `started_at` (string, required): Time zero of the conversation's clock: turn times are seconds from it - `status` (string, required): live while it takes turns, processing while an imported transcript is read, ended once ended. One of: `live`, `processing`, `ended`. - `tenant_id` (string, required): The company - `title` (string, required): A label for the conversation log - `updated_at` (string, required): When it last changed - `usage` (ConversationUsage, required): What it has used so far of the month's minutes and transcription. A test conversation's usage counts against the test allowances and is never billed - `metered_seconds` (integer, required): Seconds it counts toward the month's minutes: the longest of its final turns' span, their words at 150 a minute, and the audio its longer stream sent, rounded up to the second - `transcription_seconds` (number, required): Seconds of audio Sparkle's audio API transcribed for it, each stream counted, to the fraction; 0 when its turns arrived as text - `webhook` (ConversationHook): Its own webhook, when created with a webhook_url - `id` (string, required): The subscription; its deliveries list at GET /webhooks/{id}/deliveries - `url` (string, required): Where the conversation's events are delivered - `webhook` (ConversationCreatedWebhook): The conversation's own webhook, when imported with a webhook_url - `id` (string, required): The subscription; its deliveries list at GET /webhooks/{id}/deliveries - `secret` (string): Signs each delivery as a subscription's secret does. Shown only here. - `url` (string, required): Where the conversation's events are delivered Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/conversations/importConversation.md --- # End a conversation `POST https://api.sparkle.ai/public/v1/conversations/{id}/end` Authenticate with your API key in the `X-API-Key` header. Stops the conversation taking turns and lets every pending moment go after the turns already sent. Those moments arrive on the stream and the webhooks within seconds. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Conversation ID ## Responses ### 200 OK `application/json`, Conversation: - `created_at` (string, required): When it was created - `ended_at` (string): When it was ended - `environment` (string, required): The environment of the API key that created it; test from the dashboard. One of: `test`, `live`. - `id` (string, required): Unique conversation ID - `metadata` (object, required): Your own data, returned as sent - `moment_types` (string[], required): The moment types it detects, built-in kinds and custom moments' names; empty detects every built-in kind and every live custom moment - `moments_count` (integer, required): Moments detected so far - `organization_id` (string, required): The organization - `origin` (string, required): How it was created: api with an API key or personal access token, playground from the dashboard, import from a whole transcript, connection by a connection's call. Audio streamed into it shows in usage.transcription_seconds. One of: `api`, `playground`, `import`, `connection`. - `progress` (ImportProgress): How far an imported transcript has been read; absent on a live conversation - `turns_done` (integer, required): Turns read through the gate so far - `turns_total` (integer, required): Turns the transcript was imported with - `started_at` (string, required): Time zero of the conversation's clock: turn times are seconds from it - `status` (string, required): live while it takes turns, processing while an imported transcript is read, ended once ended. One of: `live`, `processing`, `ended`. - `tenant_id` (string, required): The company - `title` (string, required): A label for the conversation log - `updated_at` (string, required): When it last changed - `usage` (ConversationUsage, required): What it has used so far of the month's minutes and transcription. A test conversation's usage counts against the test allowances and is never billed - `metered_seconds` (integer, required): Seconds it counts toward the month's minutes: the longest of its final turns' span, their words at 150 a minute, and the audio its longer stream sent, rounded up to the second - `transcription_seconds` (number, required): Seconds of audio Sparkle's audio API transcribed for it, each stream counted, to the fraction; 0 when its turns arrived as text - `webhook` (ConversationHook): Its own webhook, when created with a webhook_url - `id` (string, required): The subscription; its deliveries list at GET /webhooks/{id}/deliveries - `url` (string, required): Where the conversation's events are delivered Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/conversations/endConversation.md --- # Follow moments in real time `GET https://api.sparkle.ai/public/v1/conversations/{id}/stream` Authenticate with your API key in the `X-API-Key` header. Sends the conversation's moments as server-sent events, those already let go first, then conversation.ended once the ended conversation's last moment has gone. Each event's id resumes the stream after it when sent back as Last-Event-ID. ## Parameters - `id` (path, required): Conversation ID - `Last-Event-Id` (header): The id of the last event received, to resume after it ## Responses ### 200 OK `text/event-stream`, object or object[]: - Variant 1: - `data` (ConversationEndedEvent, required) - `created_at` (string, required): When the event happened, to the second - `data` (ConversationEnded, required): The ended conversation and what it produced - `conversation` (Conversation, required): The ended conversation - `reason` (string, required): Why it ended: requested by POST /conversations/{id}/end, the dashboard, or the vendor ending a connection's call; idle when no turn arrived for an hour and no audio socket was open; completed when an imported transcript was read to its end; failed when an imported transcript could not be read to its end, as when its turns were no longer stored. Treat a value you don't know as requested. One of: `requested`, `idle`, `completed`, `failed`. - `summary` (ConversationSummary, required): What the conversation produced - `id` (string, required): The event, the same on every retry and replay: use it to drop repeats - `livemode` (boolean, required): Whether the event belongs to the live environment: true when the conversation it is about is live, or the ping's subscription is - `object` (string, required): Always event. One of: `event`. - `type` (string, required): The event type, which the Sparkle-Event header repeats. One of: `conversation.ended`. - `event` ("conversation.ended", required) - Variant 2: - `data` (MomentDetectedEvent, required) - `created_at` (string, required): When the event happened, to the second - `data` (Moment, required): The moment - `at` (number, required): When that turn ended, in seconds from the conversation's started_at, as a turn's start and end are - `classifier` (string, required): The classifier that read the turn - `confidence` (number, required): The classifier's probability for the moment, 0 to 1 - `conversation_id` (string, required): The conversation - `created_at` (string, required): When it was recorded - `definition` (MomentDefinitionRef or null, required): The custom moment type it was detected as; null for a built-in kind - `id` (string, required): Unique moment ID - `kind` (string, required): What happened: a built-in kind, or the name of the custom moment it was detected as - `object` (string, required): Always moment. One of: `moment`. - `settled_ms` (integer, required): How long after the turn ended the moment was let go, in conversation time - `speaker` (MomentSpeaker, required): Who said it - `text` (string, required): The turn that set it off, consecutive turns of one speaker merged - `title` (string or null, required): A short line saying what happened, after who said it: Dana · Ship the SSO fix by Friday. Null when no title was written in time - `turn_ids` (string[], required): The ids your turns were sent with, of the turns the text was merged from - `id` (string, required): The event, the same on every retry and replay: use it to drop repeats - `livemode` (boolean, required): Whether the event belongs to the live environment: true when the conversation it is about is live, or the ping's subscription is - `object` (string, required): Always event. One of: `event`. - `type` (string, required): The event type, which the Sparkle-Event header repeats. One of: `moment.detected`. - `event` ("moment.detected", required) Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/conversations/openConversationStream.md --- # Add turns `POST https://api.sparkle.ai/public/v1/conversations/{id}/turns` Authenticate with your API key in the `X-API-Key` header. Stores a batch of turns. A turn sent again under the same id replaces it; only final turns reach the gate, the first time each is final, so repeating a batch is safe. Turns in a batch go to the gate in start order; batches go in the order they arrive. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Conversation ID ## Request body `application/json`, ConversationAppendTurnsRequest: - `turns` (ConversationTurnRequest[], required): Up to 500 turns, in any order - `channel` (string, required): mic for whoever runs the capture, remote for everyone else. One of: `mic`, `remote`. - `end` (number, required): Seconds from the conversation's started_at when the turn ended - `final` (boolean, required): Whether the turn is finished. Only final turns reach the gate; a partial turn waits until its final version replaces it. - `id` (string, required): Your ID for the turn; sending it again replaces the turn - `name` (string): The speaker's name, when known - `speaker` (string, required): A stable key for who is speaking: the same key is the same person - `start` (number, required): Seconds from the conversation's started_at when the turn began - `text` (string, required): What was said ## Responses ### 202 Accepted Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/conversations/addConversationTurns.md --- # List custom moments `GET https://api.sparkle.ai/public/v1/moments` Authenticate with your API key in the `X-API-Key` header. Lists the organization's custom moments, newest first, with cursor pagination. ## Parameters - `cursor` (query): Opaque pagination cursor, from the previous response's page_info.end_cursor. - `limit` (query): Items per page, up to 100; more is 100. Absent, or less than 1, is 10. ## Responses ### 200 OK `application/json`, PageCustomMoment: - `items` (CustomMoment[], required) - `color` (string, required): The color it is shown in, one of the dashboard's label colors. Presentation only: changing it makes no new version. One of: `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink`, `gray`. - `created_at` (string, required): When it was created - `examples` (MomentExamples, required): Lines it should and should not fire on - `fire` (string[], required): Lines it should fire on - `skip` (string[], required): Lines it should not fire on - `id` (string, required): Unique custom moment ID - `label` (string, required): Its display name, up to 60 characters. Presentation only: changing it makes no new version. - `live_version` (integer or null, required): The version live conversations run while status is live; null until it first goes live. An edit leaves it running until the new version is promoted - `min_confidence` (number, required): The classifier's probability a turn needs to fire it, above 0 and up to 1 - `name` (string, required): The kind its moments carry: snake_case and unique in the organization. Fixed once created. - `not_when` (string, required): When it does not fire, though it might look like it should - `shadow_version` (integer or null, required): The version running in shadow beside live_version, its fires stored but never sent; null when none - `status` (string, required): draft until first made live; live runs live_version on every conversation that detects it; disabled stops it. One of: `draft`, `live`, `disabled`. - `timing` (string, required): act waits for the exchange to land, answer goes while a question still hangs, ideas lets one fire serve a brainstorm. One of: `act`, `answer`, `ideas`. - `updated_at` (string, required): When it last changed - `version` (integer, required): The newest version, whose wording this is: 1, plus one for each edit to its wording, examples, timing or bar made once it has a live_version - `when` (string, required): When it fires, in plain English - `page_info` (PageInfo, required) - `end_cursor` (string or null, required): Cursor for the next page. Pass it as the cursor parameter of the next request. - `has_next_page` (boolean, required): Whether there are more results after this page - `has_previous_page` (boolean, required): Whether there are results before this page - `start_cursor` (string or null, required): Cursor of the current page's first item - `total` (integer): Total of items matching the filters; only on the first page Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/listCustomMoments.md --- # List custom moment templates `GET https://api.sparkle.ai/public/v1/moments/templates` Authenticate with your API key in the `X-API-Key` header. Lists the ready-made custom moments, each with the organization's own custom moment of its name once it has one. ## Responses ### 200 OK `application/json`, CustomMomentTemplate[]: - `color` (string, required): The color the custom moment it creates starts with. One of: `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink`, `gray`. - `custom_moment_id` (string or null, required): The organization's custom moment of this name; null until it has one - `examples` (MomentExamples, required): Lines it should and should not fire on - `fire` (string[], required): Lines it should fire on - `skip` (string[], required): Lines it should not fire on - `label` (string, required): The display name the custom moment it creates starts with - `min_confidence` (number, required): The classifier's probability a turn needs to fire it - `name` (string, required): The template's key, and the name of the custom moment it creates - `not_when` (string, required): When it does not fire - `status` (string or null, required): That custom moment's status; null until it has one. One of: `draft`, `live`, `disabled`. - `timing` (string, required): Its timing profile. One of: `act`, `answer`, `ideas`. - `when` (string, required): When it fires Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/listCustomMomentTemplates.md --- # List a custom moment's fires `GET https://api.sparkle.ai/public/v1/moments/{id}/fires` Authenticate with your API key in the `X-API-Key` header. Lists the moments the custom moment detected across the organization's conversations, newest first, with cursor pagination: since since, the last week by default, and of one version with version. Moments a version running in shadow detected are left out unless include_shadow is true, so with the same window and no include_shadow the list holds as many moments as the versions' fires less their shadow_fires. ## Parameters - `id` (path, required): Custom moment ID - `cursor` (query): Opaque pagination cursor, from the previous response's page_info.end_cursor. - `limit` (query): Items per page, up to 100; more is 100. Absent, or less than 1, is 10. - `since` (query): List moments recorded from this time on; a week ago when absent - `version` (query): Only the moments this version detected - `include_shadow` (query): Also list the moments a version running in shadow detected, marked by shadow ## Responses ### 200 OK `application/json`, PageCustomMomentFireItem: - `items` (CustomMomentFireItem[], required) - `at` (number, required): When the turn ended, in seconds from the conversation's started_at - `confidence` (number, required): The classifier's probability for it, 0 to 1 - `conversation_id` (string, required): The conversation - `conversation_title` (string, required): The conversation's title - `created_at` (string, required): When it was recorded - `moment_id` (string, required): The moment - `shadow` (boolean, required): Whether a version running in shadow detected it, so it was stored and never sent - `speaker` (MomentSpeaker, required): Who said it - `key` (string, required): The speaker key the turn was sent with - `name` (string or null, required): The name the turn was sent with; null when none was - `text` (string, required): What it read, consecutive turns of one speaker merged - `title` (string or null, required): A short line saying what happened, after who said it; null when no title was written in time - `turn_ids` (string[], required): Your ids of the turns it read - `version` (integer, required): The version that detected it - `page_info` (PageInfo, required) - `end_cursor` (string or null, required): Cursor for the next page. Pass it as the cursor parameter of the next request. - `has_next_page` (boolean, required): Whether there are more results after this page - `has_previous_page` (boolean, required): Whether there are results before this page - `start_cursor` (string or null, required): Cursor of the current page's first item - `total` (integer): Total of items matching the filters; only on the first page Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/listCustomMomentFires.md --- # List a custom moment's versions `GET https://api.sparkle.ai/public/v1/moments/{id}/versions` Authenticate with your API key in the `X-API-Key` header. Lists every version with how many moments each detected since since, the last week by default. While a version runs in shadow, compares it with the live version on the same conversations: the turns both fired on, only the live one, and only the shadow. ## Parameters - `id` (path, required): Custom moment ID - `since` (query): Count moments from this time on; a week ago when absent ## Responses ### 200 OK `application/json`, CustomMomentVersions: - `comparison` (CustomMomentComparison or null, required): The shadow version against the live one since the shadow started; null with no shadow - `both` (CustomMomentFireRef[], required): Turns both versions fired on - `at` (number, required): When the turn ended, in seconds from the conversation's started_at - `conversation_id` (string, required): The conversation - `text` (string, required): What it read - `turn_ids` (string[], required): Your ids of the turns it read - `live_version` (integer, required): The live version - `only_live` (CustomMomentFireRef[], required): Turns only the live version fired on - `at` (number, required): When the turn ended, in seconds from the conversation's started_at - `conversation_id` (string, required): The conversation - `text` (string, required): What it read - `turn_ids` (string[], required): Your ids of the turns it read - `only_shadow` (CustomMomentFireRef[], required): Turns only the shadow version fired on - `at` (number, required): When the turn ended, in seconds from the conversation's started_at - `conversation_id` (string, required): The conversation - `text` (string, required): What it read - `turn_ids` (string[], required): Your ids of the turns it read - `shadow_version` (integer, required): The shadow version - `since` (string, required): Where the window starts: when the shadow started, or the since asked for if later - `versions` (CustomMomentVersion[], required): Every version, newest first - `created_at` (string, required): When it was written - `examples` (MomentExamples, required): Lines it should and should not fire on - `fire` (string[], required): Lines it should fire on - `skip` (string[], required): Lines it should not fire on - `fires` (integer, required): Moments it detected in the window, sent or in shadow - `min_confidence` (number, required): The classifier's probability a turn needs to fire it - `not_when` (string, required): When it does not fire - `shadow_fires` (integer, required): Of fires, those detected in shadow and never sent. fires less shadow_fires is what the fires list returns for the version and window without include_shadow - `status` (string, required): draft until it runs, live, shadow, or archived once a promotion replaced it. One of: `draft`, `live`, `shadow`, `archived`. - `timing` (string, required): Its timing profile. One of: `act`, `answer`, `ideas`. - `version` (integer, required): The version - `when` (string, required): When it fires Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/listCustomMomentVersions.md --- # Define a custom moment `POST https://api.sparkle.ai/public/v1/moments` Authenticate with your API key in the `X-API-Key` header. Defines a moment type in plain English. It starts as a draft at version 1, edited in place until it first goes live; make it live with an update. Its name is the kind its moments carry. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. ## Request body `application/json`, CreateCustomMomentRequest: - `color` (string): The color it is shown in; picked from the name when absent. One of: `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink`, `gray`. - `examples` (CustomMomentExamplesInput): Up to 10 lines each it should and should not fire on - `fire` (string[]): Lines it should fire on - `skip` (string[]): Lines it should not fire on - `label` (string): Its display name; the name in words when absent (pricing_objection is Pricing objection) - `min_confidence` (number): The classifier's probability a turn needs to fire it, above 0 and up to 1; 0.5 when absent - `name` (string, required): The kind its moments will carry: snake_case, unique in the organization, and not a built-in kind. Fixed once created. - `not_when` (string): When it does not fire, though it might look like it should - `timing` (string): act (the default) waits for the exchange to land, answer goes while a question still hangs, ideas lets one fire serve a brainstorm. One of: `act`, `answer`, `ideas`. - `when` (string, required): When it fires, in plain English ## Responses ### 201 Created `application/json`, CustomMoment: - `color` (string, required): The color it is shown in, one of the dashboard's label colors. Presentation only: changing it makes no new version. One of: `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink`, `gray`. - `created_at` (string, required): When it was created - `examples` (MomentExamples, required): Lines it should and should not fire on - `fire` (string[], required): Lines it should fire on - `skip` (string[], required): Lines it should not fire on - `id` (string, required): Unique custom moment ID - `label` (string, required): Its display name, up to 60 characters. Presentation only: changing it makes no new version. - `live_version` (integer or null, required): The version live conversations run while status is live; null until it first goes live. An edit leaves it running until the new version is promoted - `min_confidence` (number, required): The classifier's probability a turn needs to fire it, above 0 and up to 1 - `name` (string, required): The kind its moments carry: snake_case and unique in the organization. Fixed once created. - `not_when` (string, required): When it does not fire, though it might look like it should - `shadow_version` (integer or null, required): The version running in shadow beside live_version, its fires stored but never sent; null when none - `status` (string, required): draft until first made live; live runs live_version on every conversation that detects it; disabled stops it. One of: `draft`, `live`, `disabled`. - `timing` (string, required): act waits for the exchange to land, answer goes while a question still hangs, ideas lets one fire serve a brainstorm. One of: `act`, `answer`, `ideas`. - `updated_at` (string, required): When it last changed - `version` (integer, required): The newest version, whose wording this is: 1, plus one for each edit to its wording, examples, timing or bar made once it has a live_version - `when` (string, required): When it fires, in plain English Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/createCustomMoment.md --- # Get a custom moment `GET https://api.sparkle.ai/public/v1/moments/{id}` Authenticate with your API key in the `X-API-Key` header. Returns one custom moment as of its current version. ## Parameters - `id` (path, required): Custom moment ID ## Responses ### 200 OK `application/json`, CustomMoment: - `color` (string, required): The color it is shown in, one of the dashboard's label colors. Presentation only: changing it makes no new version. One of: `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink`, `gray`. - `created_at` (string, required): When it was created - `examples` (MomentExamples, required): Lines it should and should not fire on - `fire` (string[], required): Lines it should fire on - `skip` (string[], required): Lines it should not fire on - `id` (string, required): Unique custom moment ID - `label` (string, required): Its display name, up to 60 characters. Presentation only: changing it makes no new version. - `live_version` (integer or null, required): The version live conversations run while status is live; null until it first goes live. An edit leaves it running until the new version is promoted - `min_confidence` (number, required): The classifier's probability a turn needs to fire it, above 0 and up to 1 - `name` (string, required): The kind its moments carry: snake_case and unique in the organization. Fixed once created. - `not_when` (string, required): When it does not fire, though it might look like it should - `shadow_version` (integer or null, required): The version running in shadow beside live_version, its fires stored but never sent; null when none - `status` (string, required): draft until first made live; live runs live_version on every conversation that detects it; disabled stops it. One of: `draft`, `live`, `disabled`. - `timing` (string, required): act waits for the exchange to land, answer goes while a question still hangs, ideas lets one fire serve a brainstorm. One of: `act`, `answer`, `ideas`. - `updated_at` (string, required): When it last changed - `version` (integer, required): The newest version, whose wording this is: 1, plus one for each edit to its wording, examples, timing or bar made once it has a live_version - `when` (string, required): When it fires, in plain English Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/getCustomMoment.md --- # Update a custom moment `PUT https://api.sparkle.ai/public/v1/moments/{id}` Authenticate with your API key in the `X-API-Key` header. Send only the fields to change. Until the custom moment first goes live, a change to when, not_when, the examples, the timing or min_confidence edits its draft in place. Once it has a live_version, such a change writes the next version as a draft, and live_version keeps running until the draft is shadowed and promoted, or promoted directly. A status change, live or disabled, reaches live conversations within seconds. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Custom moment ID ## Request body `application/json`, UpdateCustomMomentRequest: - `color` (string): The color it is shown in. Makes no new version; moments already detected keep the color they carry. One of: `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink`, `gray`. - `examples` (CustomMomentExamplesInput): Replaces both example lists - `fire` (string[]): Lines it should fire on - `skip` (string[]): Lines it should not fire on - `label` (string): Its display name, 1 to 60 characters. Makes no new version; moments already detected keep the label they carry - `min_confidence` (number): The classifier's probability a turn needs to fire it - `not_when` (string): When it does not fire - `status` (string): live to run it on conversations, disabled to stop it; a custom moment never goes back to draft. One of: `draft`, `live`, `disabled`. - `timing` (string): Its timing profile. One of: `act`, `answer`, `ideas`. - `when` (string): When it fires ## Responses ### 200 OK `application/json`, CustomMoment: - `color` (string, required): The color it is shown in, one of the dashboard's label colors. Presentation only: changing it makes no new version. One of: `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink`, `gray`. - `created_at` (string, required): When it was created - `examples` (MomentExamples, required): Lines it should and should not fire on - `fire` (string[], required): Lines it should fire on - `skip` (string[], required): Lines it should not fire on - `id` (string, required): Unique custom moment ID - `label` (string, required): Its display name, up to 60 characters. Presentation only: changing it makes no new version. - `live_version` (integer or null, required): The version live conversations run while status is live; null until it first goes live. An edit leaves it running until the new version is promoted - `min_confidence` (number, required): The classifier's probability a turn needs to fire it, above 0 and up to 1 - `name` (string, required): The kind its moments carry: snake_case and unique in the organization. Fixed once created. - `not_when` (string, required): When it does not fire, though it might look like it should - `shadow_version` (integer or null, required): The version running in shadow beside live_version, its fires stored but never sent; null when none - `status` (string, required): draft until first made live; live runs live_version on every conversation that detects it; disabled stops it. One of: `draft`, `live`, `disabled`. - `timing` (string, required): act waits for the exchange to land, answer goes while a question still hangs, ideas lets one fire serve a brainstorm. One of: `act`, `answer`, `ideas`. - `updated_at` (string, required): When it last changed - `version` (integer, required): The newest version, whose wording this is: 1, plus one for each edit to its wording, examples, timing or bar made once it has a live_version - `when` (string, required): When it fires, in plain English Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/updateCustomMoment.md --- # Delete a custom moment `DELETE https://api.sparkle.ai/public/v1/moments/{id}` Authenticate with your API key in the `X-API-Key` header. Deletes the custom moment and its versions. Moments it detected keep its name as their kind. ## Parameters - `id` (path, required): Custom moment ID ## Responses ### 204 No Content Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/deleteCustomMoment.md --- # Evaluate an unsaved custom moment `POST https://api.sparkle.ai/public/v1/moments/evaluate` Authenticate with your API key in the `X-API-Key` header. Runs a custom moment that is not saved over up to 1,000 turns, as it would run live: in the same classifier calls as the built-in kinds and the organization's live custom moments. Returns where it fired and, when expected labels the turns it should fire on, hits, misses, false fires, precision and a suggestion. Also returns the threshold a turn needed and up to 3 near misses: the turns that scored highest without firing, each with its score and why it did not fire. Gives up after 90 seconds. An organization starts at most 10 evaluations a minute. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. ## Request body `application/json`, EvaluateDraftCustomMomentRequest: - `conversation_id` (string): A conversation whose stored final turns to read, up to 1,000. Send this or turns. - `definition` (CreateCustomMomentRequest, required): The custom moment to evaluate, as it would be created - `color` (string): The color it is shown in; picked from the name when absent. One of: `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink`, `gray`. - `examples` (CustomMomentExamplesInput): Up to 10 lines each it should and should not fire on - `fire` (string[]): Lines it should fire on - `skip` (string[]): Lines it should not fire on - `label` (string): Its display name; the name in words when absent (pricing_objection is Pricing objection) - `min_confidence` (number): The classifier's probability a turn needs to fire it, above 0 and up to 1; 0.5 when absent - `name` (string, required): The kind its moments will carry: snake_case, unique in the organization, and not a built-in kind. Fixed once created. - `not_when` (string): When it does not fire, though it might look like it should - `timing` (string): act (the default) waits for the exchange to land, answer goes while a question still hangs, ideas lets one fire serve a brainstorm. One of: `act`, `answer`, `ideas`. - `when` (string, required): When it fires, in plain English - `expected` (string[]): Your ids of the turns it should fire on; every other turn should not. Absent leaves the label fields of the result null. - `turns` (ConversationTurnRequest[]): Up to 1,000 turns under the turn contract; only final ones are read. Send these or conversation_id. - `channel` (string, required): mic for whoever runs the capture, remote for everyone else. One of: `mic`, `remote`. - `end` (number, required): Seconds from the conversation's started_at when the turn ended - `final` (boolean, required): Whether the turn is finished. Only final turns reach the gate; a partial turn waits until its final version replaces it. - `id` (string, required): Your ID for the turn; sending it again replaces the turn - `name` (string): The speaker's name, when known - `speaker` (string, required): A stable key for who is speaking: the same key is the same person - `start` (number, required): Seconds from the conversation's started_at when the turn began - `text` (string, required): What was said ## Responses ### 200 OK `application/json`, CustomMomentEvaluation: - `expected` (integer or null, required): Turns labelled as ones it should fire on - `false` (array or null, required): The false fires - `false_fires` (integer or null, required): Fires on turns not labelled - `fires` (CustomMomentFire[], required): Every fire, in the order they were let go - `at` (number, required): When that turn ended, in seconds on the transcript's clock - `confidence` (number, required): The classifier's probability for it, 0 to 1 - `text` (string, required): What it read: the turn, merged with the same speaker's turns just before it - `turn` (string, required): Your id of the turn that completed what it read; consecutive turns of one speaker are read merged - `hits` (integer or null, required): Labelled turns it fired on - `misses` (array or null, required): Labelled turns it did not fire on - `near_misses` (CustomMomentNearMiss[], required): Up to 3 turns it scored highest on without firing, highest first. Consecutive turns of one speaker are read merged and count once, scored whole under the last of them; a merged turn a fire read is never one - `reason` (string): below_threshold when the score fell short of threshold; settled_away when it was the pick and cleared threshold but the timing let it go unfired, as when a later turn of the same exchange fired instead or a cooldown held it. Absent when the score cleared threshold but another option was the pick. One of: `below_threshold`, `settled_away`. - `score` (number, required): The classifier's probability, 0 to 1, that the turn is this custom moment: the number held to threshold whenever it is the classifier's pick - `threshold` (number, required): The score it needed - `turn_id` (string, required): Your id of the turn - `precision` (number or null, required): Fires on labelled turns over all fires; null with no fire either - `stats` (CustomMomentEvaluationStats, required): What the evaluation read and how long it took - `fires` (integer, required): Times it fired - `ms` (integer, required): How long the evaluation took, in milliseconds - `turns` (integer, required): Final turns read - `suggestion` (string or null, required): A change to the wording that would fix the most common mistake - `threshold` (number, required): The score a turn needed to fire it: the evaluated version's min_confidence Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/evaluateCustomMomentDraft.md --- # Enable a template `POST https://api.sparkle.ai/public/v1/moments/templates/{key}/enable` Authenticate with your API key in the `X-API-Key` header. Creates the organization's own custom moment from a template, live at once. A template the organization already has a custom moment of is a conflict. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `key` (path, required): The template's name ## Responses ### 201 Created `application/json`, CustomMoment: - `color` (string, required): The color it is shown in, one of the dashboard's label colors. Presentation only: changing it makes no new version. One of: `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink`, `gray`. - `created_at` (string, required): When it was created - `examples` (MomentExamples, required): Lines it should and should not fire on - `fire` (string[], required): Lines it should fire on - `skip` (string[], required): Lines it should not fire on - `id` (string, required): Unique custom moment ID - `label` (string, required): Its display name, up to 60 characters. Presentation only: changing it makes no new version. - `live_version` (integer or null, required): The version live conversations run while status is live; null until it first goes live. An edit leaves it running until the new version is promoted - `min_confidence` (number, required): The classifier's probability a turn needs to fire it, above 0 and up to 1 - `name` (string, required): The kind its moments carry: snake_case and unique in the organization. Fixed once created. - `not_when` (string, required): When it does not fire, though it might look like it should - `shadow_version` (integer or null, required): The version running in shadow beside live_version, its fires stored but never sent; null when none - `status` (string, required): draft until first made live; live runs live_version on every conversation that detects it; disabled stops it. One of: `draft`, `live`, `disabled`. - `timing` (string, required): act waits for the exchange to land, answer goes while a question still hangs, ideas lets one fire serve a brainstorm. One of: `act`, `answer`, `ideas`. - `updated_at` (string, required): When it last changed - `version` (integer, required): The newest version, whose wording this is: 1, plus one for each edit to its wording, examples, timing or bar made once it has a live_version - `when` (string, required): When it fires, in plain English Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/enableCustomMomentTemplate.md --- # Evaluate a custom moment `POST https://api.sparkle.ai/public/v1/moments/{id}/evaluate` Authenticate with your API key in the `X-API-Key` header. Runs a saved custom moment, its current or an earlier version, over up to 1,000 turns as it would run live. Returns where it fired and, when expected labels the turns it should fire on, hits, misses, false fires, precision and a suggestion. Also returns the threshold a turn needed and up to 3 near misses: the turns that scored highest without firing, each with its score and why it did not fire. Gives up after 90 seconds. An organization starts at most 10 evaluations a minute. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Custom moment ID ## Request body `application/json`, EvaluateCustomMomentRequest: - `conversation_id` (string): A conversation whose stored final turns to read, up to 1,000. Send this or turns. - `expected` (string[]): Your ids of the turns it should fire on; every other turn should not. Absent leaves the label fields of the result null. - `turns` (ConversationTurnRequest[]): Up to 1,000 turns under the turn contract; only final ones are read. Send these or conversation_id. - `channel` (string, required): mic for whoever runs the capture, remote for everyone else. One of: `mic`, `remote`. - `end` (number, required): Seconds from the conversation's started_at when the turn ended - `final` (boolean, required): Whether the turn is finished. Only final turns reach the gate; a partial turn waits until its final version replaces it. - `id` (string, required): Your ID for the turn; sending it again replaces the turn - `name` (string): The speaker's name, when known - `speaker` (string, required): A stable key for who is speaking: the same key is the same person - `start` (number, required): Seconds from the conversation's started_at when the turn began - `text` (string, required): What was said - `version` (integer): The version to evaluate; the current one when absent ## Responses ### 200 OK `application/json`, CustomMomentEvaluation: - `expected` (integer or null, required): Turns labelled as ones it should fire on - `false` (array or null, required): The false fires - `false_fires` (integer or null, required): Fires on turns not labelled - `fires` (CustomMomentFire[], required): Every fire, in the order they were let go - `at` (number, required): When that turn ended, in seconds on the transcript's clock - `confidence` (number, required): The classifier's probability for it, 0 to 1 - `text` (string, required): What it read: the turn, merged with the same speaker's turns just before it - `turn` (string, required): Your id of the turn that completed what it read; consecutive turns of one speaker are read merged - `hits` (integer or null, required): Labelled turns it fired on - `misses` (array or null, required): Labelled turns it did not fire on - `near_misses` (CustomMomentNearMiss[], required): Up to 3 turns it scored highest on without firing, highest first. Consecutive turns of one speaker are read merged and count once, scored whole under the last of them; a merged turn a fire read is never one - `reason` (string): below_threshold when the score fell short of threshold; settled_away when it was the pick and cleared threshold but the timing let it go unfired, as when a later turn of the same exchange fired instead or a cooldown held it. Absent when the score cleared threshold but another option was the pick. One of: `below_threshold`, `settled_away`. - `score` (number, required): The classifier's probability, 0 to 1, that the turn is this custom moment: the number held to threshold whenever it is the classifier's pick - `threshold` (number, required): The score it needed - `turn_id` (string, required): Your id of the turn - `precision` (number or null, required): Fires on labelled turns over all fires; null with no fire either - `stats` (CustomMomentEvaluationStats, required): What the evaluation read and how long it took - `fires` (integer, required): Times it fired - `ms` (integer, required): How long the evaluation took, in milliseconds - `turns` (integer, required): Final turns read - `suggestion` (string or null, required): A change to the wording that would fix the most common mistake - `threshold` (number, required): The score a turn needed to fire it: the evaluated version's min_confidence Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/evaluateCustomMoment.md --- # Promote a version `POST https://api.sparkle.ai/public/v1/moments/{id}/versions/{n}/promote` Authenticate with your API key in the `X-API-Key` header. Makes the version the live one in one step: the version that was live is archived, and a shadow of this version ends. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Custom moment ID - `n` (path, required): The version ## Responses ### 200 OK `application/json`, CustomMoment: - `color` (string, required): The color it is shown in, one of the dashboard's label colors. Presentation only: changing it makes no new version. One of: `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink`, `gray`. - `created_at` (string, required): When it was created - `examples` (MomentExamples, required): Lines it should and should not fire on - `fire` (string[], required): Lines it should fire on - `skip` (string[], required): Lines it should not fire on - `id` (string, required): Unique custom moment ID - `label` (string, required): Its display name, up to 60 characters. Presentation only: changing it makes no new version. - `live_version` (integer or null, required): The version live conversations run while status is live; null until it first goes live. An edit leaves it running until the new version is promoted - `min_confidence` (number, required): The classifier's probability a turn needs to fire it, above 0 and up to 1 - `name` (string, required): The kind its moments carry: snake_case and unique in the organization. Fixed once created. - `not_when` (string, required): When it does not fire, though it might look like it should - `shadow_version` (integer or null, required): The version running in shadow beside live_version, its fires stored but never sent; null when none - `status` (string, required): draft until first made live; live runs live_version on every conversation that detects it; disabled stops it. One of: `draft`, `live`, `disabled`. - `timing` (string, required): act waits for the exchange to land, answer goes while a question still hangs, ideas lets one fire serve a brainstorm. One of: `act`, `answer`, `ideas`. - `updated_at` (string, required): When it last changed - `version` (integer, required): The newest version, whose wording this is: 1, plus one for each edit to its wording, examples, timing or bar made once it has a live_version - `when` (string, required): When it fires, in plain English Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/promoteCustomMomentVersion.md --- # Run a version in shadow `POST https://api.sparkle.ai/public/v1/moments/{id}/versions/{n}/shadow` Authenticate with your API key in the `X-API-Key` header. Runs the version beside the live one on live conversations. Its moments are stored for the comparison and never sent to streams or webhooks. The custom moment must be live. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Custom moment ID - `n` (path, required): The version ## Responses ### 200 OK `application/json`, CustomMoment: - `color` (string, required): The color it is shown in, one of the dashboard's label colors. Presentation only: changing it makes no new version. One of: `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink`, `gray`. - `created_at` (string, required): When it was created - `examples` (MomentExamples, required): Lines it should and should not fire on - `fire` (string[], required): Lines it should fire on - `skip` (string[], required): Lines it should not fire on - `id` (string, required): Unique custom moment ID - `label` (string, required): Its display name, up to 60 characters. Presentation only: changing it makes no new version. - `live_version` (integer or null, required): The version live conversations run while status is live; null until it first goes live. An edit leaves it running until the new version is promoted - `min_confidence` (number, required): The classifier's probability a turn needs to fire it, above 0 and up to 1 - `name` (string, required): The kind its moments carry: snake_case and unique in the organization. Fixed once created. - `not_when` (string, required): When it does not fire, though it might look like it should - `shadow_version` (integer or null, required): The version running in shadow beside live_version, its fires stored but never sent; null when none - `status` (string, required): draft until first made live; live runs live_version on every conversation that detects it; disabled stops it. One of: `draft`, `live`, `disabled`. - `timing` (string, required): act waits for the exchange to land, answer goes while a question still hangs, ideas lets one fire serve a brainstorm. One of: `act`, `answer`, `ideas`. - `updated_at` (string, required): When it last changed - `version` (integer, required): The newest version, whose wording this is: 1, plus one for each edit to its wording, examples, timing or bar made once it has a live_version - `when` (string, required): When it fires, in plain English Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/shadowCustomMomentVersion.md --- # Stop a shadow `DELETE https://api.sparkle.ai/public/v1/moments/{id}/versions/{n}/shadow` Authenticate with your API key in the `X-API-Key` header. Stops the version running in shadow without promoting it. The version returns to draft, the moments it already detected stay for the comparison, and live conversations stop reading it within seconds. Stopping a version that is not in shadow changes nothing. ## Parameters - `id` (path, required): Custom moment ID - `n` (path, required): The version ## Responses ### 204 No Content Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/custom-moments/stopCustomMomentShadow.md --- # Get the plan `GET https://api.sparkle.ai/public/v1/plan` Authenticate with your API key in the `X-API-Key` header. Returns the company's plan, its limits, what it includes, and the usage counted against the limits: minutes this UTC month for the whole company, custom moments, webhook endpoints and API keys for the key's organization. Any key of the organization can read it. ## Responses ### 200 OK `application/json`, PlanOverview: - `bonuses` (PlanBonus[], required): The bonus minutes running, the soonest to end first; limits already include them - `ends_at` (string, required): When they stop - `live_minutes` (integer, required): Live minutes added each month - `name` (string, required): The campaign's name - `source` (string, required): What gave them. One of: `campaign`. - `capabilities` (PlanCapabilities, required): What the plan includes - `custom_data_terms` (boolean, required): Data processing terms negotiated for the company - `dedicated_throughput` (boolean, required): Conversations run on capacity reserved for the company - `metered_overage` (boolean, required): Live minutes past the included ones are metered instead of refused - `private_deployment` (boolean, required): The model runs in the company's VPC or self-hosted - `shadow_mode` (boolean, required): A custom moment's next version can run beside the live one before it is promoted - `sla` (boolean, required): An uptime and latency commitment - `limits` (PlanLimits, required): The plan's limits with the company's overrides and bonus minutes applied; -1 is unlimited - `api_keys` (integer, required): Active API keys per organization - `audio_session_minutes` (integer, required): Minutes one audio stream runs before it is closed; a new one can follow - `concurrent_conversations` (integer, required): Live-key conversations running at once - `custom_moments` (integer, required): Custom moments per organization, drafts and disabled ones included; at most 25 run live at once on any plan - `import_turns` (integer, required): Turns in one imported transcript - `included_live_minutes` (integer, required): Live-key minutes a month the plan includes; minutes past it are overage, billed on Pro and Scale - `live_minutes` (integer, required): Live-key minutes a month before new conversations are refused; -1 meters past the included minutes instead - `members` (integer, required): People in the company, pending invitations included - `organizations` (integer, required): Organizations in the company - `requests_per_minute` (integer, required): API requests a minute per key - `retention_days` (integer, required): Days turns and moments are kept - `sse_connections` (integer, required): Event streams open at once; not enforced yet - `test_minutes` (integer, required): Test-key and dashboard minutes a month - `test_transcription_minutes` (integer, required): Test-key and dashboard audio minutes a month Deepgram transcribes, each stream counted, before new audio sessions are refused - `transcription_minutes` (integer, required): Live-key audio minutes a month Deepgram transcribes, each stream counted, before new audio sessions are refused; -1 bills them instead - `webhook_endpoints` (integer, required): Webhook endpoints per organization, a conversation's own webhook not counted - `plan` (PlanRef, required): The company's plan; free until staff assign another - `id` (string, required): The plan. One of: `free`, `pro`, `scale`, `enterprise`. - `name` (string, required): The plan's name - `version` (integer, required): The catalog entry's version - `upgrade_requested` (boolean, required): Whether an owner asked for Enterprise since this plan was assigned - `usage` (PlanUsage, required): What the company, and this organization, use of the limits - `api_keys` (integer, required): The organization's active API keys - `concurrent_conversations` (integer, required): Live-key conversations running now - `custom_moments` (integer, required): The organization's custom moments - `live_minutes` (integer, required): Live-key minutes this month - `members` (integer, required): The company's members and pending invitations - `organizations` (integer, required): The company's organizations - `overage_minutes` (integer, required): Live minutes past the included ones; billed on Pro and Scale, by agreement on Enterprise - `period_end` (string, required): When the minutes start again from zero, in UTC - `period_start` (string, required): The start of the month the minutes count, in UTC - `test_minutes` (integer, required): Test-key and dashboard minutes this month - `test_transcription_minutes` (integer, required): Test-key and dashboard audio minutes transcribed this month, each stream counted - `transcription_minutes` (integer, required): Live-key audio minutes transcribed this month, each stream counted; billed on Pro and Scale - `webhook_endpoints` (integer, required): The organization's webhook endpoints Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/plan/getPlan.md --- # List webhook subscriptions `GET https://api.sparkle.ai/public/v1/webhooks` Authenticate with your API key in the `X-API-Key` header. Lists the organization's webhook subscriptions with cursor pagination. ## Parameters - `cursor` (query): Opaque pagination cursor, from the previous response's page_info.end_cursor. - `limit` (query): Items per page, up to 100; more is 100. Absent, or less than 1, is 10. ## Responses ### 200 OK `application/json`, PageWebhookSubscription: - `items` (WebhookSubscription[], required) - `conversation_id` (string): The conversation whose own webhook this is, receiving its events only; absent on the organization's subscriptions - `created_at` (string, required): When it was created - `created_by` (string, required): Who created it - `environment` (string, required): Whose events it receives: test conversations' or live conversations'. Set at creation, never changed. One of: `test`, `live`. - `events` (string[], required): Subscribed events; ["*"] is every event, those added later included - `failing_since` (string): When its deliveries started failing with none succeeding since; absent while the endpoint succeeds - `id` (string, required): Unique subscription ID - `is_active` (boolean, required): Whether the subscription is active: false when switched off, or paused by Sparkle - `metadata` (object): Additional metadata - `organization_id` (string, required): The organization - `paused_at` (string): When Sparkle paused it, after three days without a successful delivery while deliveries kept failing. Its events are recorded as skipped deliveries until it is active again; absent unless paused - `tenant_id` (string, required): The company - `updated_at` (string, required): When it was last updated - `url` (string, required): Where events are delivered - `page_info` (PageInfo, required) - `end_cursor` (string or null, required): Cursor for the next page. Pass it as the cursor parameter of the next request. - `has_next_page` (boolean, required): Whether there are more results after this page - `has_previous_page` (boolean, required): Whether there are results before this page - `start_cursor` (string or null, required): Cursor of the current page's first item - `total` (integer): Total of items matching the filters; only on the first page Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/webhooks/listWebhookSubscriptions.md --- # List webhook deliveries `GET https://api.sparkle.ai/public/v1/webhooks/{id}/deliveries` Authenticate with your API key in the `X-API-Key` header. Lists one subscription's deliveries, newest first, with cursor pagination: each one's status, attempts, and the status code and duration of its last attempt. ## Parameters - `id` (path, required): Subscription ID - `cursor` (query): Opaque pagination cursor, from the previous response's page_info.end_cursor. - `limit` (query): Items per page, up to 100; more is 100. Absent, or less than 1, is 10. ## Responses ### 200 OK `application/json`, PageWebhookDelivery: - `items` (WebhookDelivery[], required) - `attempt_count` (integer, required): Delivery attempts made - `completed_at` (string): When it succeeded or failed for good - `created_at` (string, required): When the delivery was created - `duration_ms` (integer): How long the last attempt took, in milliseconds - `event_type` (string, required): The event type. One of: `moment.detected`, `conversation.created`, `conversation.ended`, `conversation.deleted`, `webhook.ping`. - `http_status` (integer): HTTP status the endpoint answered the last attempt with, when there was one - `id` (string, required): Unique delivery ID - `next_retry_at` (string): When the next attempt runs, if any - `payload` (object, required): The payload sent - `replay_of` (string): The delivery this one replays, while that delivery is kept - `response_body` (string): Body the endpoint answered with, or why the last attempt failed - `status` (string, required): Delivery status. One of: `pending`, `success`, `failed`, `skipped`. - `subscription_id` (string, required): The webhook subscription - `page_info` (PageInfo, required) - `end_cursor` (string or null, required): Cursor for the next page. Pass it as the cursor parameter of the next request. - `has_next_page` (boolean, required): Whether there are more results after this page - `has_previous_page` (boolean, required): Whether there are results before this page - `start_cursor` (string or null, required): Cursor of the current page's first item - `total` (integer): Total of items matching the filters; only on the first page Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/webhooks/listWebhookDeliveries.md --- # Create a webhook subscription `POST https://api.sparkle.ai/public/v1/webhooks` Authenticate with your API key in the `X-API-Key` header. Creates a webhook subscription to receive event notifications and sends a webhook.ping to the URL. The secret that signs the deliveries appears only in this response: keep it to verify each delivery's signature. Send `events: ["*"]` to receive every event, those added later included. A `test` subscription receives test conversations' events only and a `live` one live conversations' only; the environment cannot be changed later. An API key creates subscriptions in its own environment only. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. ## Request body `application/json`, CreateWebhookSubscriptionRequest: - `environment` (string, required): Whose events the subscription receives: test conversations' or live conversations'. It cannot be changed later. With an API key it is the key's environment: leave it out, or name that one, as naming the other is refused. One of: `test`, `live`. - `events` (string[]): Events the subscription receives, or ["*"] for every event, those added later included; * is never listed beside a name. webhook.ping is always sent and cannot be subscribed to - `metadata` (object): Free-form data kept with the subscription - `url` (string, required): HTTP or HTTPS URL that receives the events ## Responses ### 201 Created `application/json`, WebhookCreated: - `secret` (string): Secret that signs the deliveries (HMAC-SHA256). Shown only here. - `webhook` (WebhookSubscription, required) - `conversation_id` (string): The conversation whose own webhook this is, receiving its events only; absent on the organization's subscriptions - `created_at` (string, required): When it was created - `created_by` (string, required): Who created it - `environment` (string, required): Whose events it receives: test conversations' or live conversations'. Set at creation, never changed. One of: `test`, `live`. - `events` (string[], required): Subscribed events; ["*"] is every event, those added later included - `failing_since` (string): When its deliveries started failing with none succeeding since; absent while the endpoint succeeds - `id` (string, required): Unique subscription ID - `is_active` (boolean, required): Whether the subscription is active: false when switched off, or paused by Sparkle - `metadata` (object): Additional metadata - `organization_id` (string, required): The organization - `paused_at` (string): When Sparkle paused it, after three days without a successful delivery while deliveries kept failing. Its events are recorded as skipped deliveries until it is active again; absent unless paused - `tenant_id` (string, required): The company - `updated_at` (string, required): When it was last updated - `url` (string, required): Where events are delivered Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/webhooks/createWebhookSubscription.md --- # Get a webhook subscription `GET https://api.sparkle.ai/public/v1/webhooks/{id}` Authenticate with your API key in the `X-API-Key` header. Returns one webhook subscription. ## Parameters - `id` (path, required): Subscription ID ## Responses ### 200 OK `application/json`, WebhookSubscription: - `conversation_id` (string): The conversation whose own webhook this is, receiving its events only; absent on the organization's subscriptions - `created_at` (string, required): When it was created - `created_by` (string, required): Who created it - `environment` (string, required): Whose events it receives: test conversations' or live conversations'. Set at creation, never changed. One of: `test`, `live`. - `events` (string[], required): Subscribed events; ["*"] is every event, those added later included - `failing_since` (string): When its deliveries started failing with none succeeding since; absent while the endpoint succeeds - `id` (string, required): Unique subscription ID - `is_active` (boolean, required): Whether the subscription is active: false when switched off, or paused by Sparkle - `metadata` (object): Additional metadata - `organization_id` (string, required): The organization - `paused_at` (string): When Sparkle paused it, after three days without a successful delivery while deliveries kept failing. Its events are recorded as skipped deliveries until it is active again; absent unless paused - `tenant_id` (string, required): The company - `updated_at` (string, required): When it was last updated - `url` (string, required): Where events are delivered Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/webhooks/getWebhookSubscription.md --- # Update a webhook subscription `PUT https://api.sparkle.ai/public/v1/webhooks/{id}` Authenticate with your API key in the `X-API-Key` header. Updates a webhook subscription. Send only the fields to change; `events: ["*"]` receives every event, those added later included. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Subscription ID ## Request body `application/json`, UpdateWebhookSubscriptionRequest: - `events` (string[]): Events the subscription receives, or ["*"] for every event, those added later included; * is never listed beside a name - `is_active` (boolean): Turns deliveries on or off. true on a paused subscription re-enables it; its skipped deliveries stay skipped until replayed - `metadata` (object): Free-form data kept with the subscription - `url` (string): New URL; changing it sends a webhook.ping ## Responses ### 200 OK `application/json`, WebhookSubscription: - `conversation_id` (string): The conversation whose own webhook this is, receiving its events only; absent on the organization's subscriptions - `created_at` (string, required): When it was created - `created_by` (string, required): Who created it - `environment` (string, required): Whose events it receives: test conversations' or live conversations'. Set at creation, never changed. One of: `test`, `live`. - `events` (string[], required): Subscribed events; ["*"] is every event, those added later included - `failing_since` (string): When its deliveries started failing with none succeeding since; absent while the endpoint succeeds - `id` (string, required): Unique subscription ID - `is_active` (boolean, required): Whether the subscription is active: false when switched off, or paused by Sparkle - `metadata` (object): Additional metadata - `organization_id` (string, required): The organization - `paused_at` (string): When Sparkle paused it, after three days without a successful delivery while deliveries kept failing. Its events are recorded as skipped deliveries until it is active again; absent unless paused - `tenant_id` (string, required): The company - `updated_at` (string, required): When it was last updated - `url` (string, required): Where events are delivered Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/webhooks/updateWebhookSubscription.md --- # Delete a webhook subscription `DELETE https://api.sparkle.ai/public/v1/webhooks/{id}` Authenticate with your API key in the `X-API-Key` header. Deletes a webhook subscription. Pending deliveries are no longer sent. ## Parameters - `id` (path, required): Subscription ID ## Responses ### 204 No Content Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/webhooks/deleteWebhookSubscription.md --- # Replay skipped webhook deliveries `POST https://api.sparkle.ai/public/v1/webhooks/{id}/deliveries/replay-skipped` Authenticate with your API key in the `X-API-Key` header. Replays the deliveries skipped while the subscription was paused, oldest first, each as a new delivery whose `replay_of` names it. A skipped delivery already replayed is left out, so calling again replays only the rest. It replays up to 500 per call; `has_more` says whether more are left. A retry with the same `Idempotency-Key` answers the first call and replays nothing. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Subscription ID ## Responses ### 202 Accepted `application/json`, WebhookReplaySkippedResult: - `has_more` (boolean, required): Whether skipped deliveries are left to replay: call again for the next ones - `replayed` (integer, required): Skipped deliveries replayed, each as a new delivery whose replay_of names it Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/webhooks/replaySkippedWebhookDeliveries.md --- # Replay a webhook delivery `POST https://api.sparkle.ai/public/v1/webhooks/{id}/deliveries/{deliveryId}/replay` Authenticate with your API key in the `X-API-Key` header. Sends a delivery's stored payload again, to the subscription's current URL, as a new delivery whose `replay_of` names the original. It is signed and retried as any delivery, and sent even while the subscription is inactive. A retry with the same `Idempotency-Key` answers the first replay and sends nothing. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Subscription ID - `deliveryId` (path, required): Delivery ID ## Responses ### 202 Accepted `application/json`, WebhookDelivery: - `attempt_count` (integer, required): Delivery attempts made - `completed_at` (string): When it succeeded or failed for good - `created_at` (string, required): When the delivery was created - `duration_ms` (integer): How long the last attempt took, in milliseconds - `event_type` (string, required): The event type. One of: `moment.detected`, `conversation.created`, `conversation.ended`, `conversation.deleted`, `webhook.ping`. - `http_status` (integer): HTTP status the endpoint answered the last attempt with, when there was one - `id` (string, required): Unique delivery ID - `next_retry_at` (string): When the next attempt runs, if any - `payload` (object, required): The payload sent - `replay_of` (string): The delivery this one replays, while that delivery is kept - `response_body` (string): Body the endpoint answered with, or why the last attempt failed - `status` (string, required): Delivery status. One of: `pending`, `success`, `failed`, `skipped`. - `subscription_id` (string, required): The webhook subscription Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/webhooks/replayWebhookDelivery.md --- # Rotate the signing secret `POST https://api.sparkle.ai/public/v1/webhooks/{id}/rotate-secret` Authenticate with your API key in the `X-API-Key` header. Generates a new secret that signs the next deliveries and appears only in this response. The replaced secret keeps signing beside it for `expires_in` seconds, a day by default, so each delivery carries a `v1` for both and a receiver still holding the old secret accepts it while it switches. Send `expires_in: 0` to retire the old secret at once, as after a leak. A retry with the same `Idempotency-Key` answers the first rotation's secret and rotates nothing. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Subscription ID ## Request body `application/json`, WebhookRotateSecretRequest: - `expires_in` (integer): Seconds the replaced secret keeps signing each delivery beside the new one, so a receiver can switch secrets without rejecting a delivery: 0 retires it at once; 86400 (a day) when absent; at most 604800 (7 days) ## Responses ### 200 OK `application/json`, WebhookSecret: - `secret` (string): New secret that signs the deliveries. Shown only here. Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/webhooks/rotateWebhookSecret.md --- # Test a webhook subscription `POST https://api.sparkle.ai/public/v1/webhooks/{id}/test` Authenticate with your API key in the `X-API-Key` header. Delivers a webhook.ping now and answers with what the URL answered. ## Parameters - `Idempotency-Key` (header, required): Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request. - `id` (path, required): Subscription ID ## Responses ### 200 OK `application/json`, TestWebhookResult: - `duration_ms` (integer, required): How long the delivery took, in milliseconds - `error` (string): Why the delivery failed before a response - `http_status` (integer): HTTP status the URL answered - `response_body` (string): Start of the response body - `success` (boolean, required): Whether the URL answered 2xx Errors are RFC 9457 problem details: https://docs.sparkle.ai/docs/api/errors.md Source: https://docs.sparkle.ai/docs/api/reference/webhooks/testWebhookSubscription.md --- # Conversation created Webhook event `conversation.created`: Sparkle sends this body as a `POST` to your URL. Sent once a conversation is created. `data` is the conversation resource, never the receiver paths or the conversation's webhook secret. ## Headers - `Sparkle-Event` (header, required): The event delivered. - `Sparkle-Signature` (header, required): `t=` the Unix time the attempt was signed, then `v1=` the hex HMAC-SHA256 of `.`, the body exactly as received, keyed with the whole signing secret, `whsec_` prefix included, as UTF-8 bytes. Compare in constant time and reject a `t` more than 5 minutes from your clock. Each attempt, a retry or a replay, is signed anew. While a rotated-out secret still overlaps, the header carries one `v1` per secret, the new one first: accept the delivery when any matches. - `Sparkle-Delivery` (header): The delivery, the same on every attempt: use it to drop repeats. A replay (`POST /webhooks/{id}/deliveries/{deliveryId}/replay`) is a new delivery with its own ID. It is also the delivery's `id` in `GET /webhooks/{id}/deliveries`. Absent on the test (`POST /webhooks/{id}/test`). - `User-Agent` (header): `Sparkle-Webhooks/1.0`. Absent on the test (`POST /webhooks/{id}/test`). ## Body `application/json`, ConversationCreatedEvent: - `created_at` (string, required): When the event happened, to the second - `data` (Conversation, required): The conversation as created - `created_at` (string, required): When it was created - `ended_at` (string): When it was ended - `environment` (string, required): The environment of the API key that created it; test from the dashboard. One of: `test`, `live`. - `id` (string, required): Unique conversation ID - `metadata` (object, required): Your own data, returned as sent - `moment_types` (string[], required): The moment types it detects, built-in kinds and custom moments' names; empty detects every built-in kind and every live custom moment - `moments_count` (integer, required): Moments detected so far - `organization_id` (string, required): The organization - `origin` (string, required): How it was created: api with an API key or personal access token, playground from the dashboard, import from a whole transcript, connection by a connection's call. Audio streamed into it shows in usage.transcription_seconds. One of: `api`, `playground`, `import`, `connection`. - `progress` (ImportProgress): How far an imported transcript has been read; absent on a live conversation - `turns_done` (integer, required): Turns read through the gate so far - `turns_total` (integer, required): Turns the transcript was imported with - `started_at` (string, required): Time zero of the conversation's clock: turn times are seconds from it - `status` (string, required): live while it takes turns, processing while an imported transcript is read, ended once ended. One of: `live`, `processing`, `ended`. - `tenant_id` (string, required): The company - `title` (string, required): A label for the conversation log - `updated_at` (string, required): When it last changed - `usage` (ConversationUsage, required): What it has used so far of the month's minutes and transcription. A test conversation's usage counts against the test allowances and is never billed - `metered_seconds` (integer, required): Seconds it counts toward the month's minutes: the longest of its final turns' span, their words at 150 a minute, and the audio its longer stream sent, rounded up to the second - `transcription_seconds` (number, required): Seconds of audio Sparkle's audio API transcribed for it, each stream counted, to the fraction; 0 when its turns arrived as text - `webhook` (ConversationHook): Its own webhook, when created with a webhook_url - `id` (string, required): The subscription; its deliveries list at GET /webhooks/{id}/deliveries - `url` (string, required): Where the conversation's events are delivered - `id` (string, required): The event, the same on every retry and replay: use it to drop repeats - `livemode` (boolean, required): Whether the event belongs to the live environment: true when the conversation it is about is live, or the ping's subscription is - `object` (string, required): Always event. One of: `event`. - `type` (string, required): The event type, which the Sparkle-Event header repeats. One of: `conversation.created`. ## Your response ### 429 Retried, as a network or server failure is. ### 2XX Delivered. The response is kept on the delivery, up to 10 KB. ### 3XX Final failure, not retried: redirects are not followed, so the URL must answer itself. ### 4XX Final failure, not retried: the delivery becomes `failed`. ### 5XX Retried: up to 5 attempts, the first at once and the next after 1, 2, 4 and 8 minutes. Each attempt waits up to 30 seconds for the answer. After the fifth, the delivery becomes `failed`. A URL whose address is not on the public internet fails at once, wherever DNS points it. Source: https://docs.sparkle.ai/docs/api/reference/webhook-events/conversationCreated.md --- # Conversation deleted Webhook event `conversation.deleted`: Sparkle sends this body as a `POST` to your URL. Sent once a conversation and everything it held are erased, the webhook deliveries that carried its moments and its own webhook included. ## Headers - `Sparkle-Event` (header, required): The event delivered. - `Sparkle-Signature` (header, required): `t=` the Unix time the attempt was signed, then `v1=` the hex HMAC-SHA256 of `.`, the body exactly as received, keyed with the whole signing secret, `whsec_` prefix included, as UTF-8 bytes. Compare in constant time and reject a `t` more than 5 minutes from your clock. Each attempt, a retry or a replay, is signed anew. While a rotated-out secret still overlaps, the header carries one `v1` per secret, the new one first: accept the delivery when any matches. - `Sparkle-Delivery` (header): The delivery, the same on every attempt: use it to drop repeats. A replay (`POST /webhooks/{id}/deliveries/{deliveryId}/replay`) is a new delivery with its own ID. It is also the delivery's `id` in `GET /webhooks/{id}/deliveries`. Absent on the test (`POST /webhooks/{id}/test`). - `User-Agent` (header): `Sparkle-Webhooks/1.0`. Absent on the test (`POST /webhooks/{id}/test`). ## Body `application/json`, ConversationDeletedEvent: - `created_at` (string, required): When the event happened, to the second - `data` (DeletedConversation, required): The deleted conversation - `deleted` (boolean, required): Always true - `id` (string, required): The deleted conversation - `object` (string, required): Always conversation. One of: `conversation`. - `id` (string, required): The event, the same on every retry and replay: use it to drop repeats - `livemode` (boolean, required): Whether the event belongs to the live environment: true when the conversation it is about is live, or the ping's subscription is - `object` (string, required): Always event. One of: `event`. - `type` (string, required): The event type, which the Sparkle-Event header repeats. One of: `conversation.deleted`. ## Your response ### 429 Retried, as a network or server failure is. ### 2XX Delivered. The response is kept on the delivery, up to 10 KB. ### 3XX Final failure, not retried: redirects are not followed, so the URL must answer itself. ### 4XX Final failure, not retried: the delivery becomes `failed`. ### 5XX Retried: up to 5 attempts, the first at once and the next after 1, 2, 4 and 8 minutes. Each attempt waits up to 30 seconds for the answer. After the fifth, the delivery becomes `failed`. A URL whose address is not on the public internet fails at once, wherever DNS points it. Source: https://docs.sparkle.ai/docs/api/reference/webhook-events/conversationDeleted.md --- # Conversation ended Webhook event `conversation.ended`: Sparkle sends this body as a `POST` to your URL. Sent once an ended conversation's pending moments have all been let go: no `moment.detected` for it is emitted after this one. Deliveries are independent, though, and may arrive out of order: treat the conversation as complete once you hold `summary.moments_count` moments. ## Headers - `Sparkle-Event` (header, required): The event delivered. - `Sparkle-Signature` (header, required): `t=` the Unix time the attempt was signed, then `v1=` the hex HMAC-SHA256 of `.`, the body exactly as received, keyed with the whole signing secret, `whsec_` prefix included, as UTF-8 bytes. Compare in constant time and reject a `t` more than 5 minutes from your clock. Each attempt, a retry or a replay, is signed anew. While a rotated-out secret still overlaps, the header carries one `v1` per secret, the new one first: accept the delivery when any matches. - `Sparkle-Delivery` (header): The delivery, the same on every attempt: use it to drop repeats. A replay (`POST /webhooks/{id}/deliveries/{deliveryId}/replay`) is a new delivery with its own ID. It is also the delivery's `id` in `GET /webhooks/{id}/deliveries`. Absent on the test (`POST /webhooks/{id}/test`). - `User-Agent` (header): `Sparkle-Webhooks/1.0`. Absent on the test (`POST /webhooks/{id}/test`). ## Body `application/json`, ConversationEndedEvent: - `created_at` (string, required): When the event happened, to the second - `data` (ConversationEnded, required): The ended conversation and what it produced - `conversation` (Conversation, required): The ended conversation - `created_at` (string, required): When it was created - `ended_at` (string): When it was ended - `environment` (string, required): The environment of the API key that created it; test from the dashboard. One of: `test`, `live`. - `id` (string, required): Unique conversation ID - `metadata` (object, required): Your own data, returned as sent - `moment_types` (string[], required): The moment types it detects, built-in kinds and custom moments' names; empty detects every built-in kind and every live custom moment - `moments_count` (integer, required): Moments detected so far - `organization_id` (string, required): The organization - `origin` (string, required): How it was created: api with an API key or personal access token, playground from the dashboard, import from a whole transcript, connection by a connection's call. Audio streamed into it shows in usage.transcription_seconds. One of: `api`, `playground`, `import`, `connection`. - `progress` (ImportProgress): How far an imported transcript has been read; absent on a live conversation - `turns_done` (integer, required): Turns read through the gate so far - `turns_total` (integer, required): Turns the transcript was imported with - `started_at` (string, required): Time zero of the conversation's clock: turn times are seconds from it - `status` (string, required): live while it takes turns, processing while an imported transcript is read, ended once ended. One of: `live`, `processing`, `ended`. - `tenant_id` (string, required): The company - `title` (string, required): A label for the conversation log - `updated_at` (string, required): When it last changed - `usage` (ConversationUsage, required): What it has used so far of the month's minutes and transcription. A test conversation's usage counts against the test allowances and is never billed - `metered_seconds` (integer, required): Seconds it counts toward the month's minutes: the longest of its final turns' span, their words at 150 a minute, and the audio its longer stream sent, rounded up to the second - `transcription_seconds` (number, required): Seconds of audio Sparkle's audio API transcribed for it, each stream counted, to the fraction; 0 when its turns arrived as text - `webhook` (ConversationHook): Its own webhook, when created with a webhook_url - `id` (string, required): The subscription; its deliveries list at GET /webhooks/{id}/deliveries - `url` (string, required): Where the conversation's events are delivered - `reason` (string, required): Why it ended: requested by POST /conversations/{id}/end, the dashboard, or the vendor ending a connection's call; idle when no turn arrived for an hour and no audio socket was open; completed when an imported transcript was read to its end; failed when an imported transcript could not be read to its end, as when its turns were no longer stored. Treat a value you don't know as requested. One of: `requested`, `idle`, `completed`, `failed`. - `summary` (ConversationSummary, required): What the conversation produced - `duration_s` (number, required): Seconds from started_at to ended_at - `moments_by_kind` (object, required): Moments detected per kind; a kind with none is absent - `moments_count` (integer, required): Moments detected, the flushed ones included - `turns_count` (integer, required): Final turns taken; partial turns never finalized are not counted - `id` (string, required): The event, the same on every retry and replay: use it to drop repeats - `livemode` (boolean, required): Whether the event belongs to the live environment: true when the conversation it is about is live, or the ping's subscription is - `object` (string, required): Always event. One of: `event`. - `type` (string, required): The event type, which the Sparkle-Event header repeats. One of: `conversation.ended`. ## Your response ### 429 Retried, as a network or server failure is. ### 2XX Delivered. The response is kept on the delivery, up to 10 KB. ### 3XX Final failure, not retried: redirects are not followed, so the URL must answer itself. ### 4XX Final failure, not retried: the delivery becomes `failed`. ### 5XX Retried: up to 5 attempts, the first at once and the next after 1, 2, 4 and 8 minutes. Each attempt waits up to 30 seconds for the answer. After the fifth, the delivery becomes `failed`. A URL whose address is not on the public internet fails at once, wherever DNS points it. Source: https://docs.sparkle.ai/docs/api/reference/webhook-events/conversationEnded.md --- # Moment detected Webhook event `moment.detected`: Sparkle sends this body as a `POST` to your URL. Sent for every moment a conversation's gate lets go, the same event the conversation's stream (`GET /conversations/{id}/stream`) sends, with the same `id`. `data` is the moment as `GET /conversations/{id}/moments` lists it. ## Headers - `Sparkle-Event` (header, required): The event delivered. - `Sparkle-Signature` (header, required): `t=` the Unix time the attempt was signed, then `v1=` the hex HMAC-SHA256 of `.`, the body exactly as received, keyed with the whole signing secret, `whsec_` prefix included, as UTF-8 bytes. Compare in constant time and reject a `t` more than 5 minutes from your clock. Each attempt, a retry or a replay, is signed anew. While a rotated-out secret still overlaps, the header carries one `v1` per secret, the new one first: accept the delivery when any matches. - `Sparkle-Delivery` (header): The delivery, the same on every attempt: use it to drop repeats. A replay (`POST /webhooks/{id}/deliveries/{deliveryId}/replay`) is a new delivery with its own ID. It is also the delivery's `id` in `GET /webhooks/{id}/deliveries`. Absent on the test (`POST /webhooks/{id}/test`). - `User-Agent` (header): `Sparkle-Webhooks/1.0`. Absent on the test (`POST /webhooks/{id}/test`). ## Body `application/json`, MomentDetectedEvent: - `created_at` (string, required): When the event happened, to the second - `data` (Moment, required): The moment - `at` (number, required): When that turn ended, in seconds from the conversation's started_at, as a turn's start and end are - `classifier` (string, required): The classifier that read the turn - `confidence` (number, required): The classifier's probability for the moment, 0 to 1 - `conversation_id` (string, required): The conversation - `created_at` (string, required): When it was recorded - `definition` (MomentDefinitionRef or null, required): The custom moment type it was detected as; null for a built-in kind - `color` (string, required): The custom moment's color when it detected the moment. One of: `violet`, `blue`, `teal`, `green`, `yellow`, `orange`, `red`, `pink`, `gray`. - `id` (string, required): The custom moment type - `label` (string, required): The custom moment's display name when it detected the moment - `version` (integer, required): The version of it that detected the moment - `id` (string, required): Unique moment ID - `kind` (string, required): What happened: a built-in kind, or the name of the custom moment it was detected as - `object` (string, required): Always moment. One of: `moment`. - `settled_ms` (integer, required): How long after the turn ended the moment was let go, in conversation time - `speaker` (MomentSpeaker, required): Who said it - `key` (string, required): The speaker key the turn was sent with - `name` (string or null, required): The name the turn was sent with; null when none was - `text` (string, required): The turn that set it off, consecutive turns of one speaker merged - `title` (string or null, required): A short line saying what happened, after who said it: Dana · Ship the SSO fix by Friday. Null when no title was written in time - `turn_ids` (string[], required): The ids your turns were sent with, of the turns the text was merged from - `id` (string, required): The event, the same on every retry and replay: use it to drop repeats - `livemode` (boolean, required): Whether the event belongs to the live environment: true when the conversation it is about is live, or the ping's subscription is - `object` (string, required): Always event. One of: `event`. - `type` (string, required): The event type, which the Sparkle-Event header repeats. One of: `moment.detected`. ## Your response ### 429 Retried, as a network or server failure is. ### 2XX Delivered. The response is kept on the delivery, up to 10 KB. ### 3XX Final failure, not retried: redirects are not followed, so the URL must answer itself. ### 4XX Final failure, not retried: the delivery becomes `failed`. ### 5XX Retried: up to 5 attempts, the first at once and the next after 1, 2, 4 and 8 minutes. Each attempt waits up to 30 seconds for the answer. After the fifth, the delivery becomes `failed`. A URL whose address is not on the public internet fails at once, wherever DNS points it. Source: https://docs.sparkle.ai/docs/api/reference/webhook-events/momentDetected.md --- # Ping Webhook event `webhook.ping`: Sparkle sends this body as a `POST` to your URL. Sent when the subscription is created and when its URL changes, and by the test (`POST /webhooks/{id}/test`). It cannot be subscribed to. ## Headers - `Sparkle-Event` (header, required): The event delivered. - `Sparkle-Signature` (header, required): `t=` the Unix time the attempt was signed, then `v1=` the hex HMAC-SHA256 of `.`, the body exactly as received, keyed with the whole signing secret, `whsec_` prefix included, as UTF-8 bytes. Compare in constant time and reject a `t` more than 5 minutes from your clock. Each attempt, a retry or a replay, is signed anew. While a rotated-out secret still overlaps, the header carries one `v1` per secret, the new one first: accept the delivery when any matches. - `Sparkle-Delivery` (header): The delivery, the same on every attempt: use it to drop repeats. A replay (`POST /webhooks/{id}/deliveries/{deliveryId}/replay`) is a new delivery with its own ID. It is also the delivery's `id` in `GET /webhooks/{id}/deliveries`. Absent on the test (`POST /webhooks/{id}/test`). - `User-Agent` (header): `Sparkle-Webhooks/1.0`. Absent on the test (`POST /webhooks/{id}/test`). ## Body `application/json`, WebhookPingEvent: - `created_at` (string, required): When the event happened, to the second - `data` (WebhookPingData, required): Always empty - `id` (string, required): The event, the same on every retry and replay: use it to drop repeats - `livemode` (boolean, required): Whether the event belongs to the live environment: true when the conversation it is about is live, or the ping's subscription is - `object` (string, required): Always event. One of: `event`. - `type` (string, required): The event type, which the Sparkle-Event header repeats. One of: `webhook.ping`. ## Your response ### 429 Retried, as a network or server failure is. ### 2XX Delivered. The response is kept on the delivery, up to 10 KB. ### 3XX Final failure, not retried: redirects are not followed, so the URL must answer itself. ### 4XX Final failure, not retried: the delivery becomes `failed`. ### 5XX Retried: up to 5 attempts, the first at once and the next after 1, 2, 4 and 8 minutes. Each attempt waits up to 30 seconds for the answer. After the fifth, the delivery becomes `failed`. A URL whose address is not on the public internet fails at once, wherever DNS points it. Source: https://docs.sparkle.ai/docs/api/reference/webhook-events/webhookPing.md --- # Errors > Every error has the same shape. Branch on its code, retry what is safe to retry. When a request fails, Sparkle answers with a `4xx` or `5xx` status and an [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem details body. Every error has the same fields: ```json { "type": "https://api.sparkle.ai/errors/validation", "title": "Validation Failed", "status": 400, "detail": "unknown moment type", "instance": "/public/v1/conversations", "code": "validation.conversation.moment_type_invalid", "request_id": "req_abc123", "timestamp": "2026-12-03T15:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/validation", "errors": [ { "field": "moment_types", "message": "unknown moment type", "code": "validation.conversation.moment_type_invalid", "resource": "Conversation" } ] } ``` | Field | Use it for | | ---------------- | --------------------------------------------------------------------------- | | `code` | Branching in your code. It's stable; the `X-Error-Code` header repeats it. | | `status`, `type` | The kind of error, as a number and as a link to its page below. | | `detail` | A sentence for whoever is debugging. It can change; don't parse it. | | `errors` | For a validation error, one item per field, with the field in dot notation. | | `request_id` | Quote it when you contact support. | ## Status codes | Status | Page | Retry? | | ------ | ----------------------------------------------------------------- | ------------------------------------------------- | | `400` | [Validation failed](/docs/api/errors/validation) | No. Fix the request. | | `401` | [Authentication required](/docs/api/errors/unauthorized) | No. Check the `X-API-Key` header. | | `403` | [Access denied](/docs/api/errors/forbidden) | No. The key's role or scopes don't allow it. | | `404` | [Not found](/docs/api/errors/not-found) | No. | | `408` | [Request timeout](/docs/api/errors/request-timeout) | Yes, with the same `Idempotency-Key`. | | `409` | [Conflict](/docs/api/errors/conflict) | Read the resource's state first. | | `413` | [Payload too large](/docs/api/errors/payload-too-large) | No. Send smaller batches. | | `415` | [Unsupported media type](/docs/api/errors/unsupported-media-type) | No. Send `Content-Type: application/json`. | | `422` | [Unprocessable content](/docs/api/errors/unprocessable) | No. Change what the body holds. | | `429` | [Rate limit exceeded](/docs/api/errors/rate-limit) | Yes, after `Retry-After` seconds. | | `500` | [Internal error](/docs/api/errors/internal) | Yes, with backoff and the same `Idempotency-Key`. | | `502` | [External service error](/docs/api/errors/bad-gateway) | Yes, with backoff. | | `503` | [Service unavailable](/docs/api/errors/service-unavailable) | No. The feature isn't configured. | ## Retrying safely Every `POST` and `PUT` takes an `Idempotency-Key` header. When you retry a request after a timeout or a `5xx`, send the same key: if the first attempt went through, you get its response, and nothing happens twice. A request that never reached Sparkle is processed as new. Source: https://docs.sparkle.ai/docs/api/errors.md --- # Validation failed (400) > The request was refused because a value is missing, malformed or out of range. **Status:** `400 Bad Request` · **type:** `https://api.sparkle.ai/errors/validation` ## When it happens * A required field is missing, or a value isn't in the expected format (a URL, an ID, a date). * The body isn't valid JSON, has a field the operation doesn't accept, or a value of the wrong type. * A path ID or a query parameter couldn't be read, such as a `limit` that isn't a number. * A `POST` or `PUT` came without an `Idempotency-Key` header, or reused a key for a different method or path. ## How to fix it Fix the request before sending it again; the same request gets the same error. When the error is about fields, `errors` holds one item per field, with the field in `field` (dot notation, such as `metadata.source`) and the reason in `code`. Branch on `code` in your code; `detail` and `message` are for whoever is debugging and can change. ## Example ```json { "type": "https://api.sparkle.ai/errors/validation", "title": "Validation Failed", "status": 400, "detail": "webhook URL is required", "instance": "/public/v1/webhooks", "code": "validation.webhook.url_required", "request_id": "req_abc123", "timestamp": "2026-02-15T12:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/validation", "errors": [ { "field": "url", "message": "webhook URL is required", "code": "validation.webhook.url_required", "resource": "WebhookSubscription" } ] } ``` Source: https://docs.sparkle.ai/docs/api/errors/validation.md --- # Authentication required (401) > The request didn't carry a valid credential. **Status:** `401 Unauthorized` · **type:** `https://api.sparkle.ai/errors/unauthorized` ## When it happens * The `X-API-Key` header is missing. * The API key or personal access token doesn't exist, has expired or was revoked. * On a [receiver](/docs/receivers/recall) URL: the token names no conversation (`unauthorized.receiver_token`), or a Recall.ai request's signature doesn't verify (`unauthorized.receiver_signature`). ## How to fix it Check that the credential is in the `X-API-Key` header and that it is still active under **Settings** > **API keys** in the dashboard. If it was revoked or has expired, create a new one. Sending the same request again without changing the credential gets the same error. ## Example ```json { "type": "https://api.sparkle.ai/errors/unauthorized", "title": "Authentication Required", "status": 401, "detail": "Invalid API key", "instance": "/public/v1/webhooks", "code": "unauthorized.invalid_api_key", "request_id": "req_abc123", "timestamp": "2026-02-15T12:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/unauthorized" } ``` Source: https://docs.sparkle.ai/docs/api/errors/unauthorized.md --- # Access denied (403) > The credential is valid but can't perform this operation. **Status:** `403 Forbidden` · **type:** `https://api.sparkle.ai/errors/forbidden` ## When it happens * None of the API key's scopes covers the resource and action, or the key's role doesn't allow the action. * The personal access token's user has no access to the organization (`forbidden.organization_access`). * The company is scheduled for deletion (`forbidden.tenant_deleted`). * Sparkle suspended the company (`forbidden.tenant_suspended`). Every API key and personal access token of the company gets it until the suspension is lifted; its live conversations take no turns and its webhooks send nothing meanwhile. * The company's plan doesn't allow it: a `limit.*` code, such as `limit.minutes_exceeded`, or `plan.capability_required`. See [Plans & limits](/docs/concepts/plans). ## How to fix it Retrying doesn't change the outcome. Read `code` for the reason, then adjust the key's scopes and role, use a credential that has access to the organization, restore the company from the dashboard, change the plan in **Settings → Plan and billing**, or, for a suspended company, write to [support@sparkle.ai](mailto:support@sparkle.ai). ## Example ```json { "type": "https://api.sparkle.ai/errors/forbidden", "title": "Access Denied", "status": 403, "detail": "insufficient permissions", "instance": "/public/v1/webhooks", "code": "forbidden.insufficient_permissions", "request_id": "req_abc123", "timestamp": "2026-02-15T12:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/forbidden" } ``` Source: https://docs.sparkle.ai/docs/api/errors/forbidden.md --- # Resource not found (404) > The requested resource doesn't exist, was deleted, or isn't visible to the credential. **Status:** `404 Not Found` · **type:** `https://api.sparkle.ai/errors/not-found` ## When it happens * The ID in the path doesn't match any resource in the credential's organization. * The resource was deleted. * The resource exists but the credential can't see it: the answer is the same, so it doesn't reveal that the resource exists. * The request's path or method doesn't match any operation of the API. ## How to fix it Check the ID and the credential's organization. A deleted resource doesn't come back; if your system stored its ID, remove it there. Retrying doesn't change the outcome. ## Example ```json { "type": "https://api.sparkle.ai/errors/not-found", "title": "Resource Not Found", "status": 404, "detail": "webhook subscription not found", "instance": "/public/v1/webhooks/whs_abc123", "code": "not_found.webhook_subscription", "request_id": "req_abc123", "timestamp": "2026-02-15T12:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/not-found" } ``` Source: https://docs.sparkle.ai/docs/api/errors/not-found.md --- # Conflict (409) > The operation contradicts the resource's current state or a value that must be unique. **Status:** `409 Conflict` · **type:** `https://api.sparkle.ai/errors/conflict` ## When it happens * A resource with the same unique value already exists. * The resource is in a state that doesn't allow the operation. * The same `Idempotency-Key` was sent again while the first request with it was still running (`conflict.idempotency_key`). ## How to fix it Read the resource again and decide from its current state: use the one that already exists instead of creating another, or change its state before retrying. The same request without changes gets the same error. For `conflict.idempotency_key`, wait for the first request to finish and send it again with the same key: you get the first request's response. ## Example ```json { "type": "https://api.sparkle.ai/errors/conflict", "title": "Resource Conflict", "status": 409, "detail": "a request with this idempotency key is already in progress", "instance": "/public/v1/webhooks", "code": "conflict.idempotency_key", "request_id": "req_abc123", "timestamp": "2026-02-15T12:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/conflict" } ``` Source: https://docs.sparkle.ai/docs/api/errors/conflict.md --- # Unsupported media type (415) > The body was sent in a format the operation doesn't accept. **Status:** `415 Unsupported Media Type` · **type:** `https://api.sparkle.ai/errors/unsupported-media-type` ## When it happens An operation that takes JSON was called with a `Content-Type` other than `application/json` (or a `+json` type), such as `application/x-www-form-urlencoded` or `text/plain`. A body with no `Content-Type` is read as JSON. ## How to fix it Send the body as JSON with the `Content-Type: application/json` header. An operation that takes a file upload asks for `multipart/form-data`, and its reference page says so. ## Example ```json { "type": "https://api.sparkle.ai/errors/unsupported-media-type", "title": "Unsupported Media Type", "status": 415, "detail": "request body must be application/json", "instance": "/public/v1/webhooks", "code": "validation.invalid_content_type", "request_id": "req_abc123", "timestamp": "2026-02-15T12:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/unsupported-media-type" } ``` Source: https://docs.sparkle.ai/docs/api/errors/unsupported-media-type.md --- # Payload too large (413) > The request body is larger than the operation accepts. **Status:** `413 Content Too Large` · **type:** `https://api.sparkle.ai/errors/payload-too-large` ## When it happens The body is larger than the operation's limit: 10 MB for a JSON body and, for a file upload, the limit its reference page gives. ## How to fix it Make the body smaller before sending it again, for example by splitting a large payload into several requests. The same request gets the same error. ## Example ```json { "type": "https://api.sparkle.ai/errors/payload-too-large", "title": "Payload Too Large", "status": 413, "detail": "request body is too large", "instance": "/public/v1/webhooks", "code": "validation.body_too_large", "request_id": "req_abc123", "timestamp": "2026-02-15T12:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/payload-too-large" } ``` Source: https://docs.sparkle.ai/docs/api/errors/payload-too-large.md --- # Unprocessable content (422) > The body arrived whole, but Sparkle can't read or take what it holds. **Status:** `422 Unprocessable Content` · **type:** `https://api.sparkle.ai/errors/unprocessable` ## When it happens A [webhook connection](/docs/connections/webhook) received a body it can't use: | Code | Meaning | | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------- | | `unprocessable.transcript_format` | The body is in no format Sparkle reads: not its turns JSON, a list of utterances, VTT, SRT or `Speaker: line` text. | | `unprocessable.transcript_invalid` | The body was read, but its turns break the turn contract, or a live call's batch names no call. | The connection records the same error as its last error, and keeps the body in its payload log. ## How to fix it Read `detail`: it says what was missing. Change what the tool sends, then send it again, or re-run the payload from the dashboard's Sources page. The same body gets the same error. ## Example ```json { "type": "https://api.sparkle.ai/errors/unprocessable", "title": "Unprocessable Content", "status": 422, "detail": "unrecognized transcript: found no list of utterances in the JSON. Send them as a top-level array or under turns, utterances, segments or sentences, each with a speaker and its text", "instance": "/public/v1/receivers/webhook/…", "code": "unprocessable.transcript_format", "request_id": "req_abc123", "timestamp": "2026-12-03T12:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/unprocessable" } ``` Source: https://docs.sparkle.ai/docs/api/errors/unprocessable.md --- # Request timeout (408) > The request body didn't arrive in full before the server's read deadline. **Status:** `408 Request Timeout` · **type:** `https://api.sparkle.ai/errors/request-timeout` ## When it happens The server allows a fixed time to read a request body, and it ran out before the body arrived in full. This is usually a large upload on a slow or unstable connection. The operation didn't run: the server never read what was sent. ## How to fix it Send it again with a smaller body or over a better connection. Repeating the same upload over the same connection tends to get the same error. ## Example ```json { "type": "https://api.sparkle.ai/errors/request-timeout", "title": "Request Timeout", "status": 408, "detail": "request body read timed out", "instance": "/public/v1/webhooks", "code": "validation.body_timeout", "request_id": "req_abc123", "timestamp": "2026-02-15T12:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/request-timeout" } ``` Source: https://docs.sparkle.ai/docs/api/errors/request-timeout.md --- # Rate limit exceeded (429) > The credential sent more requests than the current window allows. **Status:** `429 Too Many Requests` · **type:** `https://api.sparkle.ai/errors/rate-limit` ## When it happens The credential sent more requests than the current window's limit, which is its company's plan's requests a minute per key (`rate_limit.exceeded`), or 10 custom moment evaluations a minute per organization (`rate_limit.custom_moment_evaluations`), or the company is running as many live conversations as its plan allows (`limit.concurrent_conversations`; see [Plans & limits](/docs/concepts/plans)). Every response gives the limit in `X-RateLimit-Limit`, what is left in `X-RateLimit-Remaining`, and when the window resets in `X-RateLimit-Reset` (Unix seconds). ## How to fix it Wait the number of seconds in the `Retry-After` header before trying again, and slow down: watch `X-RateLimit-Remaining`. Don't retry right away; every attempt counts toward the limit. ## Example ```http HTTP/1.1 429 Too Many Requests Retry-After: 42 X-RateLimit-Limit: 100 X-RateLimit-Remaining: 0 X-RateLimit-Reset: 1771156842 ``` ```json { "type": "https://api.sparkle.ai/errors/rate-limit", "title": "Rate Limit Exceeded", "status": 429, "detail": "Rate limit exceeded", "instance": "/public/v1/webhooks", "code": "rate_limit.exceeded", "request_id": "req_abc123", "timestamp": "2026-02-15T12:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/rate-limit" } ``` Source: https://docs.sparkle.ai/docs/api/errors/rate-limit.md --- # Internal error (500) > An unexpected failure on the server stopped the operation. **Status:** `500 Internal Server Error` · **type:** `https://api.sparkle.ai/errors/internal` ## When it happens Something failed on the server while handling the request. Nothing is wrong with what you sent, and the response carries no internal details. ## How to fix it Try again after a few seconds, with growing intervals between attempts. On `POST` and `PUT`, send the same `Idempotency-Key` again so the operation doesn't run twice. If the error persists, contact support with the response's `request_id`. ## Example ```json { "type": "https://api.sparkle.ai/errors/internal", "title": "Internal Server Error", "status": 500, "detail": "an unexpected error occurred", "instance": "/public/v1/webhooks", "code": "internal.unexpected_error", "request_id": "req_abc123", "timestamp": "2026-02-15T12:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/internal" } ``` Source: https://docs.sparkle.ai/docs/api/errors/internal.md --- # External service error (502) > A third-party service the operation depends on failed or didn't answer. **Status:** `502 Bad Gateway` · **type:** `https://api.sparkle.ai/errors/bad-gateway` ## When it happens The operation depends on a service outside the API, and that service failed or didn't answer in time. ## How to fix it Try again after a few seconds, with growing intervals between attempts; the failure is usually short-lived. On `POST` and `PUT`, send the same `Idempotency-Key` again. If it persists, contact support with the response's `request_id`. ## Example ```json { "type": "https://api.sparkle.ai/errors/bad-gateway", "title": "External Service Error", "status": 502, "detail": "upstream service error", "instance": "/public/v1/webhooks", "code": "bad_gateway.service_unavailable", "request_id": "req_abc123", "timestamp": "2026-02-15T12:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/bad-gateway" } ``` Source: https://docs.sparkle.ai/docs/api/errors/bad-gateway.md --- # Service unavailable (503) > The operation needs a feature this deployment isn't configured to serve. **Status:** `503 Service Unavailable` · **type:** `https://api.sparkle.ai/errors/service-unavailable` ## When it happens The operation depends on a feature that isn't set up where the API runs, such as audio transcription (`audio.not_configured`) on a deployment without a transcription provider. ## How to fix it Don't retry: the answer stays the same until the deployment is configured. Fall back to what works without the feature, such as [posting turns](/docs/concepts/turns) from your own speech-to-text instead of streaming audio. If you expected the feature, contact support with the response's `request_id`. ## Example ```json { "type": "https://api.sparkle.ai/errors/service-unavailable", "title": "Service Unavailable", "status": 503, "detail": "audio transcription isn't configured", "instance": "/public/v1/conversations/cnv_2kd9c3f6j0m4q8u2y5bg/audio-sessions", "code": "audio.not_configured", "request_id": "req_abc123", "timestamp": "2026-02-15T12:00:00Z", "documentation_url": "https://docs.sparkle.ai/docs/api/errors/service-unavailable" } ``` Source: https://docs.sparkle.ai/docs/api/errors/service-unavailable.md