# Flarea API v1

AI-first live show platform. This API is designed to be driven by agents
(Claude Code, Codex, cursor agents, plain curl). Everything a host can do,
your agent can do.

Base URL: https://api.flarea.ai/api/v1
Auth: Authorization: Bearer <your API key>   (get it from your dashboard → API)

## Endpoints

GET    /api/v1                                this document
GET    /api/v1/events                         list your events (+registration counts)
POST   /api/v1/events                         create event (AI also writes the signup-page copy)
       body: { "title": "...", "brief": "guests, topics, key points",
               "starts_at": "2026-07-06T18:00:00Z",   // optional ISO
               "theme": "editorial|collage|retro|midnight",  // optional
               "social": "@yourhandle",        // optional
               "generate_show_plan": true,     // default true: AI builds segments, ticker, questions + signup copy
               "guests": [ { "name": "...", "title": "...", "company": "...",
                             "intro": "host reads on air", "emcee": "MC walk-on line", "photo": "https://…" } ],
               "emcee": { "voice": "onyx|echo|fable|nova|shimmer|alloy", "intro": "show-opener script" },
               "reminders": { "h24": true, "h1": true, "live": true, "changed": true },
               "signup": { "headline": "...", "sub": "...", "config": { "cta_text": "...", "show_agenda": true } },
               "brand": { "accent": "#FF4D00", "logo": "https://…" } }
       → returns slug + links (studio, signup page, legacy stage-request door, viewer link)
GET    /api/v1/events/{slug}                  { event: {…config, reminders, emcee_voice, guest_count, registrations},
                                                sessions: [...], cta_clicks: [...] }
PATCH  /api/v1/events/{slug}                  update any of:
                                                { title?, description?, starts_at?, theme?, social?,
                                                  signup?, emcee?, reminders?, guests?, brand?, plan?, questions? }
                                                plus the setup fields listed in the OpenAPI document (timezone, ends_at,
                                                host, language, after, watch, survey, …). Dates are ISO 8601 WITH a zone;
                                                moving starts_at moves ends_at with it. guests is MERGED onto the roster
                                                (send only the guests to add or change; { "id": "…", "remove": true } removes
                                                one) and needs the guests:write scope.
DELETE /api/v1/events/{slug}                  delete event
GET    /api/v1/events/{slug}/registrations    attendee list (name, email, created_at)
POST   /api/v1/events/{slug}/registrations    add an attendee   body: { "name": "...", "email": "..." }
POST   /api/v1/events/{slug}/registrations/bulk
                                                setup-page equivalent for people already signed up elsewhere:
                                                { "records": [{ "name": "...", "email": "...", "marketing_consent": false }],
                                                  "enrollment_mode": "external_signup", "send_confirmation": true,
                                                  "source_attestation": { "source_type": "opt_in_list", "source_detail": "LinkedIn Lead Gen form ..." } }
                                                max 5 per call; requires registrations:write + communications:send;
                                                dedupes, honors unsubscribes, sends confirmation + calendar invite, and enrolls reminders.
DELETE /api/v1/events/{slug}/registrations    remove an attendee   ?email=person@co.com
GET    /api/v1/events/{slug}/recordings       program file, per-speaker tracks, rendered clips (public URLs)
GET    /api/v1/events/{slug}/analytics        deep post-show analytics — the same numbers as the in-app report:
                                                registered, attended, peak_concurrent, duration_min, avg_watch_min,
                                                completion_pct, cta_clicks_total, chat totals (real vs synthetic),
                                                replay_views, nps {avg,count}, polls, retention (per-minute curve,
                                                chartable as-is), attendees (per-person watch time + engagement,
                                                sorted by minutes — join on email for lead scoring)
GET    /api/v1/events/{slug}/studio           live status (host present, people) + the full command catalog
POST   /api/v1/events/{slug}/studio           drive the LIVE show (requires the host on air; 409 otherwise):
                                                { "action": "set_layout", "layout": "duo|present|solo|grid" }
                                                { "action": "go_scene", "index": 0 }        // -1 = last scene
                                                { "action": "add_scene", "scene_type": "hot_take", "layout"?: "duo" }
                                                { "action": "confetti" }  // one-shots: show_deck hide_deck next_slide
                                                  // prev_slide quote_card confetti applause flowers show_whiteboard
                                                  // show_video clear_stage zoom_in zoom_out zoom_reset immersive_on
                                                  // immersive_off music_start music_stop
                                                { "command": "bring up the slides and hit confetti" }  // natural language,
                                                  // the same voice-agent path as saying "Flarea, …" on air
                                                { "scene": { ... } }  // raw scene-state patch (advanced)

## Studio control (live-show API)

The studio endpoint gives an agent FULL control of a show while it's on air — layouts, run-of-show
navigation, slides, sound, effects — through the same execution paths as the host's own voice
commands. Commands are validated server-side and injected into the live room; the host's studio
applies them instantly. A show with no host on air returns 409 not_live.

## Shorts & clips (post-show API — full control of the native clip engine)

GET    /api/v1/events/{slug}/shorts           everything: analysis (ranked moments + predicted
                                                virality scores), clip slots used/cap, live render
                                                jobs (stage + progress), finished clips (MP4 +
                                                thumbnail URLs), and a self-describing catalog of
                                                every template/style knob
