{"openapi":"3.1.0","info":{"title":"ReelMirror API","description":"AI-powered content cloning platform. Create personas, track social accounts, sync content, and generate AI clones.","version":"1.0.0"},"servers":[{"url":"https://reelmirror.com/api"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key (rm_xxx) or JWT token"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["VALIDATION_ERROR","UNAUTHORIZED","INSUFFICIENT_BALANCE","FORBIDDEN","NOT_FOUND","CONFLICT","RATE_LIMITED","INTERNAL_ERROR","UPSTREAM_ERROR","SERVICE_UNAVAILABLE"]},"message":{"type":"string"},"details":{"type":"object"}},"required":["code","message"]}}},"Persona":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"writing_style":{"type":"string","nullable":true},"cloning_style":{"type":"string","nullable":true},"avatar_url":{"type":"string","nullable":true},"voice_sample_url":{"type":"string","nullable":true},"discount_mode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}}},"Source":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"creator_id":{"type":"string","format":"uuid"},"platform":{"type":"string","enum":["instagram","tiktok"]},"handle":{"type":"string","description":"Social account handle (e.g. `natgeo`)"},"automation_mode":{"type":"string","enum":["sync_only","auto_clone","auto_publish"],"default":"sync_only","description":"Automation level: `sync_only` = sync content only, `auto_clone` = sync + auto-generate clones, `auto_publish` = sync + generate + publish automatically"},"status":{"type":"string","enum":["pending","synced","error"]},"last_synced_at":{"type":"string","format":"date-time","nullable":true},"content_count":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}},"PublishingTarget":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"connected_account_id":{"type":"string","format":"uuid"},"platform":{"type":"string","enum":["instagram","tiktok"]},"username":{"type":"string"},"status":{"type":"string","enum":["active","expired","error"]},"created_at":{"type":"string","format":"date-time"}}},"GeneratedPost":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"persona_id":{"type":"string","format":"uuid"},"source_post_id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","generating","completed","partial","failed"]},"review_status":{"type":"string","nullable":true,"enum":["pending_review","approved","rejected","published"],"description":"Review lifecycle state. `pending_review` = awaiting action; `approved` = approved but not yet published; `rejected` = rejected; `published` = published to at least one account."},"trigger_source":{"type":"string","nullable":true,"description":"How this generation was triggered. `manual` = user-initiated, `auto_clone` = automatic cloning from source, `api` = via API.","enum":["manual","auto_clone","api"]},"caption":{"type":"string","nullable":true},"error":{"type":"string","nullable":true,"description":"Error message when status is `failed`"},"media_items":{"type":"array","items":{"$ref":"#/components/schemas/GeneratedMediaItem"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"GeneratedMediaItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"media_type":{"type":"string","enum":["image","video"]},"position":{"type":"integer"},"status":{"type":"string","enum":["pending","generating","completed","failed"]},"url":{"type":"string","nullable":true},"is_public":{"type":"boolean"},"discount_applied":{"type":"boolean"},"voice_conversion_status":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"SyncJob":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","running","completed","failed","skipped"]},"creator":{"type":"object","properties":{"handle":{"type":"string"},"platform":{"type":"string"}}},"estimated_cost_cents":{"type":"integer"},"error_message":{"type":"string","nullable":true,"description":"Error detail when status is `failed`"},"completed_at":{"type":"string","format":"date-time","nullable":true,"description":"When the job reached `completed` or `skipped` status"},"failed_at":{"type":"string","format":"date-time","nullable":true,"description":"When the job reached `failed` status"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"ConnectedAccount":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"platform":{"type":"string","enum":["instagram","tiktok"]},"username":{"type":"string"},"status":{"type":"string","enum":["active","expired","error"],"description":"`active` = token valid; `expired` = token expired, reconnect needed; `error` = connection error"},"created_at":{"type":"string","format":"date-time"}}},"OutgoingPostDelivery":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"connected_account_id":{"type":"string","format":"uuid"},"platform":{"type":"string","enum":["instagram","tiktok"]},"username":{"type":"string"},"status":{"type":"string","enum":["pending","publishing","published","failed"],"description":"Terminal states: `published` (success) and `failed` (permanent error). Poll until terminal."},"platform_post_id":{"type":"string","nullable":true,"description":"Platform-assigned post ID after successful publish"},"error_message":{"type":"string","nullable":true,"description":"Error detail when status is `failed`"},"published_at":{"type":"string","format":"date-time","nullable":true}}},"OutgoingPost":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"persona_id":{"type":"string","format":"uuid","nullable":true},"caption":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","scheduled","publishing","published","failed","cancelled"]},"scheduled_for":{"type":"string","format":"date-time","nullable":true},"platform_settings":{"type":"object","nullable":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"generated_media_item_id":{"type":"string","format":"uuid"},"position":{"type":"integer"},"use_voice_converted":{"type":"boolean"}}}},"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/OutgoingPostDelivery"},"description":"One delivery per target publishing account. Check all deliveries to determine overall publish outcome."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"Balance":{"type":"object","properties":{"balance_cents":{"type":"integer"},"balance_dollars":{"type":"string"},"auto_reload":{"type":"boolean"},"reload_threshold_cents":{"type":"integer","nullable":true},"reload_amount_cents":{"type":"integer","nullable":true}}},"Transaction":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"amount_cents":{"type":"integer"},"operation_type":{"type":"string"},"description":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"generated_post_id":{"type":"string","format":"uuid","nullable":true},"generated_media_item_id":{"type":"string","format":"uuid","nullable":true},"refund_of_id":{"type":"string","format":"uuid","nullable":true}}},"FeedbackItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["bug_report","feature_request","general"]},"subject":{"type":"string"},"message":{"type":"string"},"status":{"type":"string","enum":["open","in_review","resolved","closed"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"FeedbackResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"feedback_id":{"type":"string","format":"uuid"},"author_type":{"type":"string","enum":["user","admin","agent"],"description":"`user` = the ticket owner; `admin` = support team; `agent` = AI first responder"},"user_id":{"type":"string","format":"uuid","nullable":true},"message":{"type":"string"},"created_at":{"type":"string","format":"date-time"}}}},"parameters":{"limit":{"name":"limit","in":"query","schema":{"type":"integer","default":20,"maximum":100},"description":"Maximum number of results to return"},"offset":{"name":"offset","in":"query","schema":{"type":"integer","default":0},"description":"Number of results to skip"}}},"tags":[{"name":"Discovery","description":"API metadata and discovery"},{"name":"API Keys","description":"Manage API keys"},{"name":"Personas","description":"Create and manage personas"},{"name":"Sources","description":"Track social accounts"},{"name":"Sync","description":"Sync content from sources"},{"name":"Generation","description":"Generate AI content"},{"name":"Content","description":"Browse synced and generated content"},{"name":"Review","description":"Approve, reject, or compose generated posts"},{"name":"Publishing","description":"Manage outgoing posts and connected publishing accounts"},{"name":"Profile","description":"Manage your account profile"},{"name":"Billing","description":"Balance and transaction history"},{"name":"Uploads","description":"Upload files"},{"name":"Feedback","description":"Submit and track feedback tickets"}],"paths":{"/v1/":{"get":{"tags":["Discovery"],"summary":"API discovery","description":"Returns API metadata including version, available endpoints, authentication methods, and scopes. No authentication required.","operationId":"getApiDiscovery","security":[],"responses":{"200":{"description":"API metadata","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","example":"ReelMirror API"},"version":{"type":"string","example":"v1"},"docs":{"type":"string","example":"https://reelmirror.com/docs"},"endpoints":{"type":"object","description":"Map of endpoint categories to their base paths"},"auth":{"type":"object","properties":{"methods":{"type":"array","items":{"type":"string"},"example":["api_key","jwt"]},"header":{"type":"string","example":"Authorization: Bearer {token}"}}},"scopes":{"type":"array","items":{"type":"string"},"description":"Available API permission scopes"}}}}}}}}},"/v1/api-keys":{"post":{"tags":["API Keys"],"summary":"Create API key","operationId":"createApiKey","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Display name for the key"},"scopes":{"type":"array","items":{"type":"string"},"description":"Permission scopes. Defaults to all except billing:read, billing:write, feedback:read, and feedback:write."},"monthly_limit_cents":{"type":"integer","nullable":true,"description":"Optional monthly spending limit in cents. Min 100 ($1), max 1000000 ($10,000). Null for unlimited.","minimum":100,"maximum":1000000}}}}}},"responses":{"201":{"description":"API key created. The full key is only returned once.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"key":{"type":"string","description":"Full API key (only shown once)"},"scopes":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"monthly_limit_cents":{"type":"integer","nullable":true,"description":"Monthly spending limit in cents, or null for unlimited"}}}}}}}}}},"get":{"tags":["API Keys"],"summary":"List API keys","operationId":"listApiKeys","responses":{"200":{"description":"List of API keys","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"key_hint":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"last_used_at":{"type":"string","format":"date-time","nullable":true},"monthly_limit_cents":{"type":"integer","nullable":true,"description":"Monthly spending limit in cents, or null for unlimited"},"monthly_spent_cents":{"type":"integer","description":"Current month spending in cents (0 if no limit set)"}}}}}}}}}}}},"/v1/api-keys/{key_id}":{"patch":{"tags":["API Keys"],"summary":"Update API key spending limit","operationId":"updateApiKey","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"monthly_limit_cents":{"type":"integer","nullable":true,"description":"Monthly spending limit in cents. Set to null to remove limit.","minimum":100,"maximum":1000000}}}}}},"responses":{"200":{"description":"Key updated","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"monthly_limit_cents":{"type":"integer","nullable":true}}}}}}}}}},"delete":{"tags":["API Keys"],"summary":"Delete API key","operationId":"deleteApiKey","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Key deleted","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean","enum":[true]}}}}}}}}}}},"/v1/personas":{"post":{"tags":["Personas"],"summary":"Create persona","operationId":"createPersona","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"writing_style":{"type":"string"},"cloning_style":{"type":"string"}}}}}},"responses":{"201":{"description":"Persona created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Persona"}}}}}}}},"get":{"tags":["Personas"],"summary":"List personas","operationId":"listPersonas","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"}],"responses":{"200":{"description":"List of personas","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Persona"}},"count":{"type":"integer"}}}}}}}}},"/v1/personas/{persona_id}":{"get":{"tags":["Personas"],"summary":"Get persona","operationId":"getPersona","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Persona details","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Persona"}}}}}}}},"patch":{"tags":["Personas"],"summary":"Update persona","operationId":"updatePersona","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"writing_style":{"type":"string"},"cloning_style":{"type":"string"},"discount_mode":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Persona updated","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Persona"}}}}}}}},"delete":{"tags":["Personas"],"summary":"Delete persona","operationId":"deletePersona","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Persona deleted","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean","enum":[true]}}}}}}}}}}},"/v1/personas/{persona_id}/sources":{"post":{"tags":["Sources"],"summary":"Add source","operationId":"addSource","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["platform","handle"],"properties":{"platform":{"type":"string","enum":["instagram","tiktok"]},"handle":{"type":"string","description":"Social account handle (e.g. `natgeo`). Leading `@` is stripped automatically."},"automation_mode":{"type":"string","enum":["sync_only","auto_clone","auto_publish"],"default":"sync_only","description":"Automation level for this source. Defaults to `sync_only`."}}}}}},"responses":{"201":{"description":"Source added","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Source"}}}}}}}},"get":{"tags":["Sources"],"summary":"List sources","operationId":"listSources","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"}],"responses":{"200":{"description":"List of sources","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Source"}},"count":{"type":"integer"}}}}}}}}},"/v1/personas/{persona_id}/sources/{source_id}":{"get":{"tags":["Sources"],"summary":"Get source","description":"Get a single tracked source by ID. Requires `sources:read` scope.","operationId":"getSource","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Source details","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Source"}}}}}},"404":{"description":"Source or persona not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Sources"],"summary":"Remove source","operationId":"removeSource","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Source removed","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean","enum":[true]}}}}}}}}}},"patch":{"tags":["Sources"],"summary":"Update source","description":"Update source settings such as automation mode. Requires `sources:write` scope.","operationId":"updateSource","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"automation_mode":{"type":"string","enum":["sync_only","auto_clone","auto_publish"],"description":"Automation level for this source"}}}}}},"responses":{"200":{"description":"Source updated","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Source"}}}}}}}}},"/v1/personas/{persona_id}/publishing-targets":{"get":{"tags":["Publishing"],"summary":"List publishing targets","description":"List connected publishing accounts linked to a persona. These determine where auto-published content is delivered. Requires `publishing:read` scope.","operationId":"listPublishingTargets","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"List of publishing targets","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/PublishingTarget"}}}}}}}}},"post":{"tags":["Publishing"],"summary":"Add publishing target","description":"Link a connected publishing account to a persona. The account must already be connected via OAuth (dashboard). Requires `publishing:write` scope.","operationId":"addPublishingTarget","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["connected_account_id"],"properties":{"connected_account_id":{"type":"string","format":"uuid","description":"ID of a connected publishing account from `GET /v1/publishing/accounts`"}}}}}},"responses":{"201":{"description":"Publishing target linked","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PublishingTarget"}}}}}},"409":{"description":"Target already linked to this persona"}}}},"/v1/personas/{persona_id}/publishing-targets/{target_id}":{"delete":{"tags":["Publishing"],"summary":"Remove publishing target","description":"Unlink a publishing account from a persona. Requires `publishing:write` scope.","operationId":"removePublishingTarget","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"target_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Publishing target removed","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean","enum":[true]}}}}}}}}}}},"/v1/personas/{persona_id}/sync":{"post":{"tags":["Sync"],"summary":"Trigger sync","description":"Sync all sources for a persona. Debits balance for estimated API requests. Returns job IDs for status polling.","operationId":"triggerSync","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"202":{"description":"Sync started","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"persona_id":{"type":"string"},"sources_count":{"type":"integer"},"job_ids":{"type":"array","items":{"type":"string"}},"estimated_cost_cents":{"type":"integer"}}}}}}}}},"/v1/sync-jobs/{job_id}":{"get":{"tags":["Sync"],"summary":"Get sync job status","operationId":"getSyncJob","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Sync job status","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/SyncJob"}}}}}}}}},"/v1/generate":{"post":{"tags":["Generation"],"summary":"Generate from source post","description":"Trigger AI content generation from a synced source post. Debits balance per media item + caption.","operationId":"generate","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["source_post_id","persona_id"],"properties":{"source_post_id":{"type":"string","format":"uuid"},"persona_id":{"type":"string","format":"uuid"},"auto_publish":{"type":"boolean","default":false,"description":"When true, automatically publish to persona's connected accounts when generation completes"}}}}}},"responses":{"202":{"description":"Generation started","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","description":"The generated post ID"},"status":{"type":"string","enum":["started"]}}}}}}}}}}},"/v1/generate/media-item":{"post":{"tags":["Generation"],"summary":"Regenerate media item","description":"Create a new version of a generated media item.","operationId":"regenerateMediaItem","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["generated_media_item_id"],"properties":{"generated_media_item_id":{"type":"string","format":"uuid"}}}}}},"responses":{"202":{"description":"Regeneration started","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","description":"The new generated media item ID"},"status":{"type":"string","enum":["started"]}}}}}}}}}}},"/v1/generate/voice-convert":{"post":{"tags":["Generation"],"summary":"Voice convert video","description":"Apply voice conversion to a completed generated video. Requires persona to have a voice sample.","operationId":"voiceConvert","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["generated_media_item_id"],"properties":{"generated_media_item_id":{"type":"string","format":"uuid"}}}}}},"responses":{"202":{"description":"Voice conversion started","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","description":"The generated media item ID"},"status":{"type":"string","enum":["started"]}}}}}}}}}}},"/v1/generate/toggle-public":{"post":{"tags":["Generation"],"summary":"Toggle public visibility","description":"Make a generated media item public or private. Discounted public items are locked for 20 days.","operationId":"togglePublic","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["generated_media_item_id","is_public"],"properties":{"generated_media_item_id":{"type":"string","format":"uuid"},"is_public":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Visibility updated","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"is_public":{"type":"boolean"}}}}}}}}}}},"/v1/clone-url":{"post":{"tags":["Generation"],"summary":"Clone from Instagram URL","description":"Fetch a single Instagram post by URL and generate AI content from it in one step.","operationId":"cloneUrl","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url","persona_id"],"properties":{"url":{"type":"string","description":"Instagram post/reel/TV URL"},"persona_id":{"type":"string","format":"uuid"}}}}}},"responses":{"202":{"description":"Clone started","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","description":"The generated post ID"},"status":{"type":"string","enum":["started"]}}}}}}}}}}},"/v1/generate/regenerate-post":{"post":{"tags":["Generation"],"summary":"Regenerate post","description":"Regenerate a generated post. By default, soft-deletes all existing media items and re-triggers generation from scratch. When `failed_only` is true, retries only failed media items without touching completed ones or the caption.","operationId":"regeneratePost","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["generated_post_id"],"properties":{"generated_post_id":{"type":"string","format":"uuid"},"failed_only":{"type":"boolean","default":false,"description":"When true, retry only failed media items instead of regenerating the entire post."}}}}}},"responses":{"202":{"description":"Regeneration started. When `failed_only` is true, the response includes `retried_items` and `total_cost_cents`.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"oneOf":[{"type":"object","description":"Full regeneration response","properties":{"id":{"type":"string","description":"The generated post ID"},"status":{"type":"string","enum":["started"]}}},{"type":"object","description":"Failed-only retry response","properties":{"id":{"type":"string","description":"The generated post ID"},"status":{"type":"string","enum":["started"]},"retried_items":{"type":"array","items":{"type":"object","properties":{"original_item_id":{"type":"string","format":"uuid"},"new_item_id":{"type":"string","format":"uuid"},"media_type":{"type":"string","enum":["image","video"]},"status":{"type":"string","enum":["pending"]}}}},"total_cost_cents":{"type":"integer"}}}]}}}}}},"422":{"description":"No failed items to retry (only returned when `failed_only` is true)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/v1/generated-posts/{post_id}":{"get":{"tags":["Content"],"summary":"Get generated post","description":"Get a generated post with all its media items. Use for polling generation status. Soft-deleted posts are excluded.","operationId":"getGeneratedPost","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Generated post with media items","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/GeneratedPost"}}}}}}}},"delete":{"tags":["Content"],"summary":"Delete generated post","description":"Soft-delete a generated post and all its media items. The source post can then be re-cloned. R2 files are cleaned up asynchronously.","operationId":"deleteGeneratedPost","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Post deleted","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean","enum":[true]}}}}}}}}}}},"/v1/generated-media-items/{item_id}":{"get":{"tags":["Content"],"summary":"Get generated media item","description":"Get a single generated media item. Use for polling item-level status. Soft-deleted items are excluded.","operationId":"getGeneratedMediaItem","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Generated media item","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/GeneratedMediaItem"}}}}}}}},"delete":{"tags":["Content"],"summary":"Delete generated media item","description":"Soft-delete a single generated media item. R2 files are cleaned up asynchronously.","operationId":"deleteGeneratedMediaItem","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Item deleted","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean","enum":[true]}}}}}}}}}}},"/v1/personas/{persona_id}/source-posts":{"get":{"tags":["Content"],"summary":"List source posts","description":"List synced source posts from a persona's tracked creators.","operationId":"listSourcePosts","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"}],"responses":{"200":{"description":"List of source posts with media items","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"creator_id":{"type":"string","format":"uuid"},"platform":{"type":"string","enum":["instagram","tiktok"]},"platform_post_id":{"type":"string"},"post_type":{"type":"string","enum":["image","video","carousel"]},"caption":{"type":"string","nullable":true},"like_count":{"type":"integer","nullable":true},"comment_count":{"type":"integer","nullable":true},"posted_at":{"type":"string","format":"date-time","nullable":true},"media_items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"media_type":{"type":"string","enum":["image","video"]},"position":{"type":"integer"},"url":{"type":"string","nullable":true},"duration_seconds":{"type":"number","nullable":true}}}},"created_at":{"type":"string","format":"date-time"}}}},"count":{"type":"integer"}}}}}}}}},"/v1/personas/{persona_id}/generated-posts":{"get":{"tags":["Content"],"summary":"List generated posts","description":"List generated posts for a persona with their media items.","operationId":"listGeneratedPosts","parameters":[{"name":"persona_id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["pending","generating","completed","partial","failed"]},"description":"Filter by generation status"},{"name":"review_status","in":"query","required":false,"schema":{"type":"string","enum":["pending_review","approved","rejected","published"]},"description":"Filter by review status"}],"responses":{"200":{"description":"List of generated posts","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/GeneratedPost"}},"count":{"type":"integer"}}}}}}}}},"/v1/billing/balance":{"get":{"tags":["Billing"],"summary":"Get balance","operationId":"getBalance","responses":{"200":{"description":"Current balance and auto-reload settings","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Balance"}}}}}}}},"patch":{"tags":["Billing"],"summary":"Update auto-reload settings","description":"Configure auto-reload settings. Requires `billing:write` scope.\n\nIf `auto_reload: true` is requested and no payment method is saved, a Stripe Checkout setup session is returned (`setup_url`) so the user can add a card — `auto_reload` is **not** saved as `true` in this case.","operationId":"updateAutoReload","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"auto_reload":{"type":"boolean","description":"Enable or disable automatic balance reload"},"reload_threshold_cents":{"type":"integer","minimum":0,"maximum":5000,"description":"Balance level (in cents) that triggers an auto-reload. Min 0, max 5000."},"reload_amount_cents":{"type":"integer","minimum":100,"maximum":5000,"description":"Amount (in cents) to reload when the threshold is hit. Min 100 ($1), max 5000 ($50)."}}}}}},"responses":{"200":{"description":"Updated balance settings, or a Stripe setup URL when no payment method is on file","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Balance"}}},{"type":"object","properties":{"auto_reload":{"type":"boolean","enum":[false]},"setup_url":{"type":"string","description":"Stripe Checkout URL to save a payment method"}},"required":["auto_reload","setup_url"]}]}}}},"400":{"description":"Validation error (e.g., threshold/amount missing when enabling auto_reload)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/billing/topup":{"post":{"tags":["Billing"],"summary":"Create top-up checkout session","description":"Create a Stripe Checkout session to add credits to your balance. Requires `billing:write` scope.","operationId":"createTopup","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["amount_cents"],"properties":{"amount_cents":{"type":"integer","description":"Amount in cents to top up. Must be one of the supported values."}}}}}},"responses":{"200":{"description":"Stripe Checkout URL to complete payment","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"url":{"type":"string","description":"Stripe Checkout URL"}},"required":["url"]}}}}}},"400":{"description":"Invalid amount","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/billing/transactions":{"get":{"tags":["Billing"],"summary":"List transactions","operationId":"listTransactions","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"}],"responses":{"200":{"description":"Transaction history","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Transaction"}},"count":{"type":"integer"}}}}}}}}},"/v1/profile":{"get":{"tags":["Profile"],"summary":"Get profile","operationId":"getProfile","responses":{"200":{"description":"Your profile","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string"}}}}}}}}}},"patch":{"tags":["Profile"],"summary":"Update profile","operationId":"updateProfile","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}}}},"responses":{"200":{"description":"Profile updated","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string"}}}}}}}},"409":{"description":"Name already taken","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/publishing/accounts/connect":{"get":{"tags":["Publishing"],"summary":"Get OAuth connect URL","description":"Generate an OAuth URL to connect a new (or reconnect an existing) social account. Requires `publishing:write` scope.\n\nThe OAuth provider will redirect the user's browser to `/api/internal/publishing/accounts/callback` after authorization — this is not a JSON callback.","operationId":"getPublishingConnectUrl","parameters":[{"name":"platform","in":"query","required":true,"schema":{"type":"string","enum":["instagram","tiktok"]},"description":"Social platform to connect. Note: TikTok support is in alpha."},{"name":"accountId","in":"query","required":false,"schema":{"type":"string","format":"uuid"},"description":"ID of an existing connected account to reconnect. Omit for a new connection."}],"responses":{"200":{"description":"OAuth authorization URL","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"auth_url":{"type":"string","description":"Redirect the user to this URL to authorize the connection"}},"required":["auth_url"]}}}}}},"400":{"description":"Missing platform or name not set","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"No available slot for a new connection","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/publishing/accounts/slots":{"get":{"tags":["Publishing"],"summary":"Get account slots","description":"Return the number of purchased, used, and available account slots. Requires `publishing:read` scope.","operationId":"getPublishingSlots","responses":{"200":{"description":"Slot allocation","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"purchased":{"type":"integer"},"used":{"type":"integer"},"available":{"type":"integer"},"subscriptionId":{"type":"string","nullable":true}},"required":["purchased","used","available","subscriptionId"]}}}}}}}},"post":{"tags":["Publishing"],"summary":"Purchase account slots","description":"Set the total number of purchased account slots. Creates, updates, or cancels the Stripe subscription accordingly. Returns a `checkoutUrl` when no payment method is on file. Requires `publishing:write` scope.","operationId":"purchasePublishingSlots","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["slots"],"properties":{"slots":{"type":"integer","minimum":0,"description":"Total number of paid slots to set"},"returnUrl":{"type":"string","description":"Path to redirect to after Stripe Checkout (used when no card is on file)"}}}}}},"responses":{"200":{"description":"Updated slot allocation, or a Stripe Checkout URL when no payment method is on file","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"purchased":{"type":"integer"},"subscriptionId":{"type":"string","nullable":true},"checkoutUrl":{"type":"string","nullable":true,"description":"Stripe Checkout URL when payment collection is needed"}},"required":["purchased","subscriptionId"]}}}}}},"400":{"description":"Invalid slots value or cannot reduce below active usage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/publishing/accounts":{"get":{"tags":["Publishing"],"summary":"List connected accounts","description":"List all publishing accounts (Instagram, TikTok (alpha)) connected to your profile.","operationId":"listPublishingAccounts","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":20,"maximum":100}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"Connected publishing accounts","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ConnectedAccount"}},"count":{"type":"integer","description":"Total number of connected accounts"}}}}}}}}},"/v1/publishing/accounts/{id}":{"get":{"tags":["Publishing"],"summary":"Get account health","description":"Check the health/status of a connected publishing account.","operationId":"getPublishingAccountHealth","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Account health","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","description":"Account health information"}}}}}}}},"delete":{"tags":["Publishing"],"summary":"Disconnect account","description":"Disconnect a publishing account from your profile.","operationId":"disconnectPublishingAccount","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Account disconnected","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean","enum":[true]}}}}}}}}}}},"/v1/publishing/posts":{"get":{"tags":["Publishing"],"summary":"List outgoing posts","description":"List all outgoing posts for your account, including media items and delivery statuses.","operationId":"listOutgoingPosts","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":20,"maximum":100}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"List of outgoing posts","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/OutgoingPost"}},"count":{"type":"integer","description":"Total number of outgoing posts"}}}}}}}},"post":{"tags":["Publishing"],"summary":"Create outgoing post","description":"Create a draft outgoing post with media items and target publishing accounts.","operationId":"createOutgoingPost","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"persona_id":{"type":"string","format":"uuid"},"caption":{"type":"string"},"items":{"type":"array","description":"Media items to include in the post","items":{"type":"object","required":["generated_media_item_id","position"],"properties":{"generated_media_item_id":{"type":"string","format":"uuid"},"position":{"type":"integer"},"use_voice_converted":{"type":"boolean"}}}},"target_account_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"platform_settings":{"type":"object"}}}}}},"responses":{"201":{"description":"Outgoing post created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OutgoingPost"}}}}}}}}},"/v1/publishing/posts/{id}":{"get":{"tags":["Publishing"],"summary":"Get outgoing post","operationId":"getOutgoingPost","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Outgoing post with items and deliveries","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OutgoingPost"}}}}}}}},"patch":{"tags":["Publishing"],"summary":"Update outgoing post","description":"Update caption, platform settings, or other mutable fields on a draft post.","operationId":"updateOutgoingPost","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"caption":{"type":"string"},"platform_settings":{"type":"object"}}}}}},"responses":{"200":{"description":"Post updated","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/OutgoingPost"}}}}}}}},"delete":{"tags":["Publishing"],"summary":"Delete outgoing post","operationId":"deleteOutgoingPost","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Post deleted","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean","enum":[true]}}}}}}}}}}},"/v1/publishing/posts/{id}/publish":{"post":{"tags":["Publishing"],"summary":"Publish now","description":"Immediately publish an outgoing post to all configured accounts.","operationId":"publishOutgoingPost","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Publishing started","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","example":"publishing"}}}}}}}}}}},"/v1/publishing/posts/{id}/schedule":{"post":{"tags":["Publishing"],"summary":"Schedule post","description":"Schedule an outgoing post for a future time.","operationId":"scheduleOutgoingPost","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["scheduled_for"],"properties":{"scheduled_for":{"type":"string","format":"date-time","description":"ISO 8601 datetime to publish at"},"timezone":{"type":"string","default":"UTC","description":"IANA timezone name (e.g. America/New_York)"}}}}}},"responses":{"200":{"description":"Post scheduled","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","example":"scheduled"}}}}}}}}}}},"/v1/publishing/posts/{id}/retry":{"post":{"tags":["Publishing"],"summary":"Retry publish","description":"Retry publishing a post that previously failed.","operationId":"retryOutgoingPost","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Retry started","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","example":"publishing"}}}}}}}}}}},"/v1/publishing/posts/{id}/cancel":{"post":{"tags":["Publishing"],"summary":"Cancel scheduled post","description":"Cancel a scheduled outgoing post before it is published.","operationId":"cancelOutgoingPost","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Post cancelled","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","example":"cancelled"}}}}}}}}}}},"/v1/publishing/caption":{"post":{"tags":["Publishing"],"summary":"Generate caption","description":"AI-generate a publishing caption from one or more generated media items, matching the persona's writing style.","operationId":"generateCaption","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["generated_media_item_ids"],"properties":{"generated_media_item_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"persona_id":{"type":"string","format":"uuid"}}}}}},"responses":{"200":{"description":"Generated caption","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"caption":{"type":"string"}}}}}}}}}}},"/v1/generated-posts/{post_id}/approve":{"post":{"tags":["Review"],"summary":"Approve generated post","description":"Approve a generated post pending review. Creates an outgoing post and immediately publishes it to the persona's connected accounts.\n\n**Requires connected accounts.** The persona must have at least one publishing account connected via `GET /v1/publishing/accounts/connect`. If no accounts are connected, the request returns `400`. Connect accounts once via the dashboard — this step requires a browser OAuth flow.","operationId":"approveGeneratedPost","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Post approved and publishing started","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","example":"publishing"},"outgoing_post_id":{"type":"string","format":"uuid"}}}}}}}},"400":{"description":"Post not in a publishable state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Generated post not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Publish failed after approval","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/generated-posts/{post_id}/reject":{"post":{"tags":["Review"],"summary":"Reject generated post","description":"Reject a generated post pending review. Sets review_status to rejected.","operationId":"rejectGeneratedPost","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Post rejected","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","example":"rejected"}}}}}}}},"400":{"description":"Post is not pending review","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Generated post not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/generated-posts/{post_id}/send-to-compose":{"post":{"tags":["Review"],"summary":"Send to compose","description":"Approve a generated post and create a draft outgoing post for manual editing in the composer, without publishing immediately.","operationId":"sendGeneratedPostToCompose","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Draft outgoing post created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"outgoing_post_id":{"type":"string","format":"uuid"}}}}}}}},"400":{"description":"Post not in a composable state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Generated post not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/generated-media-items/{item_id}/reject":{"post":{"tags":["Review"],"summary":"Reject media item","description":"Reject a single generated media item within a post pending review. If all items in the post are rejected, the parent post is auto-rejected.","operationId":"rejectGeneratedMediaItem","parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Media item rejected","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","example":"rejected"},"post_auto_rejected":{"type":"boolean","description":"True if all items were rejected and the parent post was auto-rejected"}}}}}}}},"400":{"description":"Post is not pending review","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Media item not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/uploads":{"post":{"tags":["Uploads"],"summary":"Upload file","description":"Upload an avatar image or voice sample. Supports multipart/form-data or JSON with a URL to fetch from. Automatically updates the persona's `avatar_url` or `voice_sample_url` field.","operationId":"upload","requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","required":["file","category","persona_id"],"properties":{"file":{"type":"string","format":"binary"},"category":{"type":"string","enum":["avatar","voice"]},"persona_id":{"type":"string","format":"uuid"}}}},"application/json":{"schema":{"type":"object","required":["url","category","persona_id"],"properties":{"url":{"type":"string","description":"URL to fetch file from"},"category":{"type":"string","enum":["avatar","voice"]},"persona_id":{"type":"string","format":"uuid"}}}}}},"responses":{"201":{"description":"File uploaded and processed","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"key":{"type":"string","description":"R2 storage key"},"url":{"type":"string","description":"Public URL"},"category":{"type":"string","enum":["avatar","voice"],"description":"Upload category"},"persona_id":{"type":"string","format":"uuid","description":"Persona that was updated"}}}}}}}}}}},"/v1/feedback":{"get":{"tags":["Feedback"],"summary":"List feedback","operationId":"listFeedback","description":"Returns a paginated list of your feedback tickets, ordered by most recent first.","security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/offset"}],"responses":{"200":{"description":"Feedback list","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FeedbackItem"}},"count":{"type":"integer"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Feedback"],"summary":"Submit feedback","operationId":"submitFeedback","description":"Submit a new feedback ticket.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","subject","message"],"properties":{"type":{"type":"string","enum":["bug_report","feature_request","general"]},"subject":{"type":"string","maxLength":200},"message":{"type":"string","maxLength":5000}}}}}},"responses":{"201":{"description":"Feedback submitted","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FeedbackItem"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/feedback/{id}":{"get":{"tags":["Feedback"],"summary":"Get feedback thread","operationId":"getFeedbackThread","description":"Fetch a single feedback ticket with all responses.","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Feedback thread","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"allOf":[{"$ref":"#/components/schemas/FeedbackItem"},{"type":"object","properties":{"responses":{"type":"array","items":{"$ref":"#/components/schemas/FeedbackResponse"}}}}]}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/feedback/{id}/responses":{"post":{"tags":["Feedback"],"summary":"Reply to feedback","operationId":"replyToFeedback","description":"Add a reply to a feedback ticket.","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string","maxLength":5000}}}}}},"responses":{"201":{"description":"Response posted","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FeedbackResponse"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/signup":{"post":{"tags":["Auth"],"summary":"Agent signup","description":"Create a new account programmatically without CAPTCHA. Returns immediately with `pending_confirmation` status — a confirmation email is sent to the provided address. The account starts with $0 balance; the $5 welcome bonus is deferred until a payment method is attached via `POST /v1/billing/setup-intent`.\n\nRate limit: **5 signups per IP per 24 hours**. No authentication required.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","format":"email","description":"The agent's email address — must be a real inbox the agent can read to confirm the account"},"password":{"type":"string","minLength":8,"description":"Strong random password (min 8 chars). Store securely; a human can use 'forgot password' on the dashboard if needed"}}}}}},"responses":{"202":{"description":"Account created — awaiting email confirmation","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","enum":["pending_confirmation"]},"user_id":{"type":"string","format":"uuid"}}}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Email already registered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded (5 signups per IP per 24 hours)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"post-/v1/auth/signup"}},"/v1/billing/setup-intent":{"post":{"tags":["Billing"],"summary":"Create SetupIntent for headless card attachment","description":"Creates a Stripe SetupIntent so an agent can attach a payment method headlessly using the Stripe SDK (no browser redirect required). After the SetupIntent is confirmed, Stripe fires `setup_intent.succeeded` and the server automatically grants the **$5 welcome bonus** if none has been issued yet.\n\nRequired scope: `billing:write`.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"SetupIntent created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"client_secret":{"type":"string","description":"Stripe SetupIntent client secret (format: `seti_xxx_secret_xxx`). Pass to `stripe.confirmCardSetup()` or the server-side Stripe SDK to complete card attachment."}}}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Missing billing:write scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"operationId":"post-/v1/billing/setup-intent"}}}}