Overview

The PODDNA Brain API exposes a spoken-word intelligence layer as a reusable REST API. It powers transcript extraction, semantic analysis (entity detection, pattern recognition, claims tracking, speaker identification, contradiction detection), and automated content production.

Base URL for all endpoints:

https://<your-domain>/api/brain/
40+
Endpoints
REST
Protocol
JSON
Format

Authentication

All /api/brain/* endpoints require a valid API key sent via the Authorization header using the Bearer scheme.

Authorization: Bearer pk_brain_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Getting a key: API keys are created by administrators via the Admin API Key Management endpoints. Keys are shown only once upon creation — store them securely.

Keys are SHA-256 hashed before storage, so the raw key cannot be recovered. Each key has:

Rate Limits

Each API key has a per-minute rate limit. The current state is returned via response headers:

HeaderDescription
X-RateLimit-LimitMaximum requests per minute for this key
X-RateLimit-RemainingRequests remaining in current window
Retry-AfterSeconds until rate limit resets (only on 429)

When the limit is exceeded, the API returns HTTP 429 Too Many Requests with a Retry-After header.

Error Handling

All errors return JSON with an error field:

{
  "error": "Description of what went wrong"
}
CodeMeaning
400Bad request — missing or invalid parameters
401Unauthorized — missing or invalid API key
403Forbidden — key revoked or insufficient scope
404Resource not found
429Rate limit exceeded
500Internal server error

List Podcasts

GET /api/brain/catalog/podcasts ▶

Browse all processed podcasts with episode and speaker counts.

Response Example
[
  {
    "id": "uuid",
    "title": "My First Million",
    "image_url": "https://...",
    "episode_count": "24",
    "speaker_count": "5"
  }
]

List Episodes

GET /api/brain/catalog/episodes ▶

Browse analyzed episodes with intelligence metrics.

Query Parameters
NameTypeDescription
limitintegerMax results (default: 50)
offsetintegerPagination offset (default: 0)
podcastIdstringFilter by podcast UUID
qstringSearch episode titles
Response Example
[
  {
    "id": "uuid",
    "title": "How I Built a $10M Business",
    "published_at": "2025-01-15T00:00:00Z",
    "podcast_title": "My First Million",
    "podcast_id": "uuid",
    "statement_count": "150",
    "classification_count": "145",
    "relation_count": "12",
    "speaker_count": "3",
    "has_integrity_score": true
  }
]

Episode Processing Status

GET /api/brain/catalog/episodes/:episodeId/status ▶

Check which analysis steps have completed for an episode.

Response Example
{
  "episodeId": "uuid",
  "episodeTitle": "How I Built a $10M Business",
  "podcastTitle": "My First Million",
  "processing": {
    "transcribed": true,
    "statementsExtracted": true,
    "classified": true,
    "entitiesLinked": true,
    "topicsAssigned": true,
    "embedded": true,
    "relationsDiscovered": true,
    "speakersResolved": false,
    "contradictionsDetected": false,
    "integrityScored": false
  }
}

Validate YouTube Video

Pre-check a YouTube video before submitting it for processing. Returns video metadata, caption availability, duration checks, and whether it has already been processed.

POST /api/brain/validate-youtube ▶

Validate a YouTube video URL before ingestion. Checks: accessibility, age-restriction, live status, duration limit (3 hours), caption availability, and duplicate detection.

Query Parameters
NameTypeDescription
youtubeUrlstringFull YouTube URL (required). Supports youtube.com/watch, youtu.be, and /shorts/ formats.
Request Body
{
  "youtubeUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
Response Example
{
  "valid": true,
  "youtubeVideoId": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up",
  "durationSeconds": 212,
  "thumbnail": "https://img.youtube.com/vi/dQw4w9WgXcQ/mqdefault.jpg",
  "hasCaptions": true,
  "estimatedProcessingMinutes": 2,
  "captionNote": null,
  "alreadyProcessed": false,
  "existingEpisodeId": null
}
Rejection reasons: Private videos, age-restricted content, live streams, videos over 3 hours, and unavailable/removed videos are all rejected with a clear error message. If alreadyProcessed is true, you can skip ingestion and fetch results directly using the returned existingEpisodeId.

Viral Moments

Get Viral Moments

GET /api/brain/episodes/:episodeId/viral-moments ▶

Get all AI-detected viral moments for an episode. Each moment includes a virality score, suggested TikTok-style title, shareability factors, and platform recommendations.

Response Example
{
  "episodeId": "uuid",
  "episodeTitle": "How I Built a $10M Business",
  "count": 8,
  "moments": [
    {
      "id": "uuid",
      "momentKind": "viral",
      "startTime": 245,
      "endTime": 278,
      "durationSeconds": 33,
      "text": "I literally built the entire company from a $500 laptop...",
      "viralityScore": 92,
      "hookReason": "Rags-to-riches origin story with specific dollar amount creates aspirational content",
      "suggestedTitle": "He Built a $10M Company From a $500 Laptop",
      "pullQuote": "Built the entire company from a $500 laptop",
      "hookType": "underdog_story",
      "shareabilityFactors": ["aspirational", "quantified", "underdog"],
      "contentType": "story",
      "topics": ["entrepreneurship", "bootstrapping"],
      "entities": ["Stripe"],
      "platform": "tiktok",
      "displayOrder": 1
    }
  ]
}

Detect Viral Moments (Trigger Job)

POST /api/brain/episodes/:episodeId/detect-viral-moments ▶

Queue an AI-powered viral moment detection job using Claude's agentic 3-pass approach. The episode must have a transcript. Returns a job ID for status tracking.

Response Example
{
  "jobId": "uuid",
  "status": "queued",
  "episodeId": "uuid"
}
Detection approach: Uses Claude Sonnet 4.5 with a 3-pass agentic analysis: (1) initial scan for high-potential segments, (2) deep scoring of candidates, (3) final selection with virality scores 0-100. Typically finds 5-12 moments per episode. Requires 5-15 minutes for long episodes.

Processing Status

GET /api/brain/episodes/:episodeId/processing-status ▶

Detailed step-by-step processing status for an episode. Shows transcription and viral moment detection progress, providers used, error details, and overall status.

Response Example
{
  "episodeId": "uuid",
  "episodeTitle": "How I Built a $10M Business",
  "podcastTitle": "My First Million",
  "overallStatus": "processing",
  "steps": {
    "transcription": {
      "status": "ready",
      "provider": "youtube",
      "segmentCount": 342
    },
    "viralMoments": {
      "status": "processing",
      "count": 0
    }
  },
  "errors": []
}
Status values: not_started → pending → processing → ready (or failed). The overallStatus is complete when all requested analysis steps are ready, failed if any step failed, or processing while work is in progress.

Episode Detail

GET /api/brain/episodes/:episodeId ▶

Full aggregated intelligence payload for an episode. Use the include parameter to select which sections to load. Without it, all sections except transcript are returned.

Query Parameters
NameTypeDescription
includestringComma-separated: statements, entities, speakers, contradictions, patterns, narrative, viral_moments, transcript. Transcript excluded by default (large payload).
Response Example
{
  "id": "uuid",
  "title": "How I Built a $10M Business",
  "publishedAt": "2025-01-15T00:00:00Z",
  "podcastId": "uuid",
  "podcastTitle": "My First Million",
  "duration": 3600,
  "statements": [...],
  "entities": [...],
  "speakers": [...],
  "contradictions": [...],
  "patterns": [...],
  "narrative": { "chapters": [...], "segments": [...] }
}

Episode Statements

GET /api/brain/episodes/:episodeId/statements ▶

All extracted statements for an episode, optionally with classifications (claim flags, sentiment, certainty).

Query Parameters
NameTypeDescription
include_classificationsbooleanSet to 'false' to omit classifications (default: true)
Response Example
[
  {
    "id": "uuid",
    "text": "Revenue grew 40% year over year",
    "speaker": "Speaker 1",
    "start_time": 120,
    "end_time": 125,
    "claim_flag": true,
    "certainty": "high",
    "polarity": "positive",
    "sentiment": "confident"
  }
]

Episode Entities

GET /api/brain/episodes/:episodeId/entities ▶

Canonical entities mentioned in an episode (people, companies, products, etc.).

Response Example
[
  {
    "id": "uuid",
    "name": "Stripe",
    "type": "company",
    "external_refs": { "wikipedia": "..." },
    "mention_id": "uuid",
    "link_confidence": 0.95
  }
]

Episode Patterns

GET /api/brain/episodes/:episodeId/patterns ▶

Discovered relations between statements — supports, contradicts, reiterates, etc.

Response Example
[
  {
    "id": "uuid",
    "statementAId": "uuid",
    "statementBId": "uuid",
    "relation": "supports",
    "confidence": 0.87,
    "episodeId": "uuid"
  }
]

Episode Narrative

GET /api/brain/episodes/:episodeId/narrative ▶

AI-generated chapter structure and semantic segments for an episode.

Response Example
{
  "chapters": [
    {
      "id": "uuid",
      "title": "Opening - Background Story",
      "summary": "Host introduces the guest...",
      "start_time": 0,
      "end_time": 480,
      "display_order": 1,
      "confidence": 0.92
    }
  ],
  "segments": [
    {
      "id": "uuid",
      "topic_category": "business_strategy",
      "sub_topic": "growth_metrics",
      "intent": "inform",
      "start_time": 120,
      "end_time": 300,
      "importance_score": 0.85,
      "novelty_score": 0.7,
      "clipability_score": 0.6
    }
  ]
}

Episode Transcript

GET /api/brain/episodes/:episodeId/transcript ▶

Raw transcript segments with speaker labels and timestamps.

Response Example
[
  {
    "id": "uuid",
    "text": "So tell me about your journey...",
    "start_time": 0.5,
    "end_time": 3.2,
    "speaker": "Speaker 1",
    "type": "speech"
  }
]
GET /api/brain/search ▶

Natural language search across all analyzed statements using vector embeddings and cosine similarity.

Query Parameters
NameTypeDescription
qstringSearch query (required)
limitintegerMax results (default: 20)
episodeIdstringRestrict search to one episode
claimOnlybooleanOnly return flagged claims
Response Example
[
  {
    "statementId": "uuid",
    "episodeId": "uuid",
    "episodeTitle": "Every Business I Tried",
    "podcastTitle": "My First Million",
    "startTime": 120,
    "text": "Building the restaurant cost half a million dollars.",
    "score": 0.68,
    "similarity": 0.68,
    "topics": [],
    "entities": [],
    "claimFlag": false
  }
]

Speakers

List All Speakers

GET /api/brain/speakers ▶

Browse the canonical speaker identity graph.

Query Parameters
NameTypeDescription
limitintegerMax results (default: 100)
offsetintegerPagination offset (default: 0)
qstringSearch speakers by name
Response Example
[
  {
    "id": "uuid",
    "name": "Sam Parr",
    "aliases": ["sam", "Sam"],
    "podcastCount": 1,
    "episodeCount": 12
  }
]

Get Speaker

GET /api/brain/speakers/:id ▶

Get a single speaker with their cross-episode appearances.

Response Example
{
  "id": "uuid",
  "name": "Sam Parr",
  "aliases": ["sam"],
  "appearances": [
    {
      "episodeId": "uuid",
      "episodeTitle": "How I Built...",
      "speakerLabel": "Speaker 1",
      "podcastId": "uuid"
    }
  ]
}

Episode Speakers

GET /api/brain/episodes/:episodeId/speakers ▶

Get all resolved speakers for a specific episode.

Response Example
[
  { "id": "uuid", "name": "Sam Parr", "speakerLabel": "Speaker 1" }
]

Resolve Speakers (Trigger Job)

POST /api/brain/episodes/:episodeId/resolve-speakers ▶

Queue an AI-powered speaker resolution job for an episode. Uses Gemini to match speaker labels to canonical identities.

Response Example
{
  "jobId": "uuid",
  "status": "queued"
}

Contradictions

Get Contradictions

GET /api/brain/episodes/:episodeId/contradictions ▶

Get all detected contradictions within an episode.

Response Example
[
  {
    "id": "uuid",
    "statement_a_id": "uuid",
    "statement_b_id": "uuid",
    "relation": "contradicts",
    "confidence": 0.89,
    "statement_a_text": "We never raised any money",
    "statement_a_start_time": 120,
    "statement_b_text": "Our seed round was $2M",
    "statement_b_start_time": 845
  }
]

Detect Contradictions (Trigger Job)

POST /api/brain/episodes/:episodeId/detect-contradictions ▶

Queue an AI-powered contradiction detection job using Claude.

Response Example
{
  "jobId": "uuid",
  "status": "queued"
}

Topics

List Topics

GET /api/brain/topics ▶

Browse the hierarchical topic taxonomy with statement counts.

Response Example
[
  {
    "id": "uuid",
    "name": "Business Strategy",
    "slug": "business-strategy",
    "statement_count": "42"
  }
]

Topic Statements

GET /api/brain/topics/:topicId/statements ▶

Get statements associated with a specific topic.

Query Parameters
NameTypeDescription
limitintegerMax results (default: 50)
Response Example
[
  {
    "id": "uuid",
    "text": "We focused on product-market fit",
    "start_time": 320,
    "episode_id": "uuid",
    "episode_title": "How I Built...",
    "relevance": 0.95
  }
]

On-Demand Ingestion

Upload Audio File

POST /api/brain/upload ▶

Upload an audio file directly via multipart form data. Returns a storageUrl that you can then pass to /api/brain/ingest with type audio_file. Max file size: 500 MB. Accepted formats: mp3, wav, ogg, flac, aac, m4a, webm, wma, amr.

Query Parameters
NameTypeDescription
filebinaryAudio file (multipart form field, required). Max 500 MB.
Request Body
// multipart/form-data
// Field: file (binary audio file)

curl -X POST https://poddna.io/api/brain/upload \
  -H "Authorization: Bearer pk_brain_..." \
  -F "file=@/path/to/episode.mp3"
Response Example
{
  "storageUrl": "https://storage.googleapis.com/bucket/audio-uploads/uuid.mp3",
  "objectPath": "audio-uploads/uuid.mp3",
  "size": 15728640,
  "mimeType": "audio/mpeg",
  "originalName": "episode.mp3"
}
Two-step upload flow: (1) Upload the file to /api/brain/upload to get a storageUrl, then (2) pass that URL to /api/brain/ingest with "type": "audio_file". Alternatively, if your audio is already hosted publicly, skip step 1 and pass the URL directly.

Submit Content

POST /api/brain/ingest ▶

Submit YouTube URLs, RSS feeds, or audio files for processing. The system automatically creates an episode, transcribes the content, and chains any requested analysis. Use analysisTypes to request specific intelligence pipelines.

Query Parameters
NameTypeDescription
typestringOne of: rss_feed, youtube_url, audio_file (required)
sourceUrlstringURL to ingest — for audio_file, use the storageUrl from /api/brain/upload or any publicly accessible audio URL (required)
prioritystringnormal or high (default: normal)
analysisTypesstring[]Analysis pipelines to run after transcription. Options: viral_moments, narrative, entities, speakers, contradictions
callbackUrlstringURL to notify when complete
metadataobjectArbitrary metadata. For audio_file: title, durationSeconds, originalName are used if provided
Request Body
// YouTube URL
{
  "type": "youtube_url",
  "sourceUrl": "https://youtube.com/watch?v=VIDEO_ID",
  "analysisTypes": ["viral_moments"],
  "callbackUrl": "https://your-app.com/webhook"
}

// Audio file (after uploading via /api/brain/upload)
{
  "type": "audio_file",
  "sourceUrl": "https://storage.googleapis.com/bucket/audio-uploads/uuid.mp3",
  "analysisTypes": ["viral_moments"],
  "metadata": { "title": "My Episode", "durationSeconds": 3600 }
}

// Audio file (hosted externally)
{
  "type": "audio_file",
  "sourceUrl": "https://example.com/audio/episode.mp3",
  "analysisTypes": ["viral_moments"]
}
Response Example
{
  "id": "uuid",
  "status": "processing",
  "episodeId": "uuid"
}
YouTube pipeline: When type is youtube_url, the system: (1) creates an episode and source record, (2) queues transcript extraction (YouTube captions → Whisper → AssemblyAI fallback), (3) automatically chains requested analysisTypes after transcription completes. The episodeId is returned immediately so you can poll processing status.
Audio file pipeline: When type is audio_file, the system: (1) creates an episode and source record, (2) sends the audio to AssemblyAI for transcription (with speaker diarization, chapters, entity detection, topics, and key phrases), (3) automatically chains requested analysisTypes after transcription completes. Poll status via GET /api/brain/ingest/:id.

Callback Webhooks

Per-request webhook delivery. When you supply callbackUrl on POST /api/brain/ingest (or /api/brain/ingest/transcript), the system fires exactly one POST to that URL once all requested analysis is complete. No need to poll.

Payload (sent as JSON body):

{
  "event": "ingestion.complete",
  "ingestionRequestId": "uuid",
  "episodeId": "uuid",
  "sourceUrl": "https://youtube.com/watch?v=…",
  "type": "youtube_url",
  "completedAt": "2026-05-08T12:34:56.000Z",
  "analysisTypes": ["viral_moments"],
  "metadata": { "...your submitted metadata..." },
  "results": {
    "transcript": {
      "ready": true,
      "segmentCount": 1234,
      "fetchUrl": "https://poddna.replit.app/api/brain/episodes/<episodeId>/transcript"
    },
    "viralMoments": {
      "ready": true,
      "count": 12,
      "fetchUrl": "https://poddna.replit.app/api/brain/episodes/<episodeId>/viral-moments"
    }
  }
}

Headers:

Verification (Node):

import crypto from "crypto";
function verify(rawBody, headers, webhookSecret) {
  const sig = headers["x-brain-signature"].slice("sha256=".length);
  const ts  = headers["x-brain-signature-timestamp"];
  const expected = crypto.createHmac("sha256", webhookSecret)
    .update(ts + "." + rawBody).digest("hex");
  return crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
}

Retry policy: Up to 5 attempts with backoff: 10s, 30s, 2min, 10min. Your endpoint should return 2xx within 15 seconds. After 5 failed attempts, callbackStatus on the ingestion request is set to failed and no further attempts are made — you can still poll GET /api/brain/ingest/:id.

Delivery history: GET /api/brain/ingest/:id/deliveries returns every attempt (status code, response body excerpt, error message, duration) for debugging.

Get Ingestion Status

GET /api/brain/ingest/:id ▶

Check the status of a specific ingestion request. For YouTube URLs, includes real-time progress on transcript and analysis steps.

Response Example
{
  "id": "uuid",
  "type": "youtube_url",
  "sourceUrl": "https://youtube.com/watch?v=VIDEO_ID",
  "status": "processing",
  "episodeId": "uuid",
  "priority": "high",
  "processingSteps": [
    { "step": "transcript", "status": "complete", "completedAt": "..." },
    { "step": "viral_moments", "status": "processing" }
  ],
  "progress": {
    "transcriptReady": true,
    "transcriptSegments": 342,
    "viralMomentsReady": false,
    "viralMomentsCount": 0
  },
  "createdAt": "2025-01-15T00:00:00Z"
}

List Ingestion Requests

GET /api/brain/ingest ▶

List all ingestion requests, optionally filtered by status.

Query Parameters
NameTypeDescription
statusstringFilter by status (pending, processing, completed, failed)
limitintegerMax results (default: 50)
Response Example
[...]

Webhooks

Receive HMAC-SHA256 signed event notifications when intelligence jobs complete. Events are delivered via HTTP POST to your registered URL. Webhooks auto-disable after 10 consecutive delivery failures.

Available events: episode.analyzed, episode.transcribed, episode.ingested, entities.extracted, patterns.detected, contradictions.detected, speakers.resolved, topics.updated

List Webhooks

GET /api/brain/webhooks ▶

List all registered webhooks.

Response Example
[
  {
    "id": "uuid",
    "url": "https://your-app.com/webhook",
    "events": ["episode.analyzed", "entities.extracted"],
    "isActive": true,
    "description": "Main integration"
  }
]

Create Webhook

POST /api/brain/webhooks ▶

Register a new webhook endpoint.

Query Parameters
NameTypeDescription
urlstringDelivery URL (required)
secretstringHMAC-SHA256 signing secret (required)
eventsstring[]Event types to subscribe to (required)
descriptionstringHuman-readable description
Request Body
{
  "url": "https://your-app.com/webhook",
  "secret": "your-webhook-signing-secret",
  "events": ["episode.analyzed", "entities.extracted"],
  "description": "My app integration"
}
Response Example
{
  "id": "uuid",
  "url": "https://your-app.com/webhook",
  "events": ["episode.analyzed", "entities.extracted"],
  "isActive": true
}

Update Webhook

PATCH /api/brain/webhooks/:id ▶

Update an existing webhook.

Request Body
{
  "events": ["episode.analyzed"],
  "isActive": false
}
Response Example
{ ... }

Delete Webhook

DELETE /api/brain/webhooks/:id ▶

Delete a webhook.

Response Example
{ "success": true }

Test Webhook

POST /api/brain/webhooks/:id/test ▶

Send a test delivery to a webhook endpoint.

Response Example
{ "success": true }

Submit Pre-Made Transcript

Submit a pre-made transcript directly — skip the transcription step entirely. The Brain API creates an episode, stores all segments immediately, marks the transcript as ready, and optionally queues analysis jobs (claims, viral moments, statements). This is the fastest way to get content into the intelligence layer when you've already transcribed the audio yourself (e.g., via Gemini Flash, Whisper, etc.).

POST /api/brain/ingest/transcript ▶

Submit a pre-made transcript with segments. Episode is ready immediately — no transcription wait.

Query Parameters
NameTypeDescription
titleundefinedEpisode title (falls back to metadata.title, then 'Untitled Transcript')
sourceUrlundefinedOptional URL to the original audio/video file
segmentsundefinedArray of transcript segments. Each must have: startMs (number), endMs (number), text (string). Optional: speaker (string), type (string, default 'dialogue'). Max 10,000 segments.
metadataundefinedOptional metadata object. Supports: platform, type ('audio'/'video'), recordedAt (ISO date), plus any custom fields
analysisTypesundefinedOptional array of analysis jobs to queue after import. Valid: 'viral_moments', 'claims', 'statements'
Request Body
{
  "title": "Lecture 12 - Cell Biology",
  "sourceUrl": "https://example.com/audio/lecture12.webm",
  "segments": [
    { "startMs": 0, "endMs": 4500, "text": "Welcome to today's lecture on cell biology.", "speaker": "Professor Smith" },
    { "startMs": 4500, "endMs": 12000, "text": "We'll be covering mitochondrial function and ATP synthesis.", "speaker": "Professor Smith" },
    { "startMs": 12000, "endMs": 18000, "text": "Can you remind us what we covered last week?", "speaker": "Student" }
  ],
  "metadata": {
    "platform": "crambo",
    "type": "audio",
    "recordedAt": "2026-03-10T14:00:00Z",
    "courseId": "BIO-201",
    "courseName": "Cell Biology"
  },
  "analysisTypes": ["claims"]
}
Response Example
{
  "id": "ing-request-uuid",
  "episodeId": "episode-uuid",
  "status": "complete",
  "segmentCount": 3,
  "queuedAnalysis": ["claims"]
}

Cross-Episode Intelligence

Synthesize insights across multiple episodes using AI. Send a list of episode IDs and a natural language query — the engine pulls transcript segments, claims, and chapter data from all specified episodes, then generates a structured cross-episode analysis. Works for any use case: sales call pattern analysis, lecture theme extraction, podcast series summaries, etc.

POST /api/brain/episodes/synthesize ▶

AI-powered cross-episode synthesis. Analyzes up to 50 episodes and returns themes, patterns, per-episode summaries, and a narrative that answers your query.

Query Parameters
NameTypeDescription
episodeIdsundefinedArray of episode IDs to synthesize across (min 2, max 50)
queryundefinedNatural language question to answer using cross-episode data
outputFormatundefinedOptional. 'structured' (default) for concise narrative, 'narrative' for longer prose
Request Body
{
  "episodeIds": ["ep-id-1", "ep-id-2", "ep-id-3"],
  "query": "What are the recurring themes and how do they evolve across these episodes?",
  "outputFormat": "structured"  // or "narrative" for longer prose
}
Response Example
{
  "synthesis": {
    "themes": [
      {
        "theme": "Pricing Transparency",
        "description": "Prospects consistently ask about pricing structure...",
        "episodeEvidence": [
          { "episodeId": "ep-id-1", "episodeTitle": "Demo Call - Acme", "evidence": "Prospect asked about per-user pricing..." }
        ],
        "frequency": 3
      }
    ],
    "patterns": [
      {
        "pattern": "Demo-First Strategy",
        "description": "The seller consistently demonstrates the product before addressing pricing...",
        "episodeIds": ["ep-id-1", "ep-id-2"]
      }
    ],
    "narrative": "Across these 3 episodes, the most common theme is...",
    "episodeSummaries": [
      { "episodeId": "ep-id-1", "title": "Demo Call - Acme", "keyContribution": "Introduced the pricing objection pattern..." }
    ]
  },
  "meta": {
    "episodesRequested": 3,
    "episodesAnalyzed": 3,
    "episodesSkipped": 0,
    "totalSegments": 1200,
    "totalClaims": 85,
    "query": "What are the recurring themes...",
    "outputFormat": "structured"
  }
}

Import from Shared Zoom Link

Import a Zoom cloud recording from a shared link. No Zoom API credentials required — works with any publicly shared Zoom recording URL from any Zoom domain (zoom.us, company.zoom.us, etc.). The system extracts the recording metadata, downloads the VTT transcript, stores the meeting, and optionally converts it to an episode with AI analysis queued automatically.

POST /api/brain/zoom/import-shared-link ▶

Import a Zoom recording from a shared link URL.

Query Parameters
NameTypeDescription
urlstringRequired. Shared Zoom recording URL (/rec/play/... or /rec/share/...)
autoConvertbooleanAuto-convert to episode for analysis (default: true)
autoAnalyzebooleanAuto-queue AI analysis after conversion (default: true)
Request Body
{
  "url": "https://zoom.us/rec/play/aBcDeFgHiJkLmNoPqRsTuVwXyZ...",
  "autoConvert": true,
  "autoAnalyze": true
}
Response Example
{
  "success": true,
  "meetingId": "shared_1773101117985",
  "topic": "Product Demo - Acme Corp",
  "duration": 1800,
  "startTime": "2026-03-06T14:43:26.000Z",
  "transcriptFound": true,
  "utteranceCount": 538,
  "hasSpeakers": true,
  "episodeId": "9cec763f-f854-496c-b4db-5c4ce6ae9e76",
  "analysisJobId": "d26b3356-4a85-4855-b797-388afff8c49e"
}
Supported URL formats:
  • https://zoom.us/rec/play/abc123...
  • https://company-name.zoom.us/rec/play/abc123...
  • https://zoom.us/rec/share/abc123...

The recording must be publicly shared (no passcode). Imported meetings get IDs prefixed with shared_. Once imported, use the List Meetings and Meeting Detail endpoints to access the data. Analysis results are available once the queued job completes (typically 1-2 minutes).

List Zoom Meetings

Retrieve Zoom meeting records with metadata, filterable by company name and date range. Meetings include editable fields (company, contact, notes, tags) that can be populated manually or auto-extracted by AI during analysis.

GET /api/brain/zoom/meetings ▶

List Zoom meetings with metadata and analysis status.

Query Parameters
NameTypeDescription
companystringFilter by company name (case-insensitive partial match)
afterISO dateOnly meetings after this date
beforeISO dateOnly meetings before this date
limitintegerMax results (default: 50, max: 200)
offsetintegerPagination offset (default: 0)
Response Example
{
  "total": 85,
  "offset": 0,
  "limit": 50,
  "meetings": [
    {
      "zoomMeetingId": "85412367890",
      "topic": "SignWell Demo - Acme Corp",
      "startTime": "2026-02-15T14:00:00.000Z",
      "durationSec": 1800,
      "hostEmail": "wayne@signwell.com",
      "companyName": "Acme Corp",
      "contactName": "Jane Smith",
      "meetingDate": "2026-02-15T14:00:00.000Z",
      "notes": "Initial discovery call",
      "tags": ["discovery", "enterprise"],
      "hasTranscript": true,
      "episodeId": "uuid",
      "hasAnalysis": true
    }
  ]
}

Zoom Meeting Detail

Get a single Zoom meeting with full metadata, transcript status, and analysis summary including claim counts by type.

GET /api/brain/zoom/meetings/:meetingId ▶

Get detailed meeting information including analysis summary.

Query Parameters
NameTypeDescription
meetingIdstringZoom meeting ID (path parameter)
Response Example
{
  "zoomMeetingId": "85412367890",
  "topic": "SignWell Demo - Acme Corp",
  "startTime": "2026-02-15T14:00:00.000Z",
  "durationSec": 1800,
  "hostEmail": "wayne@signwell.com",
  "companyName": "Acme Corp",
  "contactName": "Jane Smith",
  "meetingDate": "2026-02-15T14:00:00.000Z",
  "notes": "Initial discovery call",
  "tags": ["discovery", "enterprise"],
  "year": 2026,
  "hasTranscript": true,
  "hasSpeakerLabels": true,
  "episodeId": "uuid",
  "analysis": {
    "analysisVersion": 2,
    "analyzedAt": "2026-02-16T10:00:00.000Z",
    "claimCounts": {
      "buyer_claim": 8,
      "gate_check": 3,
      "decision_signal": 4,
      "risk_frame": 2,
      "seller_emphasis": 5
    }
  }
}

Follow Podcast

Record that a user follows a podcast. The Brain API stores only follows — seen state, interests, and reading position are the responsibility of the calling frontend (e.g. Lovable). Podcast must already exist in PodDNA (use Search External Podcasts to get the podDnaId).

POST /api/brain/user/:userId/follow ▶

Follow a podcast. Returns 409 if already following.

Query Parameters
NameTypeDescription
userIdstringExternal user ID (path parameter) — any opaque string, owned by the calling app
podcastIdstring (body)PodDNA podcast UUID (from catalog or search results)
Request Body
{
  "podcastId": "2806539a-aaf4-4dcd-8922-acaa9868351a"
}
Response Example
{
  "success": true,
  "podcastId": "2806539a-aaf4-4dcd-8922-acaa9868351a",
  "userId": "user_abc123"
}

Unfollow Podcast

DELETE /api/brain/user/:userId/follow/:podcastId ▶

Remove a podcast follow. No-ops silently if not following.

Query Parameters
NameTypeDescription
userIdstringExternal user ID (path parameter)
podcastIdstringPodDNA podcast UUID (path parameter)
Response Example
{
  "success": true
}

List Follows

GET /api/brain/user/:userId/follows ▶

Return the list of podcasts a user follows, with metadata.

Query Parameters
NameTypeDescription
userIdstringExternal user ID (path parameter)
Response Example
{
  "userId": "user_abc123",
  "count": 3,
  "follows": [
    {
      "podcastId": "2806539a-aaf4-4dcd-8922-acaa9868351a",
      "followedAt": "2026-04-01T09:30:00Z",
      "podcast": {
        "id": "2806539a-aaf4-4dcd-8922-acaa9868351a",
        "title": "Acquired",
        "imageUrl": "https://...",
        "author": "Ben Gilbert and David Rosenthal"
      }
    }
  ]
}

Personalized Feed

Returns a ranked feed of moments from podcasts the user follows. Only the 50 most recent processed episodes per followed podcast are considered — this keeps the feed fresh and prevents a 1000-episode back-catalog from flooding new follows. If the user has no follows yet, the feed falls back to the global trending feed. Supports cursor-based pagination and client-side filtering.

GET /api/brain/user/:userId/feed ▶

Ranked moment feed, personalised to the user's followed podcasts.

Query Parameters
NameTypeDescription
userIdstringExternal user ID (path parameter)
limitintegerMax moments to return (default: 20, max: 100)
cursorstringOpaque pagination cursor from a previous response's nextCursor
topicsstringComma-separated topic slugs to filter by (e.g. ai,strategy)
minScoreintegerMinimum virality_score (0–100) to include. Moments below this threshold are excluded. Negative values are silently ignored; 0 is accepted and applies no floor.
excludeIdsstringComma-separated moment UUIDs to omit — use this to exclude moments the user has already seen (Lovable manages seen state)
Response Example
{
  "userId": "user_abc123",
  "count": 20,
  "nextCursor": "eyJzY29yZSI6IjAuODIiLCJjcmVhdGVkQXQiOiIyMDI2LTA0LTAxVDEwOjAwOjAwWiIsImlkIjoiYWJjIn0=",
  "moments": [
    {
      "id": "uuid",
      "text": "The real moat is distribution, not technology",
      "startTime": 1234,
      "endTime": 1267,
      "rankScore": 0.94,
      "topics": ["strategy", "tech"],
      "podcastId": "uuid",
      "podcastTitle": "Acquired",
      "podcastImageUrl": "https://...",
      "episodeId": "uuid",
      "episodeTitle": "Jensen Huang",
      "publishedAt": "2026-03-20T00:00:00Z"
    }
  ]
}
Seen state is Lovable's responsibility. The Brain API does not track which moments a user has seen. Pass excludeIds on each request with the IDs of moments already shown. The feed cursor handles chronological pagination; excludeIds handles client-side deduplication within a session.

Global feed of high-scoring moments across all podcasts, ordered by rank score. Not personalised — use the Personalized Feed for user-specific results.

GET /api/brain/discover/trending-moments ▶

Return the top trending moments across the whole catalog.

Query Parameters
NameTypeDescription
limitintegerMax moments (default: 20, max: 100)
cursorstringPagination cursor from previous response
topicsstringComma-separated topic slugs to filter
minScoreintegerMinimum virality_score (0–100) to include. Moments below this threshold are excluded. Negative values are silently ignored; 0 is accepted and applies no floor.
excludeIdsstringComma-separated moment UUIDs to exclude
Response Example
{
  "count": 20,
  "nextCursor": "eyJzY29yZSI6IjAuNzMiLCJjcmVhdGVkQXQiOiIyMDI2LTA0LTAxVDA4OjAwOjAwWiIsImlkIjoieHl6In0=",
  "moments": [
    {
      "id": "uuid",
      "text": "We're at an inflection point for AI in healthcare",
      "startTime": 540,
      "endTime": 574,
      "rankScore": 0.97,
      "topics": ["ai", "healthcare"],
      "podcastId": "uuid",
      "podcastTitle": "The Knowledge Project",
      "episodeTitle": "The Future of Medicine",
      "publishedAt": "2026-03-28T00:00:00Z"
    }
  ]
}

Discover Podcasts

Browse podcasts already in PodDNA, ordered by episode count and activity. Useful for building an onboarding screen where users pick podcasts to follow.

GET /api/brain/discover/podcasts ▶

Paginated list of podcasts in PodDNA for discovery.

Query Parameters
NameTypeDescription
limitintegerMax results (default: 20, max: 100)
cursorstringOffset-based pagination cursor from previous response
qstringOptional keyword search against podcast titles/authors
Response Example
{
  "count": 10,
  "nextCursor": "eyJvZmZzZXQiOjEwfQ==",
  "podcasts": [
    {
      "id": "uuid",
      "title": "Lex Fridman Podcast",
      "author": "Lex Fridman",
      "imageUrl": "https://...",
      "episodeCount": 420,
      "momentCount": 3800,
      "topTopics": ["ai", "physics", "consciousness"]
    }
  ]
}

Suggest Categories

Returns the most popular topic slugs in the catalog. Useful for building a topic-picker UI during onboarding.

GET /api/brain/categories/suggest ▶

Return top topic slugs by moment frequency.

Query Parameters
NameTypeDescription
limitintegerMax categories to return (default: 20)
Response Example
{
  "categories": [
    { "slug": "entrepreneurship", "label": "Entrepreneurship", "momentCount": 4200 },
    { "slug": "ai", "label": "AI", "momentCount": 3800 },
    { "slug": "investing", "label": "Investing", "momentCount": 2900 }
  ]
}

Search across moments, episodes, and podcasts in a single request. Returns ranked results per type.

GET /api/brain/search/unified ▶

Keyword search across moments, episodes, and podcasts.

Query Parameters
NameTypeDescription
qstringSearch query (required)
limitintegerMax results per type (default: 5)
Response Example
{
  "query": "interest rates",
  "moments": [
    {
      "id": "uuid",
      "text": "Interest rates are the gravity of finance",
      "podcastTitle": "We Study Billionaires",
      "episodeTitle": "Warren Buffett's Framework"
    }
  ],
  "episodes": [
    {
      "id": "uuid",
      "title": "The Fed and You",
      "podcastTitle": "Planet Money"
    }
  ],
  "podcasts": [
    {
      "id": "uuid",
      "title": "Macro Voices"
    }
  ]
}

Search External Podcasts

Search the Podcast Index directory for podcasts and cross-reference with PodDNA. Use this to let users discover podcasts from the broader internet — results include an inPodDNA flag so your UI can show a Follow button (if already in PodDNA) or a Request to add button (if not yet imported).

GET /api/brain/search/podcasts ▶

Search Podcast Index, return results annotated with PodDNA presence.

Query Parameters
NameTypeDescription
qstringSearch query (required)
limitintegerMax results (default: 10, max: 20)
Response Example
{
  "source": "podcast_index",
  "count": 5,
  "podcasts": [
    {
      "podDnaId": "2806539a-aaf4-4dcd-8922-acaa9868351a",
      "podcastIndexFeedId": "48166",
      "title": "Acquired",
      "author": "Ben Gilbert and David Rosenthal",
      "description": "The history and strategy of great technology companies.",
      "artworkUrl": "https://...",
      "categories": ["Technology", "Business"],
      "totalEpisodeCount": 156,
      "recentEpisodeCount": 50,
      "inPodDNA": true
    },
    {
      "podDnaId": null,
      "podcastIndexFeedId": "745287",
      "title": "Earn Your Leisure",
      "author": "iHeartPodcasts",
      "description": "Financial literacy and wealth building.",
      "artworkUrl": "https://...",
      "categories": ["Business"],
      "totalEpisodeCount": 1000,
      "recentEpisodeCount": 50,
      "inPodDNA": false
    }
  ]
}
Suggested UX:
  • inPodDNA: true → show Follow button — call POST /user/:userId/follow with the returned podDnaId
  • inPodDNA: false → show Add & Follow button — call POST /podcasts/import with the feedUrl, then follow the returned podDnaId

Episode counts: totalEpisodeCount is the raw Podcast Index backlog (can be 1000+). recentEpisodeCount is capped at 50 — this is the number of recent episodes the feed will surface moments from. Show recentEpisodeCount in your UI so users see "50 episodes" not "1000 episodes".

Falls back to local PodDNA search if Podcast Index API credentials (PODCAST_INDEX_API_KEY / PODCAST_INDEX_API_SECRET) are not configured. The source field in the response indicates which backend was used (podcast_index or local).

Import Podcast from RSS

Import any podcast into PodDNA from its RSS feed URL (or Podcast Index feed ID). The Brain parses the feed, creates the podcast record, and queues the most recent episodes for transcription and viral moment detection. Once processing completes, moments appear in the user's feed automatically.

This is the second step of the "Add & Follow" flow for podcasts that return inPodDNA: false from Search External Podcasts.

POST /api/brain/podcasts/import ▶

Import a podcast by RSS feed URL and queue its recent episodes for processing.

Query Parameters
NameTypeDescription
feedUrlstringRSS feed URL of the podcast. Pass the feedUrl returned by Search External Podcasts.
podcastIndexFeedIdstringAlternative to feedUrl: Podcast Index numeric feed ID. The Brain resolves the feed URL automatically (requires Podcast Index API credentials).
episodeLimitintegerMax number of recent episodes to import and queue (default: 10, max: 50). Only applies on first import.
Request Body
{
  "feedUrl": "https://www.lennyspodcast.com/feed",
  "episodeLimit": 10
}
Response Example
{
  "podDnaId": "2806539a-aaf4-4dcd-8922-acaa9868351a",
  "title": "Lenny's Podcast: Product | Career | Growth",
  "artworkUrl": "https://...",
  "status": "importing",
  "episodesQueued": 10,
  "alreadyExisted": false
}
Full Add & Follow flow:
  1. User searches → GET /search/podcasts?q=... → gets result with inPodDNA: false and a feedUrl
  2. Call POST /podcasts/import with that feedUrl → get back podDnaId and status: "importing"
  3. Call POST /user/:userId/follow with podDnaId immediately — no need to wait for processing
  4. Episodes are transcribed and analysed in the background. Moments appear in the user's feed as they complete (typically within a few minutes per episode).

Idempotent: calling import on a podcast already in PodDNA returns status: "already_imported" and the existing podDnaId — safe to call multiple times.

Status field: importing = new import, processing started. already_imported = podcast was already in PodDNA, nothing changed.

API Key Management

Admin only. These endpoints require admin session authentication (not Brain API key auth). They are used to create and manage API keys for external consumers.

Create API Key

POST /api/admin/brain-keys ▶

Create a new Brain API key. The raw key is returned only once.

Query Parameters
NameTypeDescription
namestringKey name/label (required)
scopesstring[]Permissions (default: ["read"])
rateLimitPerMinintegerRate limit (default: 60)
Request Body
{
  "name": "Production App",
  "scopes": ["read"],
  "rateLimitPerMin": 120
}
Response Example
{
  "id": "uuid",
  "name": "Production App",
  "keyPrefix": "pk_brain_40782a",
  "scopes": ["read"],
  "rateLimitPerMin": 120,
  "isActive": true,
  "rawKey": "pk_brain_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "note": "Save this key now. It will not be shown again."
}

List API Keys

GET /api/admin/brain-keys ▶

List all API keys (hashes are not returned).

Response Example
[
  {
    "id": "uuid",
    "name": "Production App",
    "keyPrefix": "pk_brain_40782a",
    "scopes": ["read"],
    "rateLimitPerMin": 120,
    "isActive": true,
    "lastUsedAt": "2025-01-15T10:30:00Z"
  }
]

Update API Key

PATCH /api/admin/brain-keys/:id ▶

Update key properties (name, scopes, rate limit, active status).

Request Body
{
  "rateLimitPerMin": 200,
  "isActive": true
}
Response Example
{ ... }

Revoke API Key

DELETE /api/admin/brain-keys/:id ▶

Permanently revoke an API key.

Response Example
{ "success": true }