POST   /api/v1/events/{slug}/shorts/analyze   rank the episode's best moments (cached per source;
                                                uploads with no transcript whisper on the worker →
                                                {pending:true}, poll the GET). Optional
                                                { "auto_render": true, "n": 3 } also renders the
                                                top N picks in one call.
POST   /api/v1/events/{slug}/shorts/render    render or RE-render (edit) one clip:
                                                { "start_sec": 120, "end_sec": 150,   // 5-120s
                                                  "template_id": "editorial_motion|speaker_focus",
                                                  "orientation": "vertical|horizontal|square",
                                                  "caption": { "preset": "impact|pill|block|underline|bracket|minimal", "size": "sm|md|lg" },
                                                  "motion": "calm|standard|energetic",
                                                  "highlight_hex": "#FF4D00", "logo": true,
                                                  "kicker": "PIPELINE MATH", "title": "…", "speaker": "…",
                                                  "removeSilences": true, "improveSound": true, "removeFillers": false,
                                                  "focusMode": "auto|pin|off", "focusSpeaker": "Dana", "focusTile": 0,
                                                  "followCta": false, "followHandle": "@you", "timerBadge": false }
                                                Re-rendering the same moment with new style never
                                                consumes another clip slot. focusMode "pin" holds one
                                                speaker for the whole clip (by name, or by tile index
                                                when name tags are unreadable); an unmatchable pin
                                                renders the full frame — never a guessed face.
POST   /api/v1/events/{slug}/shorts/prompt    { "prompt": "clip of the right speaker summarising
                                                the interview, fast cuts, no filler words" }
                                                One request → parsed plan → brief-ranked moment →
                                                one queued render. Response: job_id, the resolved
                                                plan/segment, and notes for anything that degraded.
POST   /api/v1/events/{slug}/shorts/jobs      { "job_id": N, "action": "cancel" }  (only while queued)
POST   /api/v1/events/{slug}/shorts/segments  { "segment_id": N, "action": "archive" }        free the slot
                                              { "segment_id": N, "action": "note", "note": "…" } private note

## The MC — Master of Ceremonies (AI announcer)

Set emcee.voice + emcee.intro to script the show-opener, and guests[].emcee to script each guest's
walk-on line — both spoken live by an AI announcer. The legacy guest_link is a receive-only audience
door: an attendee can watch there and the host can privately invite them on stage, but it does not grant
camera or microphone publishing by itself. For a scheduled guest, create a personal backstage URL with
POST /api/v1/events/{slug}/guests/{guest_id}/access-link and send the returned backstage_url. Leave a
script blank and it is auto-written at showtime.

## Reminders

reminders toggles the automatic emails off the start time: h24 (24h before), h1 (1h before),
live (going live), changed (details changed). Confirmation on sign-up is always on.

## Example

curl -s -X POST https://api.flarea.ai/api/v1/events \
  -H "Authorization: Bearer $FLAREA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"AI Risks Worth Talking About","brief":"Fireside with Marge Simpson, CISO at ACME, about AI risk. Cover: model risk nobody budgets for, war stories, audience hot seat.","starts_at":"2026-07-06T18:00:00Z"}'

## For agents

Recommended setup in Claude Code / any CLI agent — add to your project notes:
"Flarea manages my live events. API key in $FLAREA_API_KEY.
Read https://api.flarea.ai/api/v1 for the API, then create/list/update
events and pull attendee lists as asked."

## Sales intelligence — call analysis + coaching (Clincher)

Capture, analyze, and search sales calls — and close ON the call.
Auth: Authorization: Bearer cl_sk_…  (mint at POST /api/v1/keys, revoke with DELETE /api/v1/keys?id=…).
Credits: every workspace gets $10/mo of engine credits free; each call is priced in cents
(analyze 4¢ · extract 2¢ · ask/followup/trackers 1¢ · rollup 4¢ · close FREE). 402 = CREDITS_EXHAUSTED.

POST /api/v1/analyze       transcript → summary, sentiment, talk-ratio, objections, MEDDIC/BANT scoring, risks, next steps, coaching (one call; auto-indexes for /ask)
POST /api/v1/ask           { question } → cited answer across the workspace's whole call history + knowledge base (RAG, honest "I don't know")
POST /api/v1/followup      { summary | transcript, contact_name?, tone? } → { subject, body } follow-up email
POST /api/v1/close         { title, line_items:[{name,qty,unit_price}], customer? } → deal + ready-to-sign proposal link (close ON the call)
POST /api/v1/extract       transcript → CRM fields (contact, company, deal value, products, next steps, stage)
POST /api/v1/draft         transcript → follow-up email or proposal outline (freeform cousin of /followup)
POST /api/v1/trackers      { trackers:[...] } → semantic mentions across all calls
POST /api/v1/rollup        { transcripts:[...] } → multi-call deal momentum + risk + next step
POST /api/v1/calls/bot     { meeting_url } → send a notetaker bot into the call
GET  /api/v1/usage         this month's metered usage + remaining allowance (free)
GET  /api/v1/openapi.json  machine-readable OpenAPI 3.1 for all of the above
POST /api/mcp              MCP server — the same primitives exposed as agent tools

Quickstart (full sales-call intelligence in 20 lines): github.com/asafktz/webinar-show/blob/main/docs/API_QUICKSTART.md
Reference app: github.com/asafktz/webinar-show/tree/main/examples/clincher-demo · LLM digest: /llms.txt
