{
  "name": "SeaMeet Sync Pro API task recipes",
  "version": "0.1.0",
  "baseUrls": {
    "production": {
      "syncApi": "https://api.seameet.ai/functions/v1/sync-api",
      "mediaStt": "https://seameet-stt-proxy.seameet.workers.dev",
      "documents": "https://mcp.seameet.ai/v1/recordings",
      "summarize": "https://api.seameet.ai/functions/v1/summarize-asset"
    }
  },
  "routingRules": [
    "Do not call /sync-api#delta or any /sync-api#... path.",
    "OpenAPI /sync-api#... entries are documentation anchors only.",
    "Always POST to the Sync API base URL with an op value in the JSON body.",
    "Normal public API clients authenticate to the Sync API with only X-Api-Key.",
    "The Media/STT Worker is separate from the Sync API. POST /v1/file/jobs (write key) and GET /v1/file/budget (read or write key) accept X-Api-Key; /v1/file, /v1/gemini-push and /v1/stream need a first-party app session; /v1/health is unauthenticated.",
    "Realtime STT is a WebSocket at wss://<media-stt-host>/v1/stream and is documented in /api/stream-protocol.md, not OpenAPI."
  ],
  "headers": {
    "personalApiKey": {
      "X-Api-Key": "smk_<40 hex>",
      "Content-Type": "application/json"
    },
    "firstPartySession": {
      "Authorization": "Bearer <supabase-user-access-token>",
      "Content-Type": "application/json"
    }
  },
  "recipes": [
    {
      "id": "list-recordings",
      "title": "List recent recordings and shared assets",
      "endpoint": "syncApi",
      "method": "POST",
      "body": {
        "op": "list-library",
        "since": "1970-01-01T00:00:00Z",
        "limit": 100
      },
      "notes": [
        "Newest first; excludes Trash. Pass the response's next back as before for the next page (null = last page).",
        "since is an ISO timestamp: only recordings changed after it. Keep only kind audio or video."
      ]
    },
    {
      "id": "read-recording-text",
      "title": "Read transcript, summary, chapters, action items, or notes",
      "endpoint": "syncApi",
      "method": "POST",
      "body": {
        "op": "get-sections",
        "assetId": "<asset uuid>"
      },
      "notes": [
        "This is the sanctioned text-read path.",
        "Reveal caps are applied server-side for limited callers."
      ]
    },
    {
      "id": "get-one-media-url",
      "title": "Get a short-lived media download URL",
      "endpoint": "syncApi",
      "method": "POST",
      "body": {
        "op": "download-url",
        "assetId": "<asset uuid>",
        "disposition": "inline"
      },
      "notes": [
        "Use disposition inline for streaming and thumbnails.",
        "Use disposition attachment for user downloads."
      ]
    },
    {
      "id": "get-many-media-urls",
      "title": "Get up to 50 short-lived media URLs",
      "endpoint": "syncApi",
      "method": "POST",
      "body": {
        "op": "download-urls",
        "assetIds": [
          "<asset uuid>"
        ],
        "disposition": "inline"
      },
      "notes": [
        "Use this for thumbnail grids or batch export views."
      ]
    },
    {
      "id": "download-word-document",
      "title": "Download a recording's Word document (summary, action items, chapters, notes, transcript)",
      "endpoint": "documents",
      "method": "GET",
      "path": "/<assetId>/document.docx",
      "headers": {
        "X-Api-Key": "smk_<40 hex>"
      },
      "query": {
        "language": "optional app locale, e.g. en or zh-TW",
        "timeZone": "optional IANA zone, e.g. Asia/Taipei"
      },
      "notes": [
        "Returns the .docx bytes; the filename is in Content-Disposition (filename*, UTF-8).",
        "404: no transcript, summary or notes yet, or not readable with this key."
      ]
    },
    {
      "id": "backup-to-google-drive",
      "title": "Back up recordings and their Word documents to Google Drive daily",
      "script": "https://app.seameet.ai/api/recipes/seameet-backup.sh",
      "notes": [
        "Uses list-library, download-url and the Word document route; needs bash, curl and jq.",
        "DEST is a folder (e.g. the Google Drive for desktop folder) or an rclone remote such as gdrive:SeaMeet.",
        "Run daily from cron; each run copies what changed since the last clean run."
      ]
    },
    {
      "id": "regenerate-summary",
      "title": "Regenerate a recording summary",
      "endpoint": "summarize",
      "method": "POST",
      "auth": "personalApiKey",
      "body": {
        "assetId": "<asset uuid>"
      },
      "notes": [
        "Needs a write key; your own recordings only. Answers 202 and runs in the background.",
        "Poll get-asset for summaryRun.state (running, done, failed).",
        "Rate limits: one run per recording per 5 minutes, 20 per day (429 rate_limited with retryAfterSeconds)."
      ]
    },
    {
      "id": "create-webhook",
      "title": "Subscribe to outbound webhooks",
      "endpoint": "syncApi",
      "method": "POST",
      "body": {
        "op": "webhook-create",
        "url": "https://example.com/seameet/webhook",
        "events": [
          "recording.synced",
          "ai.ready"
        ]
      },
      "notes": [
        "Requires a verified account, Sync Pro, and JWT or write-scoped API key.",
        "URL must be public HTTPS; internal and loopback hosts are rejected.",
        "The returned secret is needed to verify deliveries."
      ]
    },
    {
      "id": "verify-webhook",
      "title": "Verify a webhook delivery",
      "endpoint": "yourWebhookReceiver",
      "method": "POST",
      "signature": {
        "header": "X-SeaMeet-Signature",
        "format": "t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"{t}.{rawBody}\")>",
        "recommendedToleranceSeconds": 300
      },
      "notes": [
        "Use the raw body bytes, not parsed and re-serialized JSON.",
        "Return any 2xx status to acknowledge delivery.",
        "Each event is sent once: no retries, a 5 s timeout, and redirects count as failures. Reconcile with list-library to catch a missed delivery.",
        "recording.synced fires for every upload: check data.kind (audio or video for recordings)."
      ]
    },
    {
      "id": "transcribe-file-with-api-key",
      "title": "Transcribe an uploaded file with an API key",
      "endpoint": "mediaStt",
      "path": "/v1/file/jobs",
      "method": "POST",
      "auth": "personalApiKey",
      "body": {
        "assetId": "<asset uuid>",
        "language": "en"
      },
      "notes": [
        "Needs a write key. Upload first: upsert-asset (kind audio, clientRef, ext, sizeBytes, originDeviceId web-upload), then multipart-create, multipart-sign (PUT each part) and multipart-complete.",
        "Answers 202 {jobId, state}. Poll get-asset until transcriptionJob.state is done or failed, then read get-sections; the summary follows the transcript.",
        "A 409 not_synced response means the upload is not complete yet. GET /v1/file/budget (read key) shows the remaining allowance."
      ]
    },
    {
      "id": "transcribe-synced-file",
      "title": "Run managed transcription for a synced asset",
      "endpoint": "mediaStt",
      "path": "/v1/file",
      "method": "POST",
      "auth": "firstPartySession",
      "body": {
        "assetId": "<asset uuid>",
        "language": "en"
      },
      "notes": [
        "Call the Worker base URL, not the Sync API base URL.",
        "A 409 not_synced response means the asset is not complete in R2 yet."
      ]
    },
    {
      "id": "realtime-stt-stream",
      "title": "Stream live audio for realtime STT",
      "endpoint": "mediaStt",
      "path": "/v1/stream",
      "scheme": "wss",
      "auth": "firstPartySession",
      "protocol": "https://app.seameet.ai/api/stream-protocol.md",
      "notes": [
        "This is a WebSocket protocol, not an OpenAPI REST endpoint.",
        "Send PCM16 mono 16 kHz binary frames and optional finalize JSON.",
        "Requires a first-party Supabase user access token today."
      ]
    },
    {
      "id": "check-worker-health",
      "title": "Check live STT session counts",
      "endpoint": "mediaStt",
      "path": "/v1/health",
      "method": "GET",
      "auth": "none",
      "notes": [
        "Unauthenticated health endpoint; counts only."
      ]
    }
  ],
  "references": {
    "human": "https://app.seameet.ai/api/",
    "llms": "https://app.seameet.ai/api/llms.txt",
    "openapi": "https://app.seameet.ai/api/openapi.yaml",
    "syncOpenapi": "https://app.seameet.ai/api/sync-openapi.yaml",
    "mediaSttOpenapi": "https://app.seameet.ai/api/media-stt-openapi.yaml",
    "streamProtocol": "https://app.seameet.ai/api/stream-protocol.md"
  }
}
