{"openapi":"3.1.0","info":{"title":"sm-platform-dossier","version":"0.1.0"},"paths":{"/profiles":{"post":{"tags":["profiles"],"summary":"Create Profile","operationId":"create_profile_profiles_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["profiles"],"summary":"List Profiles","operationId":"list_profiles_profiles_get","parameters":[{"name":"platform","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/Platform"},{"type":"null"}],"title":"Platform"}},{"name":"was_scraped","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Was Scraped"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/profiles/{profile_id}":{"get":{"tags":["profiles"],"summary":"Get Profile","operationId":"get_profile_profiles__profile_id__get","parameters":[{"name":"profile_id","in":"path","required":true,"schema":{"type":"integer","title":"Profile Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["profiles"],"summary":"Update Profile","operationId":"update_profile_profiles__profile_id__put","parameters":[{"name":"profile_id","in":"path","required":true,"schema":{"type":"integer","title":"Profile Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["profiles"],"summary":"Delete Profile","description":"Soft-delete a profile. Reversed automatically if the handle is seen again.\n\nThe row is hidden from every read, not removed. A later ingestion carrying the\nsame ``(external_id, platform)`` resurrects it, so for a profile still being\ncollected this is \"gone until the next mention\", not \"gone\". Deleting a handle\nthat the scraper still follows will not keep it deleted.\n\nThat is deliberate: the upsert's conflict target does not exclude soft-deleted\nrows, so leaving the tombstone in place made every future mention of the handle\na permanently failing message. See ``docs/issues/profile-resolution.md`` KI-009.","operationId":"delete_profile_profiles__profile_id__delete","parameters":[{"name":"profile_id","in":"path","required":true,"schema":{"type":"integer","title":"Profile Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/posts/feed":{"get":{"tags":["posts"],"summary":"List Feed Posts","operationId":"list_feed_posts_posts_feed_get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"core_company_id","in":"query","required":true,"schema":{"type":"string","minLength":1,"title":"Core Company Id"}},{"name":"platform","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/Platform"},{"type":"null"}],"title":"Platform"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedPostListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/posts/gallery":{"post":{"tags":["posts"],"summary":"List Gallery Posts","operationId":"list_gallery_posts_posts_gallery_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GallerySearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GalleryListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/posts/search":{"get":{"tags":["posts"],"summary":"Search Posts","operationId":"search_posts_posts_search_get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"core_company_id","in":"query","required":true,"schema":{"type":"string","minLength":1,"title":"Core Company Id"}},{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2,"maxLength":500,"description":"Search query. Non-English queries are translated to English server-side before semantic match.","title":"Q"},"description":"Search query. Non-English queries are translated to English server-side before semantic match."},{"name":"platform","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/Platform"},{"type":"null"}],"title":"Platform"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/posts/by-company":{"post":{"tags":["posts"],"summary":"List Posts By Company","operationId":"list_posts_by_company_posts_by_company_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostsByCompanyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostsByCompanyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/posts/lookup":{"post":{"tags":["posts"],"summary":"Lookup Posts","operationId":"lookup_posts_posts_lookup_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostLookupRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostLookupResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/posts/{post_uuid}":{"get":{"tags":["posts"],"summary":"Get Post Detail","operationId":"get_post_detail_posts__post_uuid__get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"post_uuid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Post Uuid"}},{"name":"core_company_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Core Company Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/posts/{post_uuid}/comments":{"get":{"tags":["posts"],"summary":"Get Post Comments","operationId":"get_post_comments_posts__post_uuid__comments_get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"post_uuid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Post Uuid"}},{"name":"core_company_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Core Company Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostCommentsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/pipeline/enrichment":{"post":{"tags":["pipeline"],"summary":"Handle Enrichment","operationId":"handle_enrichment_pipeline_enrichment_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PubSubPushEnvelope"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineAckResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/pipeline/profile-ingestion":{"post":{"tags":["pipeline"],"summary":"Handle Profile Ingestion","operationId":"handle_profile_ingestion_pipeline_profile_ingestion_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PubSubPushEnvelope"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineAckResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/pipeline/post-ingestion":{"post":{"tags":["pipeline"],"summary":"Handle Post Ingestion","operationId":"handle_post_ingestion_pipeline_post_ingestion_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PubSubPushEnvelope"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineAckResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/pipeline/comments-ingestion":{"post":{"tags":["pipeline"],"summary":"Handle Comments Ingestion","operationId":"handle_comments_ingestion_pipeline_comments_ingestion_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PubSubPushEnvelope"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineAckResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/pipeline/post-processed":{"post":{"tags":["pipeline"],"summary":"Handle Post Processed","operationId":"handle_post_processed_pipeline_post_processed_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PubSubPushEnvelope"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineAckResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/pipeline/tiktok-apify-run-callback":{"post":{"tags":["pipeline"],"summary":"Handle Tiktok Apify Run Callback","description":"Terminal-event callback for the one-shot TikTok media run.\n\nAuth reuses ``verify_app_secret`` -- the same ``X-Pilea-Secret`` header the\nintake uses, baked into the ad-hoc webhook's ``headersTemplate``. A missing\nor invalid secret is rejected (403) by the dependency before any processing.","operationId":"handle_tiktok_apify_run_callback_pipeline_tiktok_apify_run_callback_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TikTokApifyRunCallbackPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TikTokApifyRunCallbackResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/pipeline/ingest-by-url-callback":{"post":{"tags":["pipeline"],"summary":"Handle Ingest By Url Callback","description":"Terminal-event callback for the one-shot ingest-by-url run, both platforms.\n\nExclusive to the manual flow. Auth reuses ``verify_app_secret`` -- the same\n``X-Pilea-Secret`` header the media callback uses, baked into the ad-hoc\nwebhook's ``headersTemplate``.","operationId":"handle_ingest_by_url_callback_pipeline_ingest_by_url_callback_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostIngestCallbackPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostIngestCallbackResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/pipeline/intake":{"post":{"tags":["pipeline"],"summary":"Handle Intake","operationId":"handle_intake_pipeline_intake_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PubSubPushEnvelope"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineAckResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/pipeline/apify-intake":{"post":{"tags":["pipeline"],"summary":"Handle Apify Intake","operationId":"handle_apify_intake_pipeline_apify_intake_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApifyIntakeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApifyIngestionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/pipeline/tiktok-apify-intake":{"post":{"tags":["pipeline"],"summary":"Handle Tiktok Apify Intake","operationId":"handle_tiktok_apify_intake_pipeline_tiktok_apify_intake_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TikTokApifyIntakeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApifyIngestionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/apify/provision-harvest":{"post":{"tags":["apify-provisioning"],"summary":"Provision Harvest","operationId":"provision_harvest_apify_provision_harvest_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionHarvestRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionHarvestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/apify/dispatch-harvest":{"post":{"tags":["apify-harvest-dispatch"],"summary":"Dispatch Harvest","operationId":"dispatch_harvest_apify_dispatch_harvest_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DispatchHarvestRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DispatchHarvestSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/company-profile/provision-link":{"post":{"tags":["company-profile-provisioning"],"summary":"Provision Link","operationId":"provision_link_company_profile_provision_link_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionLinkRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionLinkResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/tokens":{"post":{"tags":["tokens"],"summary":"Create Or Update Token","operationId":"create_or_update_token_tokens_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/tokens/tiktok/connect":{"post":{"tags":["tokens"],"summary":"Connect Tiktok","description":"Exchange the OAuth ``code`` forwarded by core's TikTok connect callback,\nstore the token, resolve the @, and return it on the same ``TokenResponse``\nshape POST /tokens returns (core reuses its consume path).\n\nA provider exchange failure raises 4xx/5xx and leaves NO ``tokens`` row.","operationId":"connect_tiktok_tokens_tiktok_connect_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TikTokConnectRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/tokens/tiktok/disconnect":{"post":{"tags":["tokens"],"summary":"Disconnect Tiktok","description":"Clear the dossier's stored TikTok token for a company. The SL\nConnectionsModal \"disconnect TikTok\" action forwards here.\n\nIdempotent: a company with no stored token returns 200 with ``disconnected=0``\n(never a 404). It also removes the company's TikTok CompanyProfile link(s)\n(``links_removed``) so no orphan link survives; the Profile is untouched and\nthe harvest lifecycle stays in core. Never echoes token material.","operationId":"disconnect_tiktok_tokens_tiktok_disconnect_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TikTokDisconnectRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TikTokDisconnectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/tokens/meta/disconnect":{"post":{"tags":["tokens"],"summary":"Disconnect Meta","description":"Tear down a company's Meta (Instagram) connection.\n\nRemoves every Meta ``tokens`` row (Meta is plural -- one per IG ``page_id``),\nthe ``CompanyProfile`` links, the Apify provision-states, and -- when NO page\nsurvives -- the company's IG Apify harvest (task + schedule + webhooks). The\n``Profile`` rows (the handles) are untouched, so re-linking re-attributes\nmentions. ``keep_page_ids`` retains a subset: omit/empty for a full disconnect,\nor pass the surviving pages for a substitutive swap (only ``P_old \\ P_new`` is\ndeprovisioned). Idempotent: a company with nothing connected returns 200 with\nall-zero counts (never a 404). Best-effort per page; never echoes token material.\n\n``company_slug`` is optional and names the brand's Apify resources; omitting it\nkeeps the old contract working (200, UUID fallback).","operationId":"disconnect_meta_tokens_meta_disconnect_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetaDisconnectRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetaDisconnectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/admin/reprocess/{correlation_id}":{"post":{"tags":["admin"],"summary":"Reprocess Webhook","operationId":"reprocess_webhook_admin_reprocess__correlation_id__post","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"correlation_id","in":"path","required":true,"schema":{"type":"string","title":"Correlation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReprocessResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/reprocess":{"post":{"tags":["admin"],"summary":"Bulk Reprocess Webhooks","operationId":"bulk_reprocess_webhooks_admin_reprocess_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkReprocessRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkReprocessResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/admin/story-delivery-check":{"post":{"tags":["admin"],"summary":"Check Story Delivery","description":"Find the Instagram pages whose story mentions stopped arriving (RUMO-584).\n\nCloud Scheduler calls it every 30 minutes. Logs ``story_delivery.page_silent`` per page\nand rule, and ``story_delivery.check_completed``. Off (``story_delivery_check_enabled``)\nit answers ``enabled: false`` and reads nothing, unless the body asks for ``dry_run``.","operationId":"check_story_delivery_admin_story_delivery_check_post","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/StoryDeliveryCheckRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoryDeliveryCheckResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/admin/story-inbox-fallback":{"post":{"tags":["admin"],"summary":"Read Story Inbox","description":"Read the Instagram inbox of the pages Meta stopped delivering story mentions for (RUMO-928).\n\nCloud Scheduler calls it every 30 minutes. Each new inbound story mention found in a page's\ninbox goes to intake as if Meta had delivered it. Off (``story_inbox_fallback_enabled``) it\nanswers ``enabled: false`` and calls nothing, unless the body asks for ``dry_run``, which\nreads and reports without writing. A body with ``page_ids`` (one page) and ``since`` is a\nbackfill: it reads ``[since, now]`` without the usage gate or the cursor, a slice at a time\n(``next_after`` → ``after``).","operationId":"read_story_inbox_admin_story_inbox_fallback_post","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/StoryInboxFallbackRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoryInboxFallbackResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/admin/story-scope":{"put":{"tags":["admin"],"summary":"Store Story Scope","description":"Store the snapshot of which brands consume stories (RUMO-938).\n\ncore-service sends it every hour: every non-deleted company with its Instagram Social\nListening contract windows and game windows. It replaces the stored snapshot and logs\n``story_scope.snapshot_received``. 409 when ``generated_at`` is not newer than the stored\none; 422 for an empty company list. The pages of a company in it with no window containing\nnow are left out of the story delivery check and the inbox reading.","operationId":"store_story_scope_admin_story_scope_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoryScopeSnapshotRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoryScopeSnapshotResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/admin/positive-control":{"post":{"tags":["admin"],"summary":"Trigger Positive Control","description":"Fail on purpose, touching nothing, so a probe can find the failure in Datadog.\n\nAnswers 500 and logs ``positive_control.triggered`` then ``request.failed``\n(``error_type=PositiveControlError``), both carrying ``probe_id``'s trace.","operationId":"trigger_positive_control_admin_positive_control_post","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"probe_id","in":"query","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,64}$","title":"Probe Id"}}],"responses":{"500":{"description":"Always: the deliberate failure of the positive control","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mentions/usage":{"get":{"tags":["mentions"],"summary":"Get Mentions Usage","operationId":"get_mentions_usage_mentions_usage_get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"core_company_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Core Company Id"}},{"name":"month","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-(0[1-9]|1[0-2])$","title":"Month"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MentionsUsageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/social-listening/signals":{"get":{"tags":["social-listening"],"summary":"Get Social Listening Signals","operationId":"get_social_listening_signals_social_listening_signals_get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"core_company_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Core Company Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SocialListeningSignalsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/social-listening/validate-meta-token":{"post":{"tags":["social-listening"],"summary":"Validate Meta Token","description":"Validate a company's replicated Meta tokens by probing each Instagram replica.\n\nThe only live Graph I/O on the probe path. Always emits the 3 frozen keys of\n``MetaProbeCheck`` -- one Graph call per replica, folded into the\n``meta_accounts`` verdict. Never 500s on a bad/revoked token.","operationId":"validate_meta_token_social_listening_validate_meta_token_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetaTokenValidationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetaTokenValidationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/webhooks/tiktok-mentions":{"post":{"tags":["tiktok-webhook"],"summary":"Receive Tiktok Mention","operationId":"receive_tiktok_mention_webhooks_tiktok_mentions_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/tiktok-token-refresh":{"post":{"tags":["tiktok-token-refresh"],"summary":"Run Tiktok Token Refresh","operationId":"run_tiktok_token_refresh_tiktok_token_refresh_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TikTokTokenRefreshSummary"}}}}},"security":[{"APIKeyHeader":[]}]}},"/admin/tiktok-media/reprocess":{"post":{"tags":["tiktok-media-reprocess"],"summary":"Run Tiktok Media Reprocess","operationId":"run_tiktok_media_reprocess_admin_tiktok_media_reprocess_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TikTokMediaReprocessSummary"}}}}},"security":[{"APIKeyHeader":[]}]}},"/pipeline/apify-provisioning":{"post":{"tags":["provisioning"],"summary":"Handle Apify Provisioning","operationId":"handle_apify_provisioning_pipeline_apify_provisioning_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PubSubPushEnvelope"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineAckResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/posts/ingest-by-url":{"post":{"tags":["ingest-by-url"],"summary":"Ingest Post By Url","operationId":"ingest_post_by_url_posts_ingest_by_url_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostIngestRequestCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostIngestRequestCreated"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/posts/ingest-by-url/{request_uuid}":{"get":{"tags":["ingest-by-url"],"summary":"Get Post Ingest Request","operationId":"get_post_ingest_request_posts_ingest_by_url__request_uuid__get","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"request_uuid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Request Uuid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostIngestRequestStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/instagram/scoped-ids/resolve":{"post":{"tags":["instagram-scoped-ids"],"summary":"Resolve Scoped Id","description":"Resolve an Instagram-scoped user id to its username using the receiving account's token.\n\nOnly a per-receiving-account count of Graph calls is stored; above its hourly limit the\nanswer is 429 with ``Retry-After``. Errors carry a stable ``detail.key``.","operationId":"resolve_scoped_id_instagram_scoped_ids_resolve_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScopedIdResolveRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScopedIdResolveResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"APIKeyHeader":[]}]}},"/health":{"get":{"summary":"Health Check","operationId":"health_check_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Health Check Health Get"}}}}}}},"/health/ready":{"get":{"summary":"Readiness Check","operationId":"readiness_check_health_ready_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"ApifyActionMetaData":{"properties":{"actorRunId":{"type":"string","minLength":1,"title":"Actorrunid"},"mentionedClientId":{"type":"string","minLength":1,"title":"Mentionedclientid"}},"type":"object","required":["actorRunId","mentionedClientId"],"title":"ApifyActionMetaData"},"ApifyIngestionItemResult":{"properties":{"external_id":{"type":"string","title":"External Id"},"status":{"type":"string","title":"Status"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["external_id","status"],"title":"ApifyIngestionItemResult"},"ApifyIngestionResponse":{"properties":{"status":{"type":"string","title":"Status"},"total":{"type":"integer","title":"Total"},"succeeded":{"type":"integer","title":"Succeeded"},"failed":{"type":"integer","title":"Failed"},"skipped":{"type":"integer","title":"Skipped","default":0},"results":{"items":{"$ref":"#/components/schemas/ApifyIngestionItemResult"},"type":"array","title":"Results","default":[]}},"type":"object","required":["status","total","succeeded","failed"],"title":"ApifyIngestionResponse"},"ApifyIntakeRequest":{"properties":{"actionMetaData":{"$ref":"#/components/schemas/ApifyActionMetaData"},"socialMediaMentions":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Socialmediamentions"}},"type":"object","required":["actionMetaData","socialMediaMentions"],"title":"ApifyIntakeRequest"},"BulkReprocessItemResult":{"properties":{"webhook_id":{"type":"integer","title":"Webhook Id"},"correlation_id":{"type":"string","title":"Correlation Id"},"outcome":{"type":"string","enum":["requeued","skipped","failed"],"title":"Outcome"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["webhook_id","correlation_id","outcome"],"title":"BulkReprocessItemResult"},"BulkReprocessRequest":{"properties":{"correlation_ids":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":500,"minItems":1},{"type":"null"}],"title":"Correlation Ids"},"status":{"anyOf":[{"$ref":"#/components/schemas/WebhookProcessingStatus"},{"type":"null"}],"default":"failed"},"platform":{"anyOf":[{"$ref":"#/components/schemas/Platform"},{"type":"null"}]},"created_after":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created After"},"created_before":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created Before"},"limit":{"type":"integer","maximum":500.0,"minimum":1.0,"title":"Limit","default":100},"max_attempts":{"type":"integer","minimum":1.0,"title":"Max Attempts","default":5},"max_age_minutes":{"anyOf":[{"type":"integer","maximum":1440.0,"minimum":1.0},{"type":"null"}],"title":"Max Age Minutes"},"media_refused_only":{"type":"boolean","title":"Media Refused Only","default":false}},"type":"object","title":"BulkReprocessRequest","description":"Filter describing which stored webhooks to re-publish.\n\nWhen ``correlation_ids`` is provided, the other filter fields are ignored\nby the repository — operators get the rows they asked for, regardless of\nstatus / platform / date."},"BulkReprocessResponse":{"properties":{"matched":{"type":"integer","title":"Matched"},"requeued":{"type":"integer","title":"Requeued"},"skipped":{"type":"integer","title":"Skipped"},"failed":{"type":"integer","title":"Failed"},"results":{"items":{"$ref":"#/components/schemas/BulkReprocessItemResult"},"type":"array","title":"Results"}},"type":"object","required":["matched","requeued","skipped","failed","results"],"title":"BulkReprocessResponse"},"DispatchHarvestRequest":{"properties":{"scheduler_slot":{"type":"integer","minimum":0.0,"title":"Scheduler Slot"},"dry_run":{"type":"boolean","title":"Dry Run","default":false}},"type":"object","required":["scheduler_slot"],"title":"DispatchHarvestRequest","description":"``scheduler_slot`` is required: every caller says which slot it dispatches.\n\n``dry_run`` resolves everything and reports what WOULD be fired without\ntouching Apify — deliberately exempt from the kill-switch, so a slot can be\ninspected before the switch is ever flipped."},"DispatchHarvestSummary":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"dry_run":{"type":"boolean","title":"Dry Run"},"scheduler_slot":{"type":"integer","title":"Scheduler Slot"},"companies_considered":{"type":"integer","minimum":0.0,"title":"Companies Considered","default":0},"dispatched":{"items":{"$ref":"#/components/schemas/DispatchedCompany"},"type":"array","title":"Dispatched"},"task_missing":{"items":{"$ref":"#/components/schemas/TaskMissingCompany"},"type":"array","title":"Task Missing"},"failed":{"items":{"$ref":"#/components/schemas/FailedCompany"},"type":"array","title":"Failed"}},"type":"object","required":["enabled","dry_run","scheduler_slot"],"title":"DispatchHarvestSummary","description":"What the call resolved and what it did.\n\n``companies_considered`` counts the distinct companies behind the roster rows\nthe slot resolved to, after those rows collapse by ``apify_task_id``; it\nmatches the number of runs attempted only while every company holds exactly\none task. It is larger than ``dispatched`` whenever a task turned out to be\nmissing or its run failed to start."},"DispatchedCompany":{"properties":{"core_company_id":{"type":"string","title":"Core Company Id"},"core_company_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Core Company Slug"},"apify_task_id":{"type":"string","title":"Apify Task Id"},"run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Id"}},"type":"object","required":["core_company_id","core_company_slug","apify_task_id"],"title":"DispatchedCompany"},"FailedCompany":{"properties":{"core_company_id":{"type":"string","title":"Core Company Id"},"core_company_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Core Company Slug"},"apify_task_id":{"type":"string","title":"Apify Task Id"},"error":{"type":"string","title":"Error"}},"type":"object","required":["core_company_id","core_company_slug","apify_task_id","error"],"title":"FailedCompany"},"FeedPostListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/FeedPostResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"size":{"type":"integer","title":"Size"},"pages":{"type":"integer","title":"Pages"}},"type":"object","required":["items","total","page","size","pages"],"title":"FeedPostListResponse"},"FeedPostMetricResponse":{"properties":{"likes_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Likes Count"},"comments_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Comments Count"},"views_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Views Count"},"shares_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Shares Count"},"saves_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Saves Count"},"plays_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Plays Count"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["likes_count","comments_count","views_count","shares_count","saves_count","plays_count","created_at"],"title":"FeedPostMetricResponse"},"FeedPostProfileResponse":{"properties":{"username":{"type":"string","title":"Username"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"picture_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Picture Url"},"external_id":{"type":"string","title":"External Id"},"platform":{"$ref":"#/components/schemas/Platform"},"role":{"$ref":"#/components/schemas/PostProfileRole"}},"type":"object","required":["username","name","picture_url","external_id","platform","role"],"title":"FeedPostProfileResponse"},"FeedPostResponse":{"properties":{"id":{"type":"integer","title":"Id"},"uuid":{"type":"string","format":"uuid","title":"Uuid"},"external_id":{"type":"string","title":"External Id"},"platform":{"$ref":"#/components/schemas/Platform"},"post_type":{"$ref":"#/components/schemas/PostType"},"media_type":{"anyOf":[{"$ref":"#/components/schemas/MediaType"},{"type":"null"}]},"caption":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Caption"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnail Url"},"downloaded_media_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downloaded Media Url"},"sm_created_at":{"type":"string","format":"date-time","title":"Sm Created At"},"profiles":{"items":{"$ref":"#/components/schemas/FeedPostProfileResponse"},"type":"array","title":"Profiles"},"latest_metric":{"anyOf":[{"$ref":"#/components/schemas/FeedPostMetricResponse"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","uuid","external_id","platform","post_type","media_type","caption","url","thumbnail_url","downloaded_media_url","sm_created_at","profiles","latest_metric","created_at","updated_at"],"title":"FeedPostResponse"},"GalleryListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/GalleryPostResponse"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"},"query_blocked":{"type":"boolean","title":"Query Blocked","default":false}},"type":"object","required":["items","next_cursor"],"title":"GalleryListResponse"},"GalleryPostAuthorResponse":{"properties":{"username":{"type":"string","title":"Username"},"picture_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Picture Url"},"platform":{"$ref":"#/components/schemas/Platform"},"role":{"$ref":"#/components/schemas/PostProfileRole"}},"type":"object","required":["username","picture_url","platform","role"],"title":"GalleryPostAuthorResponse"},"GalleryPostMetricResponse":{"properties":{"likes_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Likes Count"},"comments_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Comments Count"},"views_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Views Count"}},"type":"object","required":["likes_count","comments_count","views_count"],"title":"GalleryPostMetricResponse"},"GalleryPostResponse":{"properties":{"uuid":{"type":"string","format":"uuid","title":"Uuid"},"platform":{"$ref":"#/components/schemas/Platform"},"post_type":{"$ref":"#/components/schemas/PostType"},"media_type":{"anyOf":[{"$ref":"#/components/schemas/MediaType"},{"type":"null"}]},"thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnail Url"},"downloaded_media_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downloaded Media Url"},"media_state":{"$ref":"#/components/schemas/MediaState"},"sm_created_at":{"type":"string","format":"date-time","title":"Sm Created At"},"author":{"anyOf":[{"$ref":"#/components/schemas/GalleryPostAuthorResponse"},{"type":"null"}]},"unverified_author_handle":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unverified Author Handle"},"latest_metric":{"anyOf":[{"$ref":"#/components/schemas/GalleryPostMetricResponse"},{"type":"null"}]},"score":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Score"},"matches_query":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Matches Query"}},"type":"object","required":["uuid","platform","post_type","media_type","thumbnail_url","downloaded_media_url","media_state","sm_created_at","author","latest_metric"],"title":"GalleryPostResponse"},"GallerySearchRequest":{"properties":{"core_company_id":{"type":"string","minLength":1,"title":"Core Company Id"},"platform":{"anyOf":[{"$ref":"#/components/schemas/Platform"},{"type":"null"}]},"post_type":{"anyOf":[{"items":{"$ref":"#/components/schemas/PostType"},"type":"array"},{"type":"null"}],"title":"Post Type"},"media_type":{"anyOf":[{"items":{"$ref":"#/components/schemas/MediaType"},"type":"array"},{"type":"null"}],"title":"Media Type"},"content_tags":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":100},{"type":"null"}],"title":"Content Tags"},"content_tags_match":{"type":"string","enum":["any","all"],"title":"Content Tags Match","default":"any"},"hashtags":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":100},{"type":"null"}],"title":"Hashtags"},"hashtags_match":{"type":"string","enum":["any","all"],"title":"Hashtags Match","default":"any"},"username":{"anyOf":[{"type":"string","maxLength":150,"minLength":1},{"type":"null"}],"title":"Username"},"author_external_id":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":15000},{"type":"null"}],"title":"Author External Id"},"created_after":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created After"},"created_before":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created Before"},"query":{"anyOf":[{"type":"string","maxLength":500,"minLength":2},{"type":"null"}],"title":"Query"},"cursor":{"anyOf":[{"type":"string","maxLength":8192},{"type":"null"}],"title":"Cursor"},"limit":{"type":"integer","maximum":100.0,"minimum":1.0,"title":"Limit","default":20}},"type":"object","required":["core_company_id"],"title":"GallerySearchRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HandleRef":{"properties":{"platform":{"$ref":"#/components/schemas/Platform"},"username":{"type":"string","title":"Username"}},"type":"object","required":["platform","username"],"title":"HandleRef","description":"A brand-side social handle linked to a company.\n\nSourced from the company's linked ``CompanyProfile -> Profile.username`` rows.\n``platform`` value is ``\"instagram\"`` (Platform StrEnum serializes to its\nstring value)."},"MediaState":{"type":"string","enum":["pending","done","dead"],"title":"MediaState","description":"Lifecycle state of a post's downloadable media.\n\nGeneric and platform-agnostic. ``downloaded_media_url is NULL`` alone cannot\ntell *never tried* / *in flight* / *permanently unavailable* apart, so this\ncompanion state does:\n\n- ``pending`` — media is expected but not yet captured (Moment 1 of the\n  TikTok mentions webhook). Analysis DEFERS (keeps fields NULL); the\n  media-recovery contingency retries.\n- ``done`` — media is settled: it was persisted, OR the row genuinely has no\n  recoverable media (daily scrape / history / Instagram). The DEFAULT, so the\n  migration never marks the existing base ``pending``.\n- ``dead`` — media is permanently unavailable; the contingency retired it."},"MediaType":{"type":"string","enum":["image","video","carousel","live"],"title":"MediaType"},"MentionsUsageResponse":{"properties":{"month":{"type":"string","title":"Month"},"platform_counts":{"$ref":"#/components/schemas/PlatformCounts"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["month","platform_counts","total"],"title":"MentionsUsageResponse","description":"Per-platform distinct-mention usage for a company in one month.\n\n``month`` is the month the mention was INGESTED, not the month its author\npublished it."},"MetaDisconnectRequest":{"properties":{"core_company_id":{"type":"string","format":"uuid","title":"Core Company Id"},"keep_page_ids":{"items":{"type":"string"},"type":"array","title":"Keep Page Ids"},"company_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Slug"}},"type":"object","required":["core_company_id"],"title":"MetaDisconnectRequest","description":"Disconnect a company's Meta connection.\n\n``core_company_id`` is UUID-validated (422 on a malformed value).\n``keep_page_ids`` are the IG ``tokens.page_id`` values to RETAIN; every Meta\npage NOT in this list is torn down. Omit (or send ``[]``) for a full\ndisconnect. Provide the surviving pages for a substitutive swap."},"MetaDisconnectResponse":{"properties":{"tokens_removed":{"type":"integer","minimum":0.0,"title":"Tokens Removed"},"links_removed":{"type":"integer","minimum":0.0,"title":"Links Removed"},"provision_states_removed":{"type":"integer","minimum":0.0,"title":"Provision States Removed"},"removed_page_ids":{"items":{"type":"string"},"type":"array","title":"Removed Page Ids"},"failed_page_ids":{"items":{"type":"string"},"type":"array","title":"Failed Page Ids"},"harvest_removed":{"type":"boolean","title":"Harvest Removed","default":false}},"type":"object","required":["tokens_removed","links_removed","provision_states_removed"],"title":"MetaDisconnectResponse","description":"A summary of what the disconnect removed.\n\n``removed_page_ids`` / ``failed_page_ids`` report the per-page outcome (a\nper-page failure never aborts the rest). ``harvest_removed`` is ``true`` only\nwhen the company had NO surviving Meta page and its IG Apify harvest was torn\ndown. All-zero / empty is a valid idempotent no-op (200, never 404). Carries no\ntoken material."},"MetaProbeCheck":{"properties":{"key":{"type":"string","title":"Key"},"status":{"$ref":"#/components/schemas/MetaProbeCheckStatus"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail"}},"type":"object","required":["key","status"],"title":"MetaProbeCheck","description":"A single probe check result. Mirrors core's ``MetaProbeCheck``."},"MetaProbeCheckStatus":{"type":"string","enum":["ok","failed","inconclusive"],"title":"MetaProbeCheckStatus"},"MetaTokenValidationRequest":{"properties":{"core_company_id":{"type":"string","format":"uuid","title":"Core Company Id"}},"type":"object","required":["core_company_id"],"title":"MetaTokenValidationRequest"},"MetaTokenValidationResponse":{"properties":{"checks":{"items":{"$ref":"#/components/schemas/MetaProbeCheck"},"type":"array","title":"Checks"}},"type":"object","required":["checks"],"title":"MetaTokenValidationResponse"},"PipelineAckResponse":{"properties":{"status":{"type":"string","title":"Status","default":"ok"},"message_id":{"type":"string","title":"Message Id"}},"type":"object","required":["message_id"],"title":"PipelineAckResponse"},"Platform":{"type":"string","enum":["instagram","tiktok"],"title":"Platform"},"PlatformCounts":{"properties":{"instagram":{"type":"integer","title":"Instagram","default":0},"tiktok":{"type":"integer","title":"Tiktok","default":0}},"type":"object","title":"PlatformCounts","description":"Distinct-mention counts per platform.\n\nBoth keys are always present and default to zero so the metering\nconsumer can rely on a stable shape regardless of which platforms\nproduced data."},"PostByCompanyItem":{"properties":{"uuid":{"type":"string","format":"uuid","title":"Uuid"},"external_id":{"type":"string","title":"External Id"},"post_type":{"$ref":"#/components/schemas/PostType"},"media_type":{"$ref":"#/components/schemas/MediaType"},"sm_created_at":{"type":"string","format":"date-time","title":"Sm Created At"},"author_username":{"type":"string","title":"Author Username"},"author_external_id":{"type":"string","title":"Author External Id"},"likes_count":{"type":"integer","title":"Likes Count","default":0},"comments_count":{"type":"integer","title":"Comments Count","default":0},"plays_count":{"type":"integer","title":"Plays Count","default":0},"shares_count":{"type":"integer","title":"Shares Count","default":0},"saves_count":{"type":"integer","title":"Saves Count","default":0}},"type":"object","required":["uuid","external_id","post_type","media_type","sm_created_at","author_username","author_external_id"],"title":"PostByCompanyItem"},"PostCommentItem":{"properties":{"id":{"type":"string","title":"Id"},"text":{"type":"string","title":"Text"},"username":{"type":"string","title":"Username"},"profile_picture":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Profile Picture"},"likes_count":{"type":"integer","title":"Likes Count"},"replies_count":{"type":"integer","title":"Replies Count"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["id","text","username","likes_count","replies_count"],"title":"PostCommentItem","description":"A single comment in the frozen read contract.\n\nField names are snake_case and MUST NOT be renamed — this is a\ncross-repo contract consumed by core/front."},"PostCommentsResponse":{"properties":{"post_id":{"type":"string","title":"Post Id"},"comments":{"items":{"$ref":"#/components/schemas/PostCommentItem"},"type":"array","title":"Comments"},"refreshed":{"type":"boolean","title":"Refreshed","default":false},"refreshed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Refreshed At"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["post_id","comments"],"title":"PostCommentsResponse","description":"Response body for ``GET /posts/{post_uuid}/comments``."},"PostDetailMetricResponse":{"properties":{"likes_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Likes Count"},"comments_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Comments Count"},"views_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Views Count"},"shares_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Shares Count"},"saves_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Saves Count"},"plays_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Plays Count"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["likes_count","comments_count","views_count","shares_count","saves_count","plays_count","created_at"],"title":"PostDetailMetricResponse"},"PostDetailProfileResponse":{"properties":{"username":{"type":"string","title":"Username"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"picture_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Picture Url"},"external_id":{"type":"string","title":"External Id"},"platform":{"$ref":"#/components/schemas/Platform"},"role":{"$ref":"#/components/schemas/PostProfileRole"}},"type":"object","required":["username","name","picture_url","external_id","platform","role"],"title":"PostDetailProfileResponse"},"PostDetailResponse":{"properties":{"uuid":{"type":"string","format":"uuid","title":"Uuid"},"external_id":{"type":"string","title":"External Id"},"platform":{"$ref":"#/components/schemas/Platform"},"post_type":{"$ref":"#/components/schemas/PostType"},"media_type":{"anyOf":[{"$ref":"#/components/schemas/MediaType"},{"type":"null"}]},"caption":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Caption"},"hashtags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Hashtags"},"mentions":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Mentions"},"content_tags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Content Tags"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnail Url"},"downloaded_media_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downloaded Media Url"},"media_state":{"$ref":"#/components/schemas/MediaState"},"video_duration":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Video Duration"},"is_comment_disabled":{"type":"boolean","title":"Is Comment Disabled"},"sm_created_at":{"type":"string","format":"date-time","title":"Sm Created At"},"profiles":{"items":{"$ref":"#/components/schemas/PostDetailProfileResponse"},"type":"array","title":"Profiles"},"unverified_author_handle":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unverified Author Handle"},"latest_metric":{"anyOf":[{"$ref":"#/components/schemas/PostDetailMetricResponse"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["uuid","external_id","platform","post_type","media_type","caption","hashtags","mentions","url","thumbnail_url","downloaded_media_url","media_state","video_duration","is_comment_disabled","sm_created_at","profiles","latest_metric","created_at","updated_at"],"title":"PostDetailResponse"},"PostIngestCallbackPayload":{"properties":{"request_uuid":{"type":"string","format":"uuid","title":"Request Uuid"},"run_id":{"type":"string","minLength":1,"pattern":"^[^{}]+$","title":"Run Id"},"event_type":{"type":"string","minLength":1,"title":"Event Type"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"dataset_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dataset Id"}},"type":"object","required":["request_uuid","run_id","event_type"],"title":"PostIngestCallbackPayload","description":"The ad-hoc webhook payload the one-shot ingestion run posts back.\n\nShape is owned by the dossier's own ``payloadTemplate`` (see\n``ApifyClient._encode_run_webhooks``): ``request_uuid`` is baked at dispatch\n-- it is the only way back to the request, since this flow has no\n``external_id`` yet -- while ``run_id`` / ``dataset_id`` / ``status`` /\n``event_type`` render from the run's ``{{resource.*}}`` + ``{{eventType}}``.\n``extra`` is ignored so the run's verbose ``resource`` block does not fail\nvalidation."},"PostIngestCallbackResponse":{"properties":{"request_uuid":{"type":"string","format":"uuid","title":"Request Uuid"},"status":{"$ref":"#/components/schemas/PostIngestStatus"}},"type":"object","required":["request_uuid","status"],"title":"PostIngestCallbackResponse"},"PostIngestRequestCreate":{"properties":{"url":{"type":"string","minLength":1,"title":"Url"},"requested_by":{"type":"string","minLength":1,"title":"Requested By"}},"additionalProperties":false,"type":"object","required":["url","requested_by"],"title":"PostIngestRequestCreate","description":"The ingestion request: a URL and who asked for it. Nothing else.\n\n``extra=\"forbid\"`` is the requirement, not a default: a brand or company\nfield must fail validation rather than be ignored, because a request that\nsilently drops it would let an operator believe they had pointed a post at a\nbrand. The brand is resolved downstream from the item itself, and the\nplatform is derived from the URL server-side.\n\n``url`` travels byte-exact all the way to Apify -- query string kept, nothing\nstripped."},"PostIngestRequestCreated":{"properties":{"uuid":{"type":"string","format":"uuid","title":"Uuid"},"platform":{"$ref":"#/components/schemas/Platform"},"status":{"$ref":"#/components/schemas/PostIngestStatus"},"run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Id"},"source_url":{"type":"string","title":"Source Url"}},"type":"object","required":["uuid","platform","status","run_id","source_url"],"title":"PostIngestRequestCreated","description":"What the dispatch route answers with, without waiting for the run."},"PostIngestRequestStatus":{"properties":{"uuid":{"type":"string","format":"uuid","title":"Uuid"},"platform":{"$ref":"#/components/schemas/Platform"},"status":{"$ref":"#/components/schemas/PostIngestStatus"},"run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Id"},"source_url":{"type":"string","title":"Source Url"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id"},"outcome_detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outcome Detail"}},"type":"object","required":["uuid","platform","status","run_id","source_url","external_id","outcome_detail"],"title":"PostIngestRequestStatus","description":"What a request looks up as; the two extra fields fill in when it settles."},"PostIngestStatus":{"type":"string","enum":["PENDING","INGESTED","ALREADY_EXISTS","NOT_FOUND","FAILED"],"title":"PostIngestStatus"},"PostLookupItem":{"properties":{"uuid":{"type":"string","format":"uuid","title":"Uuid"},"platform":{"$ref":"#/components/schemas/Platform"},"external_id":{"type":"string","title":"External Id"},"post_type":{"$ref":"#/components/schemas/PostType"},"media_type":{"anyOf":[{"$ref":"#/components/schemas/MediaType"},{"type":"null"}]},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnail Url"},"downloaded_media_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downloaded Media Url"},"media_state":{"$ref":"#/components/schemas/MediaState"},"sm_created_at":{"type":"string","format":"date-time","title":"Sm Created At"}},"type":"object","required":["uuid","platform","external_id","post_type","media_type","url","thumbnail_url","downloaded_media_url","media_state","sm_created_at"],"title":"PostLookupItem"},"PostLookupRequest":{"properties":{"uuids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":100,"title":"Uuids"},"refs":{"items":{"$ref":"#/components/schemas/PostRef"},"type":"array","maxItems":100,"title":"Refs"}},"additionalProperties":false,"type":"object","title":"PostLookupRequest","description":"Batch lookup of posts by dossier ``uuid`` and/or natural key ``(platform, external_id)``.\n\nAt least one of the two lists must be non-empty; each is capped at 100 keys."},"PostLookupResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PostLookupItem"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"PostLookupResponse","description":"Posts found for the requested keys.\n\nKeys that match no live post are omitted, a post matched by several keys\nappears once, and the order of ``items`` is not guaranteed."},"PostProfileRole":{"type":"string","enum":["author","coauthor","mentioned"],"title":"PostProfileRole"},"PostRef":{"properties":{"platform":{"$ref":"#/components/schemas/Platform"},"external_id":{"type":"string","minLength":1,"title":"External Id"}},"additionalProperties":false,"type":"object","required":["platform","external_id"],"title":"PostRef"},"PostType":{"type":"string","enum":["feed","story","reel","live"],"title":"PostType"},"PostsByCompanyRequest":{"properties":{"core_company_id":{"type":"string","format":"uuid","title":"Core Company Id"},"platform":{"$ref":"#/components/schemas/Platform"},"created_after":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created After"},"cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"},"limit":{"type":"integer","maximum":500.0,"minimum":1.0,"title":"Limit","default":100}},"type":"object","required":["core_company_id","platform"],"title":"PostsByCompanyRequest","description":"Request for posts mentioning a company on one platform.\n\nThe ``cursor`` payload is opaque to the consumer. Internally the\ncursor encodes ``(sm_created_at, Post.id)`` so the tiebreaker for\nposts sharing a single ``sm_created_at`` value is the dossier-internal\nprimary key ``Post.id``. Callers should treat any value returned in\n``PostsByCompanyResponse.next_cursor`` as an opaque token to pass\nback unchanged on the following request."},"PostsByCompanyResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PostByCompanyItem"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items","next_cursor"],"title":"PostsByCompanyResponse","description":"Response for posts mentioning a company on one platform.\n\nConsumers MUST keep paginating while ``next_cursor`` is not ``None``,\neven if ``items`` is empty. An empty ``items`` with a non-null\n``next_cursor`` means the page existed but every post on it was\nfiltered out (missing AUTHOR relation or ``media_type``) — the\ncursor still advances and the next page may contain results."},"ProfileCreate":{"properties":{"external_id":{"type":"string","minLength":1,"title":"External Id"},"platform":{"$ref":"#/components/schemas/Platform"},"username":{"type":"string","maxLength":100,"minLength":1,"title":"Username"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"biography":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Biography"},"picture_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Picture Url"},"is_private":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Private"},"is_verified":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Verified"},"was_scraped":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Was Scraped"},"meta_data":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Meta Data"},"followers_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Followers Count"},"follows_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Follows Count"},"posts_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Posts Count"},"highlights_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Highlights Count"},"total_likes_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Likes Count"}},"type":"object","required":["external_id","platform","username"],"title":"ProfileCreate"},"ProfileListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ProfileResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"size":{"type":"integer","title":"Size"},"pages":{"type":"integer","title":"Pages"}},"type":"object","required":["items","total","page","size","pages"],"title":"ProfileListResponse"},"ProfileMetricResponse":{"properties":{"id":{"type":"integer","title":"Id"},"uuid":{"type":"string","format":"uuid","title":"Uuid"},"followers_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Followers Count"},"follows_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Follows Count"},"posts_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Posts Count"},"highlights_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Highlights Count"},"total_likes_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Likes Count"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","uuid","followers_count","follows_count","posts_count","highlights_count","total_likes_count","created_at"],"title":"ProfileMetricResponse"},"ProfileResponse":{"properties":{"id":{"type":"integer","title":"Id"},"uuid":{"type":"string","format":"uuid","title":"Uuid"},"external_id":{"type":"string","title":"External Id"},"platform":{"$ref":"#/components/schemas/Platform"},"username":{"type":"string","title":"Username"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"biography":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Biography"},"picture_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Picture Url"},"is_private":{"type":"boolean","title":"Is Private"},"is_verified":{"type":"boolean","title":"Is Verified"},"was_scraped":{"type":"boolean","title":"Was Scraped"},"meta_data":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Meta Data"},"sm_fetched_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Sm Fetched At"},"latest_metric":{"anyOf":[{"$ref":"#/components/schemas/ProfileMetricResponse"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","uuid","external_id","platform","username","name","biography","picture_url","is_private","is_verified","was_scraped","meta_data","sm_fetched_at","latest_metric","created_at","updated_at"],"title":"ProfileResponse"},"ProfileUpdate":{"properties":{"username":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Username"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"biography":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Biography"},"picture_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Picture Url"},"is_private":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Private"},"is_verified":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Verified"},"was_scraped":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Was Scraped"},"meta_data":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Meta Data"},"followers_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Followers Count"},"follows_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Follows Count"},"posts_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Posts Count"},"highlights_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Highlights Count"},"total_likes_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Likes Count"}},"type":"object","title":"ProfileUpdate"},"ProvisionHarvestRequest":{"properties":{"company_slug":{"type":"string","minLength":1,"title":"Company Slug"},"sm_instagram":{"type":"string","minLength":1,"title":"Sm Instagram"},"sm_instagram_handles":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Sm Instagram Handles"},"client_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Token"},"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name"},"posts_newer_than":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Posts Newer Than"},"core_company_id":{"type":"string","minLength":1,"title":"Core Company Id"}},"type":"object","required":["company_slug","sm_instagram","core_company_id"],"title":"ProvisionHarvestRequest"},"ProvisionHarvestResponse":{"properties":{"actor_task_id":{"type":"string","title":"Actor Task Id"},"schedule_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Schedule Id"},"webhook_ids":{"items":{"type":"string"},"type":"array","title":"Webhook Ids"},"slack_integration":{"type":"string","enum":["created","deferred","unchanged"],"title":"Slack Integration"},"created":{"type":"boolean","title":"Created"}},"type":"object","required":["actor_task_id","schedule_id","webhook_ids","slack_integration","created"],"title":"ProvisionHarvestResponse"},"ProvisionLinkRequest":{"properties":{"core_company_id":{"type":"string","minLength":1,"title":"Core Company Id"},"platform":{"$ref":"#/components/schemas/Platform"},"username":{"type":"string","minLength":1,"title":"Username"}},"type":"object","required":["core_company_id","platform","username"],"title":"ProvisionLinkRequest"},"ProvisionLinkResponse":{"properties":{"profile_id":{"type":"integer","title":"Profile Id"},"external_id":{"type":"string","title":"External Id"},"platform":{"$ref":"#/components/schemas/Platform"},"username":{"type":"string","title":"Username"},"linked":{"type":"boolean","title":"Linked","default":true}},"type":"object","required":["profile_id","external_id","platform","username"],"title":"ProvisionLinkResponse"},"PubSubPushEnvelope":{"properties":{"message":{"$ref":"#/components/schemas/PubSubPushMessage"},"subscription":{"type":"string","title":"Subscription"},"deliveryAttempt":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Deliveryattempt"}},"type":"object","required":["message","subscription"],"title":"PubSubPushEnvelope"},"PubSubPushMessage":{"properties":{"data":{"type":"string","title":"Data"},"message_id":{"type":"string","title":"Message Id"},"publish_time":{"type":"string","title":"Publish Time"},"attributes":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Attributes"}},"type":"object","required":["data","message_id","publish_time"],"title":"PubSubPushMessage"},"ReprocessResponse":{"properties":{"status":{"type":"string","title":"Status","default":"reprocessing"},"webhook_id":{"type":"integer","title":"Webhook Id"},"correlation_id":{"type":"string","title":"Correlation Id"}},"type":"object","required":["webhook_id","correlation_id"],"title":"ReprocessResponse"},"ResolvedProfileRef":{"properties":{"platform":{"$ref":"#/components/schemas/Platform"},"username":{"type":"string","title":"Username"},"external_id":{"type":"string","title":"External Id"}},"type":"object","required":["platform","username","external_id"],"title":"ResolvedProfileRef"},"ScopedIdResolveRequest":{"properties":{"igsid":{"type":"string","minLength":1,"pattern":"^[0-9]+$","title":"Igsid"},"recipient_account_id":{"type":"string","minLength":1,"pattern":"^[0-9]+$","title":"Recipient Account Id"}},"type":"object","required":["igsid","recipient_account_id"],"title":"ScopedIdResolveRequest"},"ScopedIdResolveResponse":{"properties":{"username":{"type":"string","title":"Username"}},"type":"object","required":["username"],"title":"ScopedIdResolveResponse"},"SearchListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SearchPostResponse"},"type":"array","title":"Items"},"query_blocked":{"type":"boolean","title":"Query Blocked","default":false}},"type":"object","required":["items"],"title":"SearchListResponse"},"SearchPostResponse":{"properties":{"uuid":{"type":"string","format":"uuid","title":"Uuid"},"platform":{"$ref":"#/components/schemas/Platform"},"post_type":{"$ref":"#/components/schemas/PostType"},"media_type":{"anyOf":[{"$ref":"#/components/schemas/MediaType"},{"type":"null"}]},"caption":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Caption"},"thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnail Url"},"downloaded_media_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Downloaded Media Url"},"sm_created_at":{"type":"string","format":"date-time","title":"Sm Created At"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"transcription":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transcription"},"content_tags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Content Tags"},"author":{"anyOf":[{"$ref":"#/components/schemas/GalleryPostAuthorResponse"},{"type":"null"}]},"latest_metric":{"anyOf":[{"$ref":"#/components/schemas/GalleryPostMetricResponse"},{"type":"null"}]},"score":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Score"}},"type":"object","required":["uuid","platform","post_type","media_type","caption","thumbnail_url","downloaded_media_url","sm_created_at","description","transcription","content_tags","author","latest_metric","score"],"title":"SearchPostResponse"},"SocialListeningSignalsResponse":{"properties":{"meta_token_present":{"type":"boolean","title":"Meta Token Present"},"tiktok_token_present":{"type":"boolean","title":"Tiktok Token Present"},"meta_page_ids":{"items":{"type":"string"},"type":"array","title":"Meta Page Ids"},"last_successful_harvest_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Successful Harvest Run At"},"handles":{"items":{"$ref":"#/components/schemas/HandleRef"},"type":"array","title":"Handles","default":[]}},"type":"object","required":["meta_token_present","tiktok_token_present","meta_page_ids","last_successful_harvest_run_at"],"title":"SocialListeningSignalsResponse","description":"Read-only social-listening readiness signals for a company.\n\nSurfaces whether a Meta token is configured, the distinct page IDs\nthose tokens cover, when the most recent successful harvest run\nfinished, and the authoritative brand-side handles. Absent state\nserializes as ``False`` / ``[]`` / ``None`` / ``[]`` — the endpoint\nnever 404s.\n\nBoth ``*_token_present`` flags are derived from TOKEN rows and are the\nauthoritative per-platform connection signal. ``handles`` must never be used\nto infer connectivity -- a handle is provisioned from a bare username, without\nOAuth or a token. Every ``meta_*`` field is scoped to Instagram tokens only, and\n``last_successful_harvest_run_at`` to Instagram harvest runs only."},"StoryDeliveryCheckRequest":{"properties":{"dry_run":{"type":"boolean","title":"Dry Run","default":false}},"type":"object","title":"StoryDeliveryCheckRequest","description":"``dry_run`` runs the check and answers what it found without logging the per-page\nsignals, so it is exempt from the kill-switch: the query can be tried in production\nbefore the check is turned on. Cloud Scheduler sends ``{}``."},"StoryDeliveryCheckResponse":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"dry_run":{"type":"boolean","title":"Dry Run","default":false},"checked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Checked At"},"pages_checked":{"type":"integer","title":"Pages Checked","default":0},"pages_out_of_scope":{"type":"integer","title":"Pages Out Of Scope","default":0},"scope_snapshot":{"type":"boolean","title":"Scope Snapshot","default":false},"open_pages":{"type":"integer","title":"Open Pages","default":0},"systemic_silence":{"type":"boolean","title":"Systemic Silence","default":false},"systemic_min_pages":{"type":"integer","minimum":0.0,"title":"Systemic Min Pages","default":0},"signals":{"items":{"$ref":"#/components/schemas/StoryDeliverySignal"},"type":"array","title":"Signals"}},"type":"object","required":["enabled"],"title":"StoryDeliveryCheckResponse"},"StoryDeliveryRule":{"type":"string","enum":["silent_6h","routed_away","inbound_stopped","stories_stopped","long_silence"],"title":"StoryDeliveryRule","description":"Why a page is reported: at most one rule per page at a time, each with its own cause. The\nvalues are log and metric labels: never rename them (``silent_24h`` was retired on\n2026-12-03 and replaced by ``stories_stopped``, a new label with its own policy).\n\n- ``silent_6h``: a very busy page (30+ stories expected in some 6 h of the first 12 h of\n  the silence) got no story for 6 h. Early warning for those pages; it owns the case (P2).\n- ``routed_away``: 12 h or more with no story and no inbound message, while the page's own\n  outgoing messages (echoes) arrived: Meta delivers its conversations to another app (P2).\n- ``inbound_stopped``: 14 h or more with no story, no inbound message and almost no echoes,\n  on a page that usually gets both: its connection stopped delivering anything (P2).\n- ``stories_stopped``: 18 h without a story (24 h on quieter pages) that no message rule\n  explains: the story mentions are not arriving (P2, safety net).\n- ``long_silence`` (RUMO-938): no story Meta delivered for more than 7 days, past every rule\n  above, on a page whose inbox the story inbox fallback read and found mentions Meta did not\n  deliver: the mentions stay in the inbox, the reading recovers them (P3). Left out of\n  ``open_pages`` and ``systemic_silence``."},"StoryDeliverySignal":{"properties":{"rule":{"$ref":"#/components/schemas/StoryDeliveryRule"},"page_id":{"type":"string","title":"Page Id"},"handle":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Handle"},"company_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Id"},"window_hours":{"type":"integer","title":"Window Hours"},"expected":{"type":"number","title":"Expected"},"observed":{"type":"integer","title":"Observed"},"inbound":{"type":"integer","title":"Inbound"},"echoes":{"type":"integer","title":"Echoes"},"silent_hours":{"type":"integer","title":"Silent Hours"},"last_story_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Story At"}},"type":"object","required":["rule","page_id","handle","company_id","window_hours","expected","observed","inbound","echoes","silent_hours","last_story_at"],"title":"StoryDeliverySignal","description":"One rule that holds for one page at check time."},"StoryInboxFallbackRequest":{"properties":{"dry_run":{"type":"boolean","title":"Dry Run","default":false},"page_ids":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":1,"minItems":1},{"type":"null"}],"title":"Page Ids"},"since":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Since"},"after":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"After"},"max_pages":{"anyOf":[{"type":"integer","maximum":200.0,"minimum":1.0},{"type":"null"}],"title":"Max Pages"}},"type":"object","title":"StoryInboxFallbackRequest","description":"``dry_run`` reads the inboxes and answers what it would ingest, writing nothing (no\nintake, no cursor), so it is exempt from the kill-switch. Cloud Scheduler sends ``{}``.\n\nBackfill (RUMO-928, recovering what Meta did not deliver before the fallback was on): an\noperator sends ``page_ids`` (one page) and ``since``. The read covers ``[since, now]``,\nignores the usage gate and never reads or moves the page's cursor. One call reads at most\n``max_pages`` inbox pages (or stops at its time budget) and answers ``next_after`` while there\nis more; the next call sends it back as ``after``. The dedupe makes a repeated call harmless."},"StoryInboxFallbackResponse":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"dry_run":{"type":"boolean","title":"Dry Run","default":false},"mode":{"type":"string","enum":["cycle","backfill"],"title":"Mode","default":"cycle"},"checked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Checked At"},"pages":{"items":{"$ref":"#/components/schemas/StoryInboxPageResult"},"type":"array","title":"Pages"}},"type":"object","required":["enabled"],"title":"StoryInboxFallbackResponse"},"StoryInboxPageOutcome":{"type":"string","enum":["read","skipped","failed"],"title":"StoryInboxPageOutcome"},"StoryInboxPageResult":{"properties":{"page_id":{"type":"string","title":"Page Id"},"outcome":{"$ref":"#/components/schemas/StoryInboxPageOutcome"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"read_since":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Read Since"},"conversations":{"type":"integer","title":"Conversations","default":0},"mentions_found":{"type":"integer","title":"Mentions Found","default":0},"mentions_new":{"type":"integer","title":"Mentions New","default":0},"mentions_ingested":{"type":"integer","title":"Mentions Ingested","default":0},"with_link":{"type":"integer","title":"With Link","default":0},"with_asset_id":{"type":"integer","title":"With Asset Id","default":0},"usage_pct":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Usage Pct"},"truncated":{"type":"boolean","title":"Truncated","default":false},"next_after":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next After"}},"type":"object","required":["page_id","outcome"],"title":"StoryInboxPageResult"},"StoryScopeCompany":{"properties":{"company_id":{"type":"string","minLength":1,"title":"Company Id"},"windows":{"items":{"$ref":"#/components/schemas/StoryScopeWindow"},"type":"array","title":"Windows"}},"type":"object","required":["company_id","windows"],"title":"StoryScopeCompany","description":"A core company and its windows (none: it consumes no stories)."},"StoryScopeSnapshotRequest":{"properties":{"generated_at":{"type":"string","format":"date-time","title":"Generated At"},"companies":{"items":{"$ref":"#/components/schemas/StoryScopeCompany"},"type":"array","minItems":1,"title":"Companies"}},"type":"object","required":["generated_at","companies"],"title":"StoryScopeSnapshotRequest","description":"The whole snapshot. ``generated_at``: when core built it; a snapshot not newer than the\nstored one is refused. Each company appears once."},"StoryScopeSnapshotResponse":{"properties":{"companies":{"type":"integer","title":"Companies"},"windows":{"type":"integer","title":"Windows"},"in_scope_now":{"type":"integer","title":"In Scope Now"},"out_of_scope_now":{"type":"integer","title":"Out Of Scope Now"},"generated_at":{"type":"string","format":"date-time","title":"Generated At"}},"type":"object","required":["companies","windows","in_scope_now","out_of_scope_now","generated_at"],"title":"StoryScopeSnapshotResponse","description":"What was stored: how many companies and windows, and how many companies are in and out of\nthe story scope at the time it was stored."},"StoryScopeWindow":{"properties":{"kind":{"type":"string","enum":["sl_instagram","game"],"title":"Kind"},"start":{"type":"string","format":"date-time","title":"Start"},"end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"End"}},"type":"object","required":["kind","start"],"title":"StoryScopeWindow","description":"A stretch in which the company consumes stories: ``start <= now < end``.\n\n``end`` None = open-ended. Both carry an offset, so \"now inside\" never depends on the\nserver's zone."},"TaskMissingCompany":{"properties":{"core_company_id":{"type":"string","title":"Core Company Id"},"core_company_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Core Company Slug"},"apify_task_id":{"type":"string","title":"Apify Task Id"}},"type":"object","required":["core_company_id","core_company_slug","apify_task_id"],"title":"TaskMissingCompany"},"TikTokApifyActionMetaData":{"properties":{"actorRunId":{"type":"string","minLength":1,"title":"Actorrunid"},"mentionedClientId":{"type":"string","minLength":1,"title":"Mentionedclientid"}},"type":"object","required":["actorRunId","mentionedClientId"],"title":"TikTokApifyActionMetaData"},"TikTokApifyIntakeRequest":{"properties":{"actionMetaData":{"$ref":"#/components/schemas/TikTokApifyActionMetaData"},"socialMediaMentions":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Socialmediamentions"}},"type":"object","required":["actionMetaData","socialMediaMentions"],"title":"TikTokApifyIntakeRequest"},"TikTokApifyRunCallbackPayload":{"properties":{"external_id":{"type":"string","minLength":1,"title":"External Id"},"client_id":{"type":"string","minLength":1,"title":"Client Id"},"run_id":{"type":"string","minLength":1,"title":"Run Id"},"event_type":{"type":"string","minLength":1,"title":"Event Type"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"dataset_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dataset Id"}},"type":"object","required":["external_id","client_id","run_id","event_type"],"title":"TikTokApifyRunCallbackPayload","description":"The ad-hoc webhook payload the one-shot media run posts back.\n\nShape is owned by the dossier's own ``payloadTemplate`` (see\n``ApifyClient._encode_run_webhooks``): ``external_id`` / ``client_id`` are\nbaked at dispatch; ``run_id`` / ``dataset_id`` / ``status`` / ``event_type``\nrender from the run's ``{{resource.*}}`` + ``{{eventType}}``. ``extra`` is\nignored so the run's verbose ``resource`` block does not fail validation."},"TikTokApifyRunCallbackResponse":{"properties":{"status":{"type":"string","title":"Status"},"run_id":{"type":"string","title":"Run Id"},"media_found":{"type":"boolean","title":"Media Found"}},"type":"object","required":["status","run_id","media_found"],"title":"TikTokApifyRunCallbackResponse"},"TikTokConnectRequest":{"properties":{"core_company_id":{"type":"string","format":"uuid","title":"Core Company Id"},"code":{"type":"string","minLength":1,"title":"Code"},"redirect_uri":{"type":"string","minLength":1,"title":"Redirect Uri"}},"type":"object","required":["core_company_id","code","redirect_uri"],"title":"TikTokConnectRequest","description":"The raw OAuth ``code`` forwarded by core's TikTok connect callback, plus\nthe ``redirect_uri`` TikTok requires to match the authorize step exactly. The\ndossier exchanges it, stores the token, resolves the @, and returns it on the\nsame ``TokenResponse`` shape POST /tokens uses."},"TikTokDisconnectRequest":{"properties":{"core_company_id":{"type":"string","format":"uuid","title":"Core Company Id"}},"type":"object","required":["core_company_id"],"title":"TikTokDisconnectRequest","description":"Clear the stored TikTok token for a company. The SL ConnectionsModal\n\"disconnect TikTok\" action forwards here. ``core_company_id`` is\nUUID-validated (422 on a malformed value)."},"TikTokDisconnectResponse":{"properties":{"disconnected":{"type":"integer","minimum":0.0,"title":"Disconnected"},"links_removed":{"type":"integer","minimum":0.0,"title":"Links Removed","default":0}},"type":"object","required":["disconnected"],"title":"TikTokDisconnectResponse","description":"How many TikTok token row(s) were cleared. ``0`` is a valid idempotent\nno-op (the company had nothing connected) -- never a 404. Carries no token\nmaterial.\n\nAdditive ``links_removed`` -- the disconnect now ALSO removes the company's\nTikTok ``CompanyProfile`` link(s) so no orphan link survives the token delete.\nThe ``Profile`` (the handle) is untouched. ``disconnected`` keeps its meaning\n(token rows removed), so existing consumers are unaffected."},"TikTokMediaReprocessSummary":{"properties":{"scanned":{"type":"integer","minimum":0.0,"title":"Scanned"},"fired":{"type":"integer","minimum":0.0,"title":"Fired"},"retired":{"type":"integer","minimum":0.0,"title":"Retired"},"failed":{"type":"integer","minimum":0.0,"title":"Failed"}},"type":"object","required":["scanned","fired","retired","failed"],"title":"TikTokMediaReprocessSummary","description":"Per-scan outcome counts.\n\n``scanned`` is every pending TikTok post seen; ``fired`` re-dispatched a media\nrun; ``retired`` aged out to ``dead`` (> MAX_AGE); ``failed`` could not start\nits media run and is retried on the next scan."},"TikTokTokenRefreshSummary":{"properties":{"eligible":{"type":"integer","minimum":0.0,"title":"Eligible"},"refreshed":{"type":"integer","minimum":0.0,"title":"Refreshed"},"failed":{"type":"integer","minimum":0.0,"title":"Failed"}},"type":"object","required":["eligible","refreshed","failed"],"title":"TikTokTokenRefreshSummary","description":"The per-run summary the Cloud Scheduler refresh batch returns."},"TokenCreate":{"properties":{"platform":{"$ref":"#/components/schemas/Platform","default":"instagram"},"page_id":{"type":"string","minLength":1,"title":"Page Id"},"page_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Name"},"profile_external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Profile External Id"},"access_token":{"type":"string","minLength":1,"title":"Access Token"},"refresh_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Refresh Token"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes","default":[]},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"},"core_company_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Core Company Id"},"core_company_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Core Company Slug"}},"type":"object","required":["page_id","access_token"],"title":"TokenCreate"},"TokenResponse":{"properties":{"id":{"type":"integer","title":"Id"},"uuid":{"type":"string","format":"uuid","title":"Uuid"},"platform":{"$ref":"#/components/schemas/Platform"},"page_id":{"type":"string","title":"Page Id"},"page_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Name"},"profile_external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Profile External Id"},"core_company_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Core Company Id"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"resolved_profile":{"anyOf":[{"$ref":"#/components/schemas/ResolvedProfileRef"},{"type":"null"}]}},"type":"object","required":["id","uuid","platform","page_id","page_name","profile_external_id","core_company_id","scopes","expires_at","created_at","updated_at"],"title":"TokenResponse"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"WebhookProcessingStatus":{"type":"string","enum":["received","processing","completed","failed","skipped"],"title":"WebhookProcessingStatus"}},"securitySchemes":{"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-Pilea-Secret"}}}}