{"openapi":"3.1.0","info":{"title":"Stratos API","version":"0.1.0"},"paths":{"/admin/dimensions/sync":{"post":{"tags":["admin"],"summary":"Sync Dimensions","description":"Sync dimension data (campaigns, ad sets, ads) from platforms to Supabase.\n\nThis endpoint discovers all active ad accounts and syncs their dimension data\nfrom the respective platforms (Meta, TikTok, Google Ads). It's designed to be\ncalled after DBT builds to ensure Supabase has the latest dimension data for\nnew entities.\n\nSTR-777: google_ads was NOT handled here until now — it fell through to the\n\"unsupported platform\" branch, so the connect-time background sync was the\nonly writer of a Google Ads client's `public.campaigns` registry (which is\nwhat the dashboard's campaign picker reads, NOT BigQuery). A campaign\ncreated after the connect therefore never appeared, and a connect-time sync\nthat failed was never repaired. This endpoint is now that repair path: one\nrun re-registers every ACTIVE Google Ads account from scratch.\n\nSTR-718: demo agencies are excluded. This is an UNATTENDED fleet-wide WRITE\npath — the nightly pipeline's dimension-sync stage calls it with no tenant\nscope at all, and it writes campaign/adset/ad rows for every ACTIVE ad\naccount it finds. It does NOT go through `discover_active_connections`, so\nthe orchestration-side chokepoint never reaches it and the filter has to\nlive here.\n\nReturns:\n    APIResponse with sync summary (accounts processed, successes, failures)","operationId":"sync_dimensions_admin_dimensions_sync_post","parameters":[{"name":"X-Admin-Token","in":"header","required":true,"schema":{"type":"string","title":"X-Admin-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/uploads/{batch_id}/entities":{"post":{"tags":["admin"],"summary":"Materialize Upload Entities","description":"Retired (STR-1413): 410 `upload_entity_route_retired`.\n\nIts only caller was orchestration's upload pipeline, which only the\navailability dispatcher started, and nothing starts it now. Media\nentities are published by the upload rows settle (a load's\n`finish_landed` and the upload rows tick). The route stays, behind the\nadmin token, until the old route's code is deleted (STR-1414).","operationId":"materialize_upload_entities_admin_uploads__batch_id__entities_post","parameters":[{"name":"batch_id","in":"path","required":true,"schema":{"type":"string","title":"Batch Id"}},{"name":"tenant_id","in":"query","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Admin-Token","in":"header","required":true,"schema":{"type":"string","title":"X-Admin-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/entity-groups/reevaluate":{"post":{"tags":["admin"],"summary":"Reevaluate Entity Groups","description":"Re-evaluate entity-group membership after the nightly dimension sync\n(STR-1054). The orchestration runner calls it only when `/dimensions/sync`\nanswered; members of an account whose sync failed are held as they were.\n\nSTR-718: an UNATTENDED fleet-wide write path like the dimension sync, so it\nskips frozen demo agencies and fails CLOSED when that scope is unknown.","operationId":"reevaluate_entity_groups_admin_entity_groups_reevaluate_post","parameters":[{"name":"X-Admin-Token","in":"header","required":true,"schema":{"type":"string","title":"X-Admin-Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntityGroupReevaluateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agencies":{"post":{"tags":["agencies"],"summary":"Create Agency","description":"Create a new agency and link the authenticated user as admin/owner.\n\nArgs:\n    name: Agency name\n    logo: Optional agency logo file\n    website: Optional agency website URL\n    num_employees: Optional number of employees range\n    num_clients: Optional number of clients range\n    user: Authenticated user (injected by dependency)\n\nReturns:\n    APIResponse with created agency data","operationId":"create_agency_agencies_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_agency_agencies_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agencies/{agency_id}":{"get":{"tags":["agencies"],"summary":"Get Agency","description":"Get full details for a specific agency.\n\nArgs:\n    agency_id: Agency ID\n    auth: Authorizer (injected by dependency); authenticates and gates by membership.\n\nReturns:\n    AgencyResponse with full agency details","operationId":"get_agency_agencies__agency_id__get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","title":"Agency Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgencyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["agencies"],"summary":"Update Agency","description":"Update an existing agency.\n\nArgs:\n    agency_id: Agency ID to update\n    name: Agency name\n    logo: Optional agency logo file\n    website: Optional agency website URL\n    num_employees: Optional number of employees range\n    num_clients: Optional number of clients range\n    currency_code: never written here: the agency currency is set in the\n        admin console (STR-2510). A value equal to the stored setting\n        (`inherit` for none) is dropped, so an older dashboard bundle that\n        sends it on every save keeps working; another is 403\n        `currency_set_in_console`, before any write.\n    auth: Authorizer (injected by dependency); requires owner/admin via AGENCY_MUTATE.\n\nReturns:\n    APIResponse with updated agency data","operationId":"update_agency_agencies__agency_id__patch","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","title":"Agency Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_update_agency_agencies__agency_id__patch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agencies/{agency_id}/members":{"get":{"tags":["agencies"],"summary":"Get Agency Members","description":"Get all members and pending invites for an agency.\n\nArgs:\n    agency_id: Agency ID\n    auth: Authorizer (injected by dependency); requires owner/admin via AGENCY_MANAGE_ROLES.\n\nReturns:\n    AgencyMembersResponse with members and pending invites","operationId":"get_agency_members_agencies__agency_id__members_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","title":"Agency Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgencyMembersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agencies/{agency_id}/assignable-members":{"get":{"tags":["agencies"],"summary":"Get Assignable Agency Members","description":"STR-249 — the assignee roster for the board's AssigneePicker.\n\nGated on `Capability.AGENCY_READ` (every member, incl. viewer/editor) — a\nREAD tier, distinct from `GET /members` which requires `AGENCY_MANAGE_ROLES`\n(owner/admin) and also returns roles + pending invites. An editor can enable\nthe assignee picker (`canMutateInsights`) but couldn't populate it off the\nadmin `/members` endpoint (403 → empty roster → \"no teammates\"); this\nendpoint fixes that while leaking nothing beyond who's on the team.\n\n**Optional `client_id` narrows to members who can SEE that client**\n(STR-443 review). The Share modal passes it because\n`set_report_permission` refuses a grantee scoped to other clients — so\nwithout the filter the picker offers candidates whose only possible\noutcome is a 400. The board's assignee picker passes nothing and keeps\nthe whole roster, which is right for it: assigning work to a teammate\nis not the same question as granting them sight of a client.\n\nThe scope rule is `dependencies/authz.py`'s: no `user_client_scopes`\nrows = agency-wide, rows present = restricted to exactly those\nclients, and owner/admin bypass scope entirely.\n\nArgs:\n    agency_id: Agency ID.\n    auth: Authorizer (injected); requires AGENCY_READ on the agency.\n    client_id: Optional — keep only members who can see this client.\n\nReturns:\n    AssignableMembersResponse — [{user_id, email, first_name, last_name}].","operationId":"get_assignable_agency_members_agencies__agency_id__assignable_members_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","title":"Agency Id"}},{"name":"client_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignableMembersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agencies/{agency_id}/members/{user_id}":{"patch":{"tags":["agencies"],"summary":"Update Member","description":"Update a member's role and/or client scope.\n\nPermissions:\n  - Updating role requires AGENCY_MANAGE_ROLES (admin/owner).\n  - Updating scope requires AGENCY_MANAGE_SCOPES (admin/owner).\n  - You can't demote the only owner (returns 400).\n  - Owner/admin scope is always agency-wide; passing client_scope for\n    them clears any existing rows but doesn't restrict them.","operationId":"update_member_agencies__agency_id__members__user_id__patch","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","title":"Agency Id"}},{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMemberRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["agencies"],"summary":"Remove Member","description":"Remove a member from an agency entirely (STR-513).\n\nThe mechanics — cut the membership, then hand off the per-report grants,\nboard assignments and owned dashboards it leaves behind — live in\n`app/services/membership_removal.py`, which the admin console's user-admin\nscreen (STR-2171) calls too. That module's docstring is the single\nreference for what removal actually does; it is not repeated here.\n\nWhat stays in this handler is the half that is about the ACTOR: a tenant\nadmin or owner, with an agency role. Counts come back in `data` and are\nlogged.\n\nPermissions: `AGENCY_REMOVE_MEMBER` (owner/admin).\n\nGuardrails — each is enforced HERE, not just in the UI:\n  - You can't remove yourself (400). Leaving an agency is a separate flow;\n    doing it through the admin screen would strip your own session's access\n    mid-request.\n  - Only an owner may remove an owner (403). An admin removing the person\n    above them is a privilege inversion.\n  - The last owner can never be removed (400), or the agency becomes\n    unadministerable — same invariant `update_member` enforces on demotion.\n  - Cross-agency callers are rejected by `auth.require` (403), which\n    resolves the caller's role *in this agency*; membership of some other\n    agency grants nothing here.","operationId":"remove_member_agencies__agency_id__members__user_id__delete","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","title":"Agency Id"}},{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agencies/{agency_id}/admin-overview":{"get":{"tags":["agencies"],"summary":"Get Agency Admin Overview","description":"Operational overview of one agency for the cog's Admin tab (STR-765).\n\nOwner/admin only via AGENCY_ADMIN_VIEW: the payload aggregates roster\nactivity and per-client setup across the whole agency, which a\nclient-scoped member has no business seeing in one response.","operationId":"get_agency_admin_overview_agencies__agency_id__admin_overview_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","title":"Agency Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOverviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agencies/{agency_id}/admin-overview/runs":{"get":{"tags":["agencies"],"summary":"Get Agency Admin Runs","description":"One page of the pipeline run log (STR-765). Split from the overview so\nturning a page never re-runs the per-member sign-in sweep that endpoint\ncarries. Same gate, same filter, same row shape — page 1 here equals the\noverview's embedded `recent_runs`.","operationId":"get_agency_admin_runs_agencies__agency_id__admin_overview_runs_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","title":"Agency Id"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":1,"title":"Page"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminRunsPageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agencies/{agency_id}/output-preferences":{"get":{"tags":["agencies"],"summary":"List Output Preferences","description":"What this agency has told us about how its output should read.","operationId":"list_output_preferences_agencies__agency_id__output_preferences_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","title":"Agency Id"}},{"name":"client_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["agencies"],"summary":"Set Output Preference","description":"State a preference on one axis, replacing any active one.\n\nPUT, not POST, because the operation is idempotent per axis: there is ONE\nactive preference per (agency, client, axis) and saying it twice must not\nstack two instructions that may contradict each other.\n\nThe previous row is DEACTIVATED, never deleted — the history of what an\nagency asked for is the audit trail behind a change in how their insights\nread, and a distilled preference that supersedes a verbal one should not\nerase the conversation it came from.","operationId":"set_output_preference_agencies__agency_id__output_preferences_put","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","title":"Agency Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutputPreferenceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agencies/{agency_id}/output-preferences/refresh":{"post":{"tags":["agencies"],"summary":"Refresh Output Preferences","description":"GAP 2: distil this agency's ratings into preferences, now.\n\nReturns what it WROTE, which is usually nothing — `distil` refuses on too\nfew observations, an axis already scoring well, indifference, or a split\nagency. An empty list is the honest answer \"their ratings do not yet say\none thing\", not a failure, and it leaves any existing preference alone: a\nquiet week is not a retraction.","operationId":"refresh_output_preferences_agencies__agency_id__output_preferences_refresh_post","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","title":"Agency Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agencies/{agency_id}/model-settings":{"get":{"tags":["agencies"],"summary":"Get Model Settings","description":"The account default, every feature's pick, and what each resolves to.","operationId":"get_model_settings_agencies__agency_id__model_settings_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","title":"Agency Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["agencies"],"summary":"Put Model Settings","description":"Replace the agency's model settings. 422 names every problem at once:\nan unknown feature key, a malformed slug, or a non-OpenAI model for a\nfeature that runs on OpenAI only.","operationId":"put_model_settings_agencies__agency_id__model_settings_put","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","title":"Agency Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelSettingsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invites":{"post":{"tags":["invites"],"summary":"Send Invites","description":"Send invitations to join an agency workspace.\n\nCreates invite records in the database and sends email invitations.","operationId":"send_invites_invites_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendInvitesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invites/mine":{"get":{"tags":["invites"],"summary":"List My Invites","description":"Pending, unexpired invitations addressed to the signed-in user.\n\nSTR-2346: the email link was the only way into an invitation, so an\ninvitee who logged in any other way (the login page, after a password\nreset) reached onboarding with no sign of it. Onboarding lists these.\nThe token is returned because the caller is the verified owner of the\naddress the invitation was sent to: the address comes from Supabase Auth\n(`verified_auth_email`), never from the editable `public.users` row.","operationId":"list_my_invites_invites_mine_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MyInvite"},"title":"Response List My Invites Invites Mine Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invites/{token}":{"get":{"tags":["invites"],"summary":"Get Invite By Token","description":"Get invite details by token (no authentication required).\n\nThis allows users who don't have an account yet to view the invite.","operationId":"get_invite_by_token_invites__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteDetails"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["invites"],"summary":"Respond To Invite","description":"Respond to an invite (accept or decline).\n\nRequires authentication - user must be logged in.","operationId":"respond_to_invite_invites__token__patch","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RespondToInviteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invites/resend":{"post":{"tags":["invites"],"summary":"Resend Users Invites","description":"Resend all pending or expired invites for the current user.\n\nFinds all invites with status 'pending' or 'expired' for the user's email,\nmarks them as expired, creates new invites, and resends emails.","operationId":"resend_users_invites_invites_resend_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invites/{invite_id}/resend":{"post":{"tags":["invites"],"summary":"Resend Invite","description":"Resend a specific invite by ID.\n\nUser must be admin or owner of the agency to resend invites.","operationId":"resend_invite_invites__invite_id__resend_post","parameters":[{"name":"invite_id","in":"path","required":true,"schema":{"type":"string","title":"Invite Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invites/{invite_id}/cancel":{"patch":{"tags":["invites"],"summary":"Cancel Invite","description":"Cancel (expire) a specific invite by ID.\n\nUser must be admin or owner of the agency to cancel invites.","operationId":"cancel_invite_invites__invite_id__cancel_patch","parameters":[{"name":"invite_id","in":"path","required":true,"schema":{"type":"string","title":"Invite Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/state":{"get":{"tags":["oauth"],"summary":"Get Oauth State","description":"Generate a signed state token for OAuth CSRF protection.\n\nCall this endpoint before initiating an OAuth flow to get a\nserver-signed state token that will be validated on callback.","operationId":"get_oauth_state_oauth_state_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/meta/start":{"post":{"tags":["oauth"],"summary":"Start Meta Oauth","description":"Start Meta OAuth flow by generating a signed state and returning the authorization URL.\n\nThe frontend should open this URL in a popup. After authorization, Meta redirects\nto the callback URL (dashboard_url/oauth/meta/callback), which then redirects back\nto return_url after completion.\n\nArgs:\n    request: Contains dashboard_url (origin) and optional specific return_url\n    user: Authenticated user (injected by dependency)\n\nReturns:\n    APIResponse with auth_url to open in popup","operationId":"start_meta_oauth_oauth_meta_start_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthStartRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/google_ads/start":{"post":{"tags":["oauth"],"summary":"Start Google Ads Oauth","description":"Start Google Ads OAuth flow by generating a signed state and returning\nthe Google authorization URL.\n\nPhase 1 of STR-125. Mirrors the Meta/TikTok start endpoints. After the\nuser consents, Google redirects to /oauth/google_ads/callback with\n`code` + `state`.\n\nArgs:\n    request: Contains api_base_url, dashboard_url, optional return_url.\n    user: Authenticated user (injected by dependency).\n\nReturns:\n    APIResponse with auth_url to open in popup.","operationId":"start_google_ads_oauth_oauth_google_ads_start_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthStartRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/reddit_ads/start":{"post":{"tags":["oauth"],"summary":"Start Reddit Ads Oauth","description":"Start the Reddit Ads OAuth flow: sign a state token and return the Reddit\nauthorization URL. (STR-759.)\n\nTwo Reddit-specific parameters carry the whole flow:\n\n* ``duration=permanent`` is what makes Reddit issue a REFRESH token. Without\n  it the grant lasts an hour and the Airbyte source could never re-mint.\n* ``scope=identity adsread`` — `adsread` reads the Ads API, `identity` makes\n  ``/api/v1/me`` answerable, which is the login identity the one-row-per-\n  login model (STR-847) keys a `platform_accounts` row on.\n\n``REDDIT_ADS_CLIENT_ID`` is read at CALL time and is deliberately absent in\nevery environment today: the connector ships DARK, so this route answers\nwith the standard ``PROVIDER_UNAVAILABLE`` error until a Reddit developer\napp exists.","operationId":"start_reddit_ads_oauth_oauth_reddit_ads_start_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthStartRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/tiktok/start":{"post":{"tags":["oauth"],"summary":"Start Tiktok Oauth","description":"Start TikTok OAuth flow by generating a signed state and returning the authorization URL.\n\nThe frontend should open this URL in a popup. After authorization, TikTok redirects\nto the callback URL (dashboard_url/oauth/tiktok/callback), which then redirects back\nto return_url after completion.\n\nArgs:\n    request: Contains dashboard_url (origin) and optional specific return_url\n    user: Authenticated user (injected by dependency)\n\nReturns:\n    APIResponse with auth_url to open in popup","operationId":"start_tiktok_oauth_oauth_tiktok_start_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthStartRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/meta/callback":{"get":{"tags":["oauth"],"summary":"Meta Oauth Callback","description":"Handle Meta OAuth callback (GET redirect from provider).\n\n1. Check for errors from provider\n2. Decode and validate signed state to identify user and agency\n3. Exchange authorization code for short-lived access token\n4. Exchange short-lived token for long-lived token (60 days)\n5. Fetch user info from Meta\n6. Upsert platform_accounts with credentials\n7. Redirect to return_url with status\n\nArgs:\n    code: Authorization code from Meta\n    state: State parameter for CSRF protection\n    error: Error code if authorization failed\n    error_description: Error description if authorization failed\n\nReturns:\n    RedirectResponse to return_url with status","operationId":"meta_oauth_callback_oauth_meta_callback_get","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","description":"Authorization code from Meta","title":"Code"},"description":"Authorization code from Meta"},{"name":"state","in":"query","required":true,"schema":{"type":"string","description":"State parameter for CSRF protection","title":"State"},"description":"State parameter for CSRF protection"},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Error code if authorization failed","title":"Error"},"description":"Error code if authorization failed"},{"name":"error_description","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Error description","title":"Error Description"},"description":"Error description"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/google_ads/callback":{"get":{"tags":["oauth"],"summary":"Google Ads Oauth Callback","description":"Handle Google Ads OAuth callback (GET redirect from Google).\n\n1. Check for errors from provider.\n2. Decode and validate signed state to identify user + agency.\n3. Exchange authorization code for access + refresh tokens.\n4. Call listAccessibleCustomers to find every customer the user can see.\n5. For each, call get_customer_info; for MCCs, also list_customer_clients.\n6. Encrypt credentials (including accessible_customers metadata) and\n   upsert into platform_accounts. Do NOT auto-create ad_accounts rows —\n   Phase 3 dashboard UI handles client→customer assignment.\n7. Redirect to return_url with status.\n\nPhase 1 of STR-125.","operationId":"google_ads_oauth_callback_oauth_google_ads_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Authorization code from Google","title":"Code"},"description":"Authorization code from Google"},{"name":"state","in":"query","required":true,"schema":{"type":"string","description":"State parameter for CSRF protection","title":"State"},"description":"State parameter for CSRF protection"},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Error code if authorization failed","title":"Error"},"description":"Error code if authorization failed"},{"name":"error_description","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Error description","title":"Error Description"},"description":"Error description"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/reddit_ads/callback":{"get":{"tags":["oauth"],"summary":"Reddit Ads Oauth Callback","description":"Handle the Reddit Ads OAuth callback (GET redirect from Reddit). STR-759.\n\n1. Check for errors from the provider.\n2. Decode and validate the signed state to identify user + agency.\n3. Exchange the authorization code for access + refresh tokens.\n4. Read the login's Reddit identity (``/api/v1/me``).\n5. Enumerate the ad accounts the login can reach.\n6. Encrypt the credentials and write ONE `platform_accounts` row.\n7. Push the fresh credential to any existing Airbyte sources, re-run the\n   ownership election, and redirect with status.\n\nFLAT by design: Reddit has no manager-account hierarchy, so the credentials\ncarry a plain `advertisers` list and the Meta/TikTok connect path serves it\nwith no bespoke picker endpoint.","operationId":"reddit_ads_oauth_callback_oauth_reddit_ads_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Authorization code from Reddit","title":"Code"},"description":"Authorization code from Reddit"},{"name":"state","in":"query","required":true,"schema":{"type":"string","description":"State parameter for CSRF protection","title":"State"},"description":"State parameter for CSRF protection"},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Error code if authorization failed","title":"Error"},"description":"Error code if authorization failed"},{"name":"error_description","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Error description","title":"Error Description"},"description":"Error description"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/tiktok/callback":{"get":{"tags":["oauth"],"summary":"Tiktok Oauth Callback","description":"Handle TikTok OAuth callback (GET redirect from provider).\n\n1. Check for errors from provider\n2. Decode and validate signed state to identify user and agency\n3. Exchange authorization code for access token and refresh token\n4. Extract advertiser IDs from response\n5. Upsert platform_accounts with credentials\n6. Redirect to return_url with status\n\nArgs:\n    auth_code: Authorization code from TikTok\n    state: State parameter for CSRF protection\n    error: Error code if authorization failed\n    error_description: Error description if authorization failed\n\nReturns:\n    RedirectResponse to return_url with status","operationId":"tiktok_oauth_callback_oauth_tiktok_callback_get","parameters":[{"name":"auth_code","in":"query","required":true,"schema":{"type":"string","description":"Authorization code from TikTok","title":"Auth Code"},"description":"Authorization code from TikTok"},{"name":"state","in":"query","required":true,"schema":{"type":"string","description":"State parameter for CSRF protection","title":"State"},"description":"State parameter for CSRF protection"},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Error code if authorization failed","title":"Error"},"description":"Error code if authorization failed"},{"name":"error_description","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Error description","title":"Error Description"},"description":"Error description"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/ttd/list-advertisers":{"post":{"tags":["oauth"],"summary":"List Ttd Advertisers","description":"Enumerate every advertiser under a TTD token's partner seat (STR-388).\n\nPowers the bulk-connect picker: paste a token, see all advertisers.\nNo persistence — the token is validated by the enumeration call itself\n(an invalid token surfaces as a 400). Marks which advertisers are\nalready attached anywhere in the caller's agency so the picker can\nrender them as \"Connected\".","operationId":"list_ttd_advertisers_oauth_ttd_list_advertisers_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TTDListAdvertisersRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/ttd/connect-accounts":{"post":{"tags":["oauth"],"summary":"Connect Ttd Accounts","description":"Attach several TTD advertisers to a client in one call (STR-388).\n\nMirrors `connect_google_ads_accounts`: validate the token once,\nenumerate the partner's advertisers to ALLOWLIST-validate every\nrequested id (blocks id slip-in from a direct API caller), then persist\neach via the shared `_connect_ttd_advertiser` helper and trigger the\norchestrator pipeline ONCE at the end.","operationId":"connect_ttd_accounts_oauth_ttd_connect_accounts_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TTDConnectAccountsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/ttd/connect":{"post":{"tags":["oauth"],"summary":"Connect Ttd Account","description":"Connect a TTD advertiser account using an API token.\n\nUnlike Meta and TikTok, TTD does not use a browser-redirect OAuth flow.\nThe user provides their API token and advertiser ID directly.\nFlow:\n1. Validate the token by calling TTD's advertiser endpoint.\n2. Encrypt and upsert credentials into platform_accounts.\n3. Upsert an ad_accounts row for this advertiser.\n4. Schedule background entity sync (campaigns, ad groups, ads).\n5. Trigger the full orchestrator pipeline for this tenant.\nArgs:\n    request:          TTD API token + advertiser_id + client_id.\n    background_tasks: FastAPI background task queue.\n    user:             Authenticated user (injected by dependency).\n    auth:             Authorization helper (injected by dependency).\nReturns:\n    APIResponse with the new platform_account_id.","operationId":"connect_ttd_account_oauth_ttd_connect_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TTDConnectRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/platform-accounts":{"get":{"tags":["oauth"],"summary":"Get Platform Accounts","description":"Get platform accounts with advertisers for the user's agency.\n\nReturns platform accounts with their stored advertisers/ad accounts\nfor display in the selection UI.\n\nSTR-847 review, A7: this route had NO capability check at all — authenticated\nwas enough. That was survivable while the payload was \"which advertisers can\nthis agency see\"; it stopped being so when this ticket added the NAMES of\ncolleagues who connected each login. `AGENCY_READ` is viewer+ and\nagency-scoped, which is the right shape: a platform login belongs to the\nagency and has no client to scope by. It does not narrow who may call this\n(every role in the agency holds it) — what it adds is the membership check\nthat was missing, so a token for a user in no agency is refused here rather\nthan at the `_get_user_agency_id` lookup, and the denial is logged in the\nSTR-635 envelope like every other refusal.","operationId":"get_platform_accounts_oauth_platform_accounts_get","parameters":[{"name":"client_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Optional client ID to filter connected accounts","title":"Client Id"},"description":"Optional client ID to filter connected accounts"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/tiktok/refresh-metadata":{"post":{"tags":["oauth"],"summary":"Refresh Tiktok Metadata","description":"Refresh TikTok metadata (Business Centers, advertiser info) using stored credentials.\n\nUseful for fetching Business Center info without re-authorizing.\n\nGated on `PLATFORM_LOGIN_MANAGE` — see `refresh_meta_metadata` for why this\nroute needs a mutate capability at all, and why it is the same one the\nlogin DELETE uses.","operationId":"refresh_tiktok_metadata_oauth_tiktok_refresh_metadata_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/meta/refresh-metadata":{"post":{"tags":["oauth"],"summary":"Refresh Meta Metadata","description":"Refresh Meta metadata (businesses, ad accounts) using stored credentials.\n\nUseful for fetching updated business/ad account info without re-authorizing.\n\nSTR-847 review round 2: this route had NO capability check — authenticated\nwas enough. It was a WRITE all along (it rewrites the encrypted credentials\nblob), and A2 widened its blast radius from \"the agency's one row\" to\n\"every login on the platform, colleagues' included\", which is what made a\nmissing gate worth fixing rather than merely noting.\n\n`PLATFORM_LOGIN_MANAGE` (editor+, agency-scoped) is deliberately the SAME\ncapability and the SAME scope as `DELETE /oauth/platform-accounts/{id}`:\nan editor who may REMOVE a colleague's login outright cannot coherently be\nforbidden from refreshing its metadata, and inventing a narrower\nown-logins-only rule here would leave the two routes disagreeing about who\nowns a login. If that rule is ever wanted, it belongs on both at once.","operationId":"refresh_meta_metadata_oauth_meta_refresh_metadata_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/assign-advertisers":{"post":{"tags":["oauth"],"summary":"Assign Advertisers","description":"Assign selected advertisers to a client.\n\nCreates entries in the ad_accounts table linking advertisers to the client.","operationId":"assign_advertisers_oauth_assign_advertisers_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignAdvertisersRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/google_ads/connect-accounts":{"post":{"tags":["oauth"],"summary":"Connect Google Ads Accounts","description":"STR-125 Phase 3. Attach selected Google Ads customers to a Stratis\nclient after the user picks from the post-OAuth MCC fan-out.\n\nValidates that every requested customer_id is one the user actually has\naccess to (per `platform_accounts.credentials.accessible_customers`) so\na malicious caller can't slip in a customer_id they didn't OAuth for.\nFor each valid pick: creates an `ad_accounts` row + schedules a\nbackground entity sync via `sync_google_ads_ad_account_data` which\nin turn provisions the Airbyte source.","operationId":"connect_google_ads_accounts_oauth_google_ads_connect_accounts_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoogleAdsConnectAccountsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/meta/connect-accounts":{"post":{"tags":["oauth"],"summary":"Connect Meta Accounts","description":"STR-847: attach picked Meta ad accounts to a client. ADD-ONLY.","operationId":"connect_meta_accounts_oauth_meta_connect_accounts_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformConnectAccountsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/tiktok/connect-accounts":{"post":{"tags":["oauth"],"summary":"Connect Tiktok Accounts","description":"STR-847: attach picked TikTok ad accounts to a client. ADD-ONLY.","operationId":"connect_tiktok_accounts_oauth_tiktok_connect_accounts_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformConnectAccountsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/reddit_ads/connect-accounts":{"post":{"tags":["oauth"],"summary":"Connect Reddit Ads Accounts","description":"STR-759: attach picked Reddit ad accounts to a client. ADD-ONLY.\n\nA thin wrapper over the same generic body Meta and TikTok use — Reddit is a\nFLAT account list with no MCC, so it needs no bespoke Google-Ads-style\npicker endpoint. `_connect_platform_accounts` calls\n`auth.require(Capability.CLIENT_MUTATE, client_id=...)` as its first\nstatement, before any Supabase read.\n\nThe reconcile is scheduled AFTER the connect returns, as the durable\nbackstop for the STR-294 orphan path: a create that 400s past the\n`ad_accounts` write-back leaves `airbyte_connection_id` NULL and the\norchestrator silently skipping the account.","operationId":"connect_reddit_ads_accounts_oauth_reddit_ads_connect_accounts_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformConnectAccountsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/platform-accounts/{platform_account_id}":{"delete":{"tags":["oauth"],"summary":"Remove Platform Login","description":"STR-847: remove one platform LOGIN, handing its ad accounts to another.\n\n`ad_accounts.platform_account_id` is NOT NULL and cascades on delete, so the\norder here is load-bearing: re-elect FIRST, delete second. A removal that\nwould strand an ad account — no other login of that platform and ingestion\ntype exists to hold the row — is REFUSED with the list of accounts, because the alternative is\na cascade that silently takes a client's campaigns and ads with it.\n\nAn account that survives on a login which cannot SEE it keeps its client and\nreads as `orphaned` on the Connectors panel: \"no login can sync this\".","operationId":"remove_platform_login_oauth_platform_accounts__platform_account_id__delete","parameters":[{"name":"platform_account_id","in":"path","required":true,"schema":{"type":"string","title":"Platform Account Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/disconnect-ad-account":{"post":{"tags":["oauth"],"summary":"Disconnect Ad Account","description":"Disconnect an ad account from a client.\n\nRemoves the ad_accounts row, which cascades to delete related\ncampaigns, ad_groups, and ads for this ad account.\nAlso cleans up Airbyte resources (connections, sources, jobs).","operationId":"disconnect_ad_account_oauth_disconnect_ad_account_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisconnectAdAccountRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/reassign-ad-account":{"post":{"tags":["oauth"],"summary":"Reassign Ad Account","description":"Reassign an ad account from one client to another.\n\nUpdates the client_id on the ad_accounts row.\nNote: This preserves the synced campaigns/ad_groups/ads data.","operationId":"reassign_ad_account_oauth_reassign_ad_account_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReassignAdAccountRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/platform-accounts/health":{"get":{"tags":["oauth"],"summary":"Get Platform Account Health","description":"Every login's HEALTH, and nothing else.\n\nThe alarm on the agency home needs one fact per login — is anything expiring\nor broken — and `GET /oauth/platform-accounts` answers it only as a side\neffect of decrypting every credentials blob in the agency and running the\nownership election over every ad account. That is a page's worth of work to\nrender a banner that is usually absent, on a surface every admin loads\nfirst.\n\nHealth derives from ROW COLUMNS only (`token_expires_at`, `refresh_status`),\nwhich is exactly why this can be cheap: nothing here touches the encryption\nkey.\n\n── The gate, for this route and the three below it (review 🟡 2) ──────────\n\n`AGENCY_MANAGE_ROLES`, agency-scoped: the SAME admin+ capability\n`GET /agencies/{id}/members` uses. The first cut gated these on\n`AGENCY_READ` (viewer+) on the reasoning that each returns a subset of what\n`GET /oauth/platform-accounts` already returns to every member. That\nreasoning was wrong on the facts — the account map is the agency's ENTIRE\nad-account reach across every client, including clients a scoped user\ncannot see, and it names the colleague behind each login — and it was wrong\nin kind: STR-848 scopes this surface as admin/owner, the page and its\ncomments said so, and a gate that disagrees with the page is the gate that\nis real. Proven live with a viewer's JWT: 15KB of advertiser → client map\nand colleagues' names.\n\nNamed for role management and used here as \"the admin bar\" — a stretch,\ntaken deliberately over inventing a capability, because Members is the\nprecedent this surface sits beside and a second admin+ agency capability\nmeaning the same thing is a fork in the matrix. A dedicated\n`AGENCY_CONNECTIONS_MANAGE` would read better and can replace all four call\nsites at once when there is a second reason for it.\n\nPhase 2's `GET /oauth/platform-accounts` deliberately STAYS `AGENCY_READ`:\nthe per-client Connectors panel is a viewer-readable surface, and it is the\nsame endpoint.","operationId":"get_platform_account_health_oauth_platform_accounts_health_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/platform-accounts/health-summary":{"get":{"tags":["oauth"],"summary":"Get Platform Account Health Summary","description":"How many logins need attention, and a fingerprint of WHICH — nothing else.\n\nSTR-865. The agency-home alarm is shown to every role now (red for the\nadmins who can fix it, yellow for everyone else) and it is dismissible per\nuser. Both need a read every member can make, and `/health` above cannot be\nthat read: it names the colleague behind each login, which is exactly the\npayload the admin bar exists to keep off a viewer's screen. So this route\nemits two counts and an opaque key — no ids, no names, no dates.\n\n`key` hashes the affected set (login id + health). The dashboard stores it\nin `users.preferences` when the banner is dismissed and hides the banner\nwhile the key still matches, so a dismissal survives a new session, and a\nNEW broken login (or a healed one) changes the key and brings it back. It\nis deliberately not reversible into ids: a viewer holding the key learns\nnothing they could not learn from the count.\n\n`AGENCY_READ` (viewer+): the tier of `GET /oauth/platform-accounts`, the\nper-client panel every member already reads.","operationId":"get_platform_account_health_summary_oauth_platform_accounts_health_summary_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/account-map":{"get":{"tags":["oauth"],"summary":"Get Account Map","description":"Every advertiser any login can see × the client it is on, or unassigned.\n\nThe question the agency page exists to answer, and one no login's own\npayload contains: it spans logins, and the visibility it is built from lives\nin each login's encrypted snapshot. `build_account_map` does the shaping;\nthis function only loads.\n\nAdmin+ (`AGENCY_MANAGE_ROLES`) — see the rationale on\n`get_platform_account_health`. This is the payload that made the case: the\nagency's whole reach, across every client, with each login's connector\nnamed.","operationId":"get_account_map_oauth_account_map_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/sync-freshness":{"get":{"tags":["oauth"],"summary":"Get Sync Freshness","description":"When each connected ad account last synced, per Airbyte.\n\nDeliberately SEPARATE from the account map, and fetched after it: this is\nthe one read in the connectors rebuild that leaves the process, and a table\nmust be able to render without it. Upload freshness comes from the scoped\nupload journal even without Airbyte. `available: false` means neither\nAirbyte nor uploaded accounts can supply this deployment's freshness.\n\nAdmin+ (`AGENCY_MANAGE_ROLES`) — see `get_platform_account_health`. It is\nalso the one read here that a caller can make COST something, since it fans\nout to another system.","operationId":"get_sync_freshness_oauth_sync_freshness_get","parameters":[{"name":"client_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Optional client ID to narrow the fan-out","title":"Client Id"},"description":"Optional client ID to narrow the fan-out"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/oauth/platform-accounts/{platform_account_id}/resync":{"post":{"tags":["oauth"],"summary":"Resync Platform Login","description":"Heal BOTH layers for one login: push its token to Airbyte, then sync.\n\nSTR-248 part 2, made pressable. A manual re-OAuth writes fresh credentials\nto `platform_accounts` and the callbacks now push them into the per-account\nAirbyte sources — but the sources keep running on their old schedule, so the\ndashboard stays frozen until the next nightly run. This is the second half:\nre-push (idempotent, and the belt to the callback's braces for a reconnect\nwhose push failed) and then kick one sync per connection so the data catches\nup while the operator is still on the page.\n\nTWO gates, because two different questions are being asked and a caller who\nfails either should be refused. `AGENCY_MANAGE_ROLES` is the SURFACE bar —\nthis route exists only on the admin/owner Connections page, and review 🟡 2\ncaught an EDITOR getting a 200 here. `PLATFORM_LOGIN_MANAGE` is the ACTION\nbar — it is what \"may mutate a platform login\" means everywhere else in this\nrouter, and keeping it leaves the route's own nature legible rather than\nimplied by whoever happens to hold the surface. Admin+ holds both today, so\nthe second is redundant right now; it stops being redundant the moment\neither tier moves.\n\nA connection with a job already in flight is left alone rather than queued\nbehind itself.","operationId":"resync_platform_login_oauth_platform_accounts__platform_account_id__resync_post","parameters":[{"name":"platform_account_id","in":"path","required":true,"schema":{"type":"string","title":"Platform Account Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/parameter_adjustments/capabilities":{"get":{"tags":["parameter_adjustments"],"summary":"Get Platform Capabilities Endpoint","description":"Get the capability registry for all platforms.\n\nReturns a map of platform -> parameter -> capability status, indicating\nwhich parameters are supported, planned, or unsupported for each platform.\n\n**Capability Status Values:**\n- `supported`: Fully implemented and available for use\n- `planned`: Platform supports it but not yet implemented in our system\n- `unsupported`: Platform API does not support this parameter\n\nReturns:\n    APIResponse containing the full capability registry","operationId":"get_platform_capabilities_endpoint_parameter_adjustments_capabilities_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/parameter_adjustments/adjust-parameters":{"post":{"tags":["parameter_adjustments"],"summary":"Adjust advertising entity parameters across platforms","description":"Adjust advertising entity parameters across platforms.\n\nThis endpoint provides a unified contract for modifying parameters at any\nlevel of the advertising hierarchy (campaign, ad set/ad group, or ad) with\nbinary outcome semantics: either all parameters are successfully applied\nor none are applied.\n\n**Supported Scopes:**\n- `campaign`: Campaign-level adjustments\n- `ad_set`: Ad set adjustments (Meta)\n- `ad_group`: Ad group adjustments (Tiktok) - treated same as ad_set\n\n**Current Implementation Status:**\n- Dry run mode is supported for requests that pass capability + adapter validation\n- Real adjustment execution is supported for a subset of parameters; see platform capabilities\n\n**Authorization (STR-620):**\n- Requires `Capability.PARAMETER_ADJUSTMENTS_WRITE` (editor / admin / owner)\n  on `body.client_id`; the capability is client-scoped, so an editor\n  restricted by `user_client_scopes` only reaches their own clients.\n- The target entity must belong to `body.client_id`. A mismatch 404s rather\n  than 403s so the endpoint never confirms another client's entity exists.\n- Dry runs are gated identically to real executions.\n\n**Binary Outcome Semantics:**\n- Success (200): All parameters were applied successfully\n- Validation Error (400): Request format or parameter validation failed\n- Forbidden (403): Role lacks the capability, or the client is out of scope\n- Not Implemented (501): Capability is planned, platform is unsupported, or the parameter is not implemented\n\nArgs:\n    body: Request payload containing client_id, platform, scope, entity_id, and parameters\n\nReturns:\n    APIResponse containing AdjustmentResult in the data field\n\nNotes:\n    - Runtime errors for this endpoint return an `APIResponse` envelope with `success=false`.\n    - Request schema validation errors (HTTP 422) remain FastAPI/Pydantic-native.","operationId":"adjust_parameters_parameter_adjustments_adjust_parameters_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdjustParametersRequest"},"examples":{"dry_run_meta_budget":{"summary":"Dry run (Meta) - validate campaign daily budget","value":{"client_id":"3f0c1d8e-9a4b-4c21-8f77-2b6d5e1a9c40","platform":"fb_marketing","scope":"campaign","entity_id":"cmp_123","parameters":[{"name":"daily_budget","value":50.0,"unit":"currency"}],"dry_run":true,"metadata":{"idempotency_key":"adj_20260129_001"}}},"meta_campaign_daily_budget":{"summary":"Execution (Meta) - update campaign daily budget","value":{"client_id":"3f0c1d8e-9a4b-4c21-8f77-2b6d5e1a9c40","platform":"fb_marketing","scope":"campaign","entity_id":"23851234567890123","parameters":[{"name":"daily_budget","value":500.0,"unit":"currency","metadata":{"currency":"USD"}}],"dry_run":false,"metadata":{"idempotency_key":"adj_20260129_002","access_token":"<META_ACCESS_TOKEN>"}}}}}}},"responses":{"200":{"description":"Adjustment completed (or dry run simulated).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"},"examples":{"dry_run_success":{"summary":"Dry run (Meta) - validates without applying changes","value":{"success":true,"message":"Dry run completed - no changes applied","data":{"result":{"platform":"fb_marketing","scope":"campaign","entity_id":"cmp_123","parameters":[{"name":"daily_budget","value":50.0,"unit":"currency"}],"applied":false,"dry_run":true,"warnings":["This is a dry run - no actual changes were made"]}}}},"execution_success_meta_budget":{"summary":"Execution (Meta) - update campaign daily budget","value":{"success":true,"message":"Parameters adjusted successfully","data":{"result":{"platform":"fb_marketing","scope":"campaign","entity_id":"23851234567890123","parameters":[{"name":"daily_budget","value":500.0,"unit":"currency","metadata":{"currency":"USD"}}],"applied":true,"dry_run":false,"platform_reference":{"operation":"meta.update_campaign","fields":{"daily_budget":50000}}}}}}}}}},"400":{"description":"Bad Request (validation / unsupported parameter).","content":{"application/json":{"examples":{"missing_parameters":{"summary":"No parameters provided","value":{"success":false,"message":"At least one parameter must be provided","error":"At least one parameter must be provided","code":"bad_request"}},"duplicate_parameter_names":{"summary":"Duplicate parameter names rejected","value":{"success":false,"message":"Duplicate parameter names are not allowed: 'daily_budget'","error":"Duplicate parameter names are not allowed: 'daily_budget'","code":"bad_request"}},"unsupported_parameter":{"summary":"Parameter is unsupported by the platform","value":{"success":false,"message":"Parameter 'start_date' is not supported by platform 'tiktok_marketing'. TikTok does not support scheduled start dates via API","error":"Parameter 'start_date' is not supported by platform 'tiktok_marketing'. TikTok does not support scheduled start dates via API","code":"unsupported_parameter","details":{"platform":"tiktok_marketing","parameter":"start_date","capability_status":"unsupported","description":"TikTok does not support scheduled start dates via API","action":"Remove the parameter or choose a platform that supports it."}}}}}}},"401":{"description":"Unauthorized (expired/invalid platform connection).","content":{"application/json":{"examples":{"meta_expired_connection":{"summary":"Meta connection expired","value":{"success":false,"message":"Your Meta connection has expired. Please reconnect.","error":"Your Meta connection has expired. Please reconnect.","code":"request_failed","details":{"detail":"Your Meta connection has expired. Please reconnect."}}}}}}},"403":{"description":"Forbidden. The caller's role lacks `parameter_adjustments.write` (viewer/member), or `user_client_scopes` excludes `client_id`."},"404":{"description":"Not Found (missing entity or platform account). Also returned when the entity belongs to a different client than `client_id` — the mismatch is deliberately indistinguishable from nonexistence.","content":{"application/json":{"examples":{"no_connected_account":{"summary":"No connected account","value":{"success":false,"message":"No Meta account connected for this agency. Please authorize Meta first.","error":"No Meta account connected for this agency. Please authorize Meta first.","code":"request_failed","details":{"detail":"No Meta account connected for this agency. Please authorize Meta first."}}}}}}},"501":{"description":"Not Implemented / planned capability.","content":{"application/json":{"examples":{"planned_capability":{"summary":"Parameter planned but not implemented","value":{"success":false,"message":"Parameter 'bid_strategy' is planned but not yet implemented for platform 'fb_marketing'. Bid cap or cost cap at ad set level","error":"Parameter 'bid_strategy' is planned but not yet implemented for platform 'fb_marketing'. Bid cap or cost cap at ad set level","code":"not_implemented"}}}}}},"422":{"description":"Schema validation error (FastAPI/Pydantic)."}}}},"/reports/templates":{"get":{"tags":["reports"],"summary":"Get Report Templates","description":"Get all report templates with their full configurations.\n\nThese are system-wide templates available to all authenticated users.\nFetched once on app load and cached on the frontend.","operationId":"get_report_templates_reports_templates_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportTemplatesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/{report_id}":{"get":{"tags":["reports"],"summary":"Get Report","description":"Get full report configuration including widgets.\n\nReturns the report with its config and edit permissions.\nUser must have read access (owner, editor, or agency member for shared reports).","operationId":"get_report_reports__report_id__get","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Report ID (UUID)","title":"Report Id"},"description":"Report ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Report Reports  Report Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["reports"],"summary":"Update Report","description":"Update an existing report.\n\nOnly provided fields will be updated.\nCaller must be able to see the CLIENT and be the owner or hold an\n`editor` grant on this report.\n\nReturns:\n    Updated report record.","operationId":"update_report_reports__report_id__put","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Report ID (UUID)","title":"Report Id"},"description":"Report ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateReportRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["reports"],"summary":"Delete Report","description":"Delete a report by ID. OWNER ONLY — an `editor` grant does not confer\ndeletion (see `_ensure_user_can_delete_report`).\n\nReturns:\n    Success message.","operationId":"delete_report_reports__report_id__delete","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Report ID (UUID)","title":"Report Id"},"description":"Report ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/{report_id}/shared-with-me":{"post":{"tags":["reports"],"summary":"Add Report To Shared With Me","description":"Record that the current user opened a shared dashboard.\n\nThis does NOT grant access, and since STR-583 it does not confer LISTING\neither: the workspace filter no longer treats\n`users.shared_dashboard_report_ids` as an inclusion clause, because the\ncaller can write to it themselves. The column is retained so the row survives\nwhile the endpoints are retired (STR-591).","operationId":"add_report_to_shared_with_me_reports__report_id__shared_with_me_post","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Report ID (UUID)","title":"Report Id"},"description":"Report ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["reports"],"summary":"Remove Report From Shared With Me","description":"Remove a report from the current user's \"Shared With Me\" list.\n\nThis only affects the current user; it does NOT delete the report. Opening\nthe dashboard again re-adds it, provided the caller still has read access.","operationId":"remove_report_from_shared_with_me_reports__report_id__shared_with_me_delete","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Report ID (UUID)","title":"Report Id"},"description":"Report ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports":{"post":{"tags":["reports"],"summary":"Create Report","description":"Create a new report.\n\nReturns:\n    Created report record.","operationId":"create_report_reports_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateReportRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/{report_id}/versions":{"get":{"tags":["reports"],"summary":"List Report Versions","description":"STR-2152: saved versions of a report, newest first (at most 50).\nAnyone who may open the report may list them.","operationId":"list_report_versions_reports__report_id__versions_get","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","description":"Report ID (UUID)","title":"Report Id"},"description":"Report ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/{report_id}/versions/{version_id}":{"get":{"tags":["reports"],"summary":"Get Report Version","description":"STR-2152: one saved version's config and name. Restoring it is an\nordinary PUT with `version_origin: \"restore\"`; no model call.","operationId":"get_report_version_reports__report_id__versions__version_id__get","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","description":"Report ID (UUID)","title":"Report Id"},"description":"Report ID (UUID)"},{"name":"version_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Version ID (UUID)","title":"Version Id"},"description":"Version ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/{report_id}/duplicate":{"post":{"tags":["reports"],"summary":"Duplicate Report","description":"Duplicate a report. Creates a copy with the current user as owner, set to private.\n\nReturns:\n    The newly created duplicate report.","operationId":"duplicate_report_reports__report_id__duplicate_post","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Report ID (UUID) to duplicate","title":"Report Id"},"description":"Report ID (UUID) to duplicate"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/templates/{template_id}/duplicate":{"post":{"tags":["reports"],"summary":"Duplicate Report Template","description":"Duplicate a report template to create a new private report for a client.\n\nCreates a copy of the report template configuration as a new report,\nowned by the current user and assigned to the specified client.\n\nReturns:\n    The newly created report.","operationId":"duplicate_report_template_reports_templates__template_id__duplicate_post","parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Report template ID (UUID)","title":"Template Id"},"description":"Report template ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DuplicateReportTemplateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/{report_id}/permissions":{"get":{"tags":["reports"],"summary":"List Report Permissions","description":"Who can open this dashboard, and may the caller change that?\n\nReadable by anyone who can read the dashboard: seeing who else on your\nteam has access is not privileged, and hiding it would leave a\nnon-owner unable to tell whether sharing had happened at all.","operationId":"list_report_permissions_reports__report_id__permissions_get","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Report ID (UUID)","title":"Report Id"},"description":"Report ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportPermissionsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/{report_id}/permissions/{user_id}":{"put":{"tags":["reports"],"summary":"Set Report Permission","description":"Grant, or change, one person's access to this dashboard.","operationId":"set_report_permission_reports__report_id__permissions__user_id__put","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Report ID (UUID)","title":"Report Id"},"description":"Report ID (UUID)"},{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"User ID (UUID)","title":"User Id"},"description":"User ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetReportPermissionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["reports"],"summary":"Remove Report Permission","description":"Revoke one person's access.","operationId":"remove_report_permission_reports__report_id__permissions__user_id__delete","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Report ID (UUID)","title":"Report Id"},"description":"Report ID (UUID)"},{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"User ID (UUID)","title":"User Id"},"description":"User ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semantics":{"get":{"tags":["semantics"],"summary":"List Semantics","operationId":"list_semantics_api_v1_semantics_get","parameters":[{"name":"scope","in":"query","required":true,"schema":{"type":"string","format":"uuid","description":"Agency id whose vocabulary to read alongside the global rows","title":"Scope"},"description":"Agency id whose vocabulary to read alongside the global rows"},{"name":"include_retired","in":"query","required":false,"schema":{"type":"boolean","description":"Also return retired rows","default":false,"title":"Include Retired"},"description":"Also return retired rows"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["semantics"],"summary":"Create Semantic","operationId":"create_semantic_api_v1_semantics_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SemanticCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semantics/{semantic_id}":{"patch":{"tags":["semantics"],"summary":"Patch Semantic","operationId":"patch_semantic_api_v1_semantics__semantic_id__patch","parameters":[{"name":"semantic_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Semantic id (measure or dimension)","title":"Semantic Id"},"description":"Semantic id (measure or dimension)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SemanticPatchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semantics/{semantic_id}/promote":{"post":{"tags":["semantics"],"summary":"Promote Semantic","description":"Agency -> global, gated TWICE on purpose.\n\n1. `Capability.WIDGET_PROMOTE` on the OWNING agency — exactly the STR-672\n   rule `routers/widgets.py:_require_promote` applies to a widget promoted\n   to a shared scope (admin+ today; whatever replaces it there replaces it\n   here).\n2. `verify_admin_token` — the shared `X-Admin-Token`, where this repo puts\n   every cross-tenant operator action (STR-652: there is no staff role, and\n   every capability is agency-scoped by design). A widget promoted to agency\n   scope stays inside one tenant; a global semantic is read by every tenant,\n   so the agency admin's say-so alone is not enough.\n\nThe row keeps its id and version (promotion is not a meaning change), so a\nconfirmed upload plan that pinned `(id, version)` still resolves.","operationId":"promote_semantic_api_v1_semantics__semantic_id__promote_post","parameters":[{"name":"semantic_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Agency semantic to make global","title":"Semantic Id"},"description":"Agency semantic to make global"},{"name":"X-Admin-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Admin-Token"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/workspace":{"get":{"tags":["workspace"],"summary":"Get Workspace","description":"Get all agencies, clients, and report metadata accessible to the authenticated user.\n\nReturns agencies the user belongs to, along with all clients in those agencies,\nand report metadata (without config) that the user has access to for each client.\nOwner/admin roles see every client in the agency; editor/viewer/member with\nuser_client_scopes rows are filtered to only the clients in their scope.","operationId":"get_workspace_workspace_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/workspace/client_data/{client_id}/campaign_groups":{"get":{"tags":["workspace"],"summary":"Get Client Campaign Groups","description":"STR-1042 — the campaign groups of a client, and nothing else.\n\nThe campaign scope switcher (the page title on Insights, Actions and the\nCampaigns pages) lists ten-odd rows, but until this route existed the only\nthing that filled its store was the FULL hierarchy above — 3.7 MB and ~7 s\non production for a client with 18,000 ads. This is the same rows as\n`ClientDataModel.campaign_groups`, same gate, milliseconds.","operationId":"get_client_campaign_groups_workspace_client_data__client_id__campaign_groups_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client ID (UUID)","title":"Client Id"},"description":"Client ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignGroupsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/workspace/client_data/{client_id}":{"get":{"tags":["workspace"],"summary":"Get Client Data","description":"Get complete campaign data for a client.\n\nReturns all campaign-related data needed for filtering and navigation:\n    - Campaign groups (active/inactive)\n    - Platforms available in the client's campaigns\n    - Campaigns with their platform and campaign group associations\n    - Ad groups with their campaign associations\n    - Ads with their ad group associations\n\nSTR-1043: the eight table reads below are independent of one another, so\nthey run concurrently, and each paged read requests several windows at\nonce. Sequentially this was ~42 PostgREST round trips (6.6 s) for a client\nwith 18,000 ads; now it is bounded by the longest single table's rounds.\nThe body is gzipped for callers that accept it — see `_json_response`.","operationId":"get_client_data_workspace_client_data__client_id__get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client ID (UUID)","title":"Client Id"},"description":"Client ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientDataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/campaign-groups":{"post":{"tags":["campaign_groups"],"summary":"Create Campaign Group","operationId":"create_campaign_group_campaign_groups_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaignGroupRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignGroupResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/campaign-groups/{campaign_group_id}":{"patch":{"tags":["campaign_groups"],"summary":"Update Campaign Group","operationId":"update_campaign_group_campaign_groups__campaign_group_id__patch","parameters":[{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignGroupRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignGroupResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["campaign_groups"],"summary":"Delete Campaign Group","operationId":"delete_campaign_group_campaign_groups__campaign_group_id__delete","parameters":[{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Campaign Group Campaign Groups  Campaign Group Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/campaign-groups/campaigns/{campaign_id}/primary":{"post":{"tags":["campaign_groups"],"summary":"Set Primary Campaign Group","description":"STR-116 — switch which group is \"primary\" for a campaign.\n\nThe campaign must already be a member of the target group (we\ndon't auto-add memberships here — adding is via the\ncreate/update endpoints). Idempotent: setting the same\nprimary twice is a no-op.\n\nAuthz: caller needs CAMPAIGN_GROUP_MUTATE on the target group's\nagency.","operationId":"set_primary_campaign_group_campaign_groups_campaigns__campaign_id__primary_post","parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetPrimaryGroupRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Set Primary Campaign Group Campaign Groups Campaigns  Campaign Id  Primary Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/ad-accounts":{"get":{"tags":["metadata"],"summary":"Get Client Ad Accounts","description":"Get all ad accounts and their campaigns for a client.\n\nReturns ad accounts with nested campaigns that have been synced.","operationId":"get_client_ad_accounts_api_v1_clients__client_id__ad_accounts_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/sync-ad-accounts":{"post":{"tags":["metadata"],"summary":"Sync Client Ad Accounts","description":"Trigger a background sync of ad account data (campaigns, ad groups, ads).\n\nThis re-fetches data from connected platforms and updates the database.","operationId":"sync_client_ad_accounts_api_v1_clients__client_id__sync_ad_accounts_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients":{"get":{"tags":["metadata"],"summary":"List Clients","description":"List all clients the user can see in their agency.\n\nOwner/admin see every client; editor/viewer/member with scope rows\nsee only those client_ids; with no scope rows, they see all clients\nin the agency.","operationId":"list_clients_api_v1_clients_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["metadata"],"summary":"Create Client","operationId":"create_client_api_v1_clients_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_client_api_v1_clients_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}":{"patch":{"tags":["metadata"],"summary":"Update Client","description":"Update a client's basic details (name, website, theme, logo, colours).\n\nPermissions: editor+ in the client's agency, scoped to the client.\n`currency_code` is never written here: the client's currency is set in the\nadmin console (STR-2510). A value equal to the client's own setting\n(`inherit` for none) is dropped; another is 403 `currency_set_in_console`,\nbefore any write.","operationId":"update_client_api_v1_clients__client_id__patch","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_update_client_api_v1_clients__client_id__patch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["metadata"],"summary":"Delete Client","description":"Delete a client and comprehensively clean up all associated data.\n\nCleanup order:\n1. Airbyte connections for all ad accounts (background)\n2. Campaign map entries (avoid FK issues with soft-deleted groups)\n3. Campaign groups (hard delete since client is being removed)\n4. Client row (CASCADE handles ad_accounts, campaigns, ad_groups,\n   ads, reports, news_feeds, news_items)\n5. Data-API cache flush","operationId":"delete_client_api_v1_clients__client_id__delete","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/generate-context":{"post":{"tags":["metadata"],"summary":"Generate Context","description":"Scrape the client's website and generate a rich company profile via LLM.\n\nThe generated text is returned but NOT automatically saved; the frontend\nshould let the user review/edit it before persisting via PATCH.\n\nPermissions: editor+ in the client's agency, scoped to the client.","operationId":"generate_context_api_v1_clients__client_id__generate_context_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/generate-context-preview":{"post":{"tags":["metadata"],"summary":"Generate Context Preview","description":"Generate a company profile from a website URL without requiring a saved client.\n\nIntended for the client creation flow where no client_id exists yet.\n\nPermissions (STR-270): admin/owner in at least one agency — the same bar\nas the POST /clients call this previews. It triggers a server-side fetch\nof a caller-supplied URL plus an LLM call, so it must not be open to every\nauthenticated user.","operationId":"generate_context_preview_api_v1_clients_generate_context_preview_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/_GenerateContextPreviewBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/client-context":{"patch":{"tags":["metadata"],"summary":"Update Client Context","description":"Apply a client_context (STR-24 shape) as a plain JSON body, without the\nmultipart name/theme/logo that PATCH /clients/{id} requires.\n\nMerges field-by-field over the existing context (new non-empty values win;\nblanks never clobber) so it's safe to call with a partial block. The\nincoming value is validated like the multipart field (caps + numeric\nbaselines → 422 on violation).","operationId":"update_client_context_api_v1_clients__client_id__client_context_patch","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/_UpdateClientContextBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/fetch-ad-accounts":{"post":{"tags":["metadata"],"summary":"Fetch Client Metadata","operationId":"fetch_client_metadata_api_v1_clients__client_id__fetch_ad_accounts_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetadataFetchResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-context/extract":{"post":{"tags":["campaign_context"],"summary":"Extract Campaign Context","description":"Upload + parse source documents into a proposed context_graph.\n\nStores the raw uploads in the private bucket (so a later save can reference\nthem and the engine can re-read them), then returns the extracted graph for\nthe user to review/edit before persisting. Nothing is written to\n`campaign_context` here.","operationId":"extract_campaign_context_api_v1_clients__client_id__campaign_context_extract_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_extract_campaign_context_api_v1_clients__client_id__campaign_context_extract_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-context":{"post":{"tags":["campaign_context"],"summary":"Save Campaign Context","description":"Persist a reviewed context_graph as a new version for (client, campaign_group).","operationId":"save_campaign_context_api_v1_clients__client_id__campaign_context_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveCampaignContextRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["campaign_context"],"summary":"Get Campaign Context","description":"Return the latest stored context version for a (client, campaign_group).","operationId":"get_campaign_context_api_v1_clients__client_id__campaign_context_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"campaign_group_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-context/files":{"get":{"tags":["campaign_context"],"summary":"List Campaign Context Files","description":"The active source files feeding a (client, campaign_group) context.","operationId":"list_campaign_context_files_api_v1_clients__client_id__campaign_context_files_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"campaign_group_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["campaign_context"],"summary":"Add Campaign Context Files","description":"Add source files to a context: store each in the private bucket, extract\nits digest (chunked — large docs are no longer silently truncated to one\n24k slice), save the re-merged context version, then register the files\n(STR-239; write order per STR-270 B2 — see perform_files_add).","operationId":"add_campaign_context_files_api_v1_clients__client_id__campaign_context_files_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_add_campaign_context_files_api_v1_clients__client_id__campaign_context_files_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-context/files/{file_id}":{"delete":{"tags":["campaign_context"],"summary":"Remove Campaign Context File","description":"Remove a source file: delete its registry row + stored blob, then\nre-merge the REMAINING cached digests into a new context version — no LLM\ncall — with human-authored values preserved (STR-239).","operationId":"remove_campaign_context_file_api_v1_clients__client_id__campaign_context_files__file_id__delete","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"file_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Context file UUID","title":"File Id"},"description":"Context file UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-context/extract-jobs":{"post":{"tags":["campaign_context"],"summary":"Submit Extract Job","description":"Async twin of POST .../campaign-context/extract (STR-270 B1): validate +\nstage the uploads synchronously, then 202 with a job_id to poll. On\nsuccess the job's `result` is exactly the sync endpoint's data object.","operationId":"submit_extract_job_api_v1_clients__client_id__campaign_context_extract_jobs_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_submit_extract_job_api_v1_clients__client_id__campaign_context_extract_jobs_post"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-context/files-jobs":{"post":{"tags":["campaign_context"],"summary":"Submit Files Add Job","description":"Async twin of POST .../campaign-context/files (STR-270 B1): the ENTIRE\nadd — digest extraction, context version save, registry insert — runs in\nthe background task, so a client disconnect can never half-apply it. On\nsuccess the job's `result` mirrors the sync response data\n({added, failed, campaign_context, files}).","operationId":"submit_files_add_job_api_v1_clients__client_id__campaign_context_files_jobs_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_submit_files_add_job_api_v1_clients__client_id__campaign_context_files_jobs_post"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-context/extract-jobs/{job_id}":{"get":{"tags":["campaign_context"],"summary":"Get Extract Job","description":"Poll an async extraction job (both kinds — files-jobs rows are read here\ntoo). Cheap read on the global rate bucket, so a 1Hz poll is fine.","operationId":"get_extract_job_api_v1_clients__client_id__campaign_context_extract_jobs__job_id__get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Extraction job UUID","title":"Job Id"},"description":"Extraction job UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/recreations/{job_id}":{"get":{"tags":["dashboards"],"summary":"Get Recreation","description":"`{progress, cards, seq, result}`: the cards changed after `after`, and\nthe generate payload once the job ended. A job that lost its worker (an\nAPI restart, or a refused token) resumes here with the caller's token.","operationId":"get_recreation_api_v1_dashboards_recreations__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}},{"name":"after","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"After"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/recreations/{job_id}/stop":{"post":{"tags":["dashboards"],"summary":"Stop Recreation","description":"Stop the job. Finished cards stay; the rest end not checked. A job\nwithout a worker is claimed here and ends at once.","operationId":"stop_recreation_api_v1_dashboards_recreations__job_id__stop_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/generate":{"post":{"tags":["dashboards"],"summary":"Generate","description":"Generate a dashboard proposal (name + summary + widget picks).","operationId":"generate_api_v1_dashboards_generate_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateDashboardRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/generate/stream":{"post":{"tags":["dashboards"],"summary":"Generate Stream","description":"Streaming twin of /generate (STR-531): real progress, one SSE frame\nper dispatched tool call.\n\nFrames: {\"type\":\"status\",\"label\"} → {\"type\":\"design\",...} →\n{\"type\":\"tool\",\"tool\",\"ok\",\"detail\"}* → exactly one terminal\n{\"type\":\"result\",\"data\":<the /generate payload>} or\n{\"type\":\"error\",\"code\",\"message\"}. The auth check runs BEFORE the\nstream starts, so a denial is an ordinary 403; failures after headers\nare sent arrive as an error frame instead.\n\nSTR-531 round 7 — the `design` frame is the DESIGNER phase's outcome,\nemitted after status and before any tool frame:\n  {\"type\":\"design\",\"source\",\"archetype\",\"layout\",\"brief\",\"seats\"}\nsource ∈ designer | designer_retry | skipped_invalid | skipped_timeout\n(the skipped_* sources mean the run degraded to the single-loop path:\narchetype/layout/brief are null and seats is empty). `layout` is the\nRESOLVED canonical band spec {\"kind\":\"bands\",\"bands\":[...]}; seat sizes\nuse the wire vocabulary (compact, never small).\n\nSTR-531 round 3 — the tool frame also carries the RESULT of the call,\nso the canvas can draw the board as it is built:\n  add_widget/update_widget → \"widget\": <pick, incl. agent_id>\n  remove_widget            → \"removed\": <agent_id>\n  reorder_widgets          → \"order\": [agent_id, ...]\n  set_board                → \"board_meta\": {dashboard_name, summary, brief,\n                              archetype, assumptions, layout}\nRejected calls carry none of these — they changed nothing.\n\nTwo out-of-band frames cover what happens outside the tool loop:\n  {\"type\":\"finalize\",\"dropped\":[agent_id],\"resized\":[{agent_id,size}],\n   \"restamped\":[{agent_id,metric,source}],\"notes\":[...]}\n    the post-loop invariant sweep, which can take away, shrink, or\n    stamp a metric onto a widget the user has already watched land\n  {\"type\":\"restart\",\"reason\":...}\n    the fresh-board retry — everything streamed before it is void\n    (the design frame is re-emitted right after it)","operationId":"generate_stream_api_v1_dashboards_generate_stream_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateDashboardRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/fit":{"post":{"tags":["dashboards"],"summary":"Board Fit","description":"Does the board still fit its data? Code only, never a model: each\ncard's binding against the authoring catalog, then a data read for the\nboard's dates. `{cards, failing, fits, empty}`.","operationId":"board_fit_api_v1_dashboards_fit_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BoardFitRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/turn":{"post":{"tags":["dashboards"],"summary":"Builder Turn","description":"One message to the Assistant panel (STR-2152), streamed.\n\nFrames as /generate/stream: {\"type\":\"status\",\"label\"},\n{\"type\":\"tool\",...} per call, {\"type\":\"filters\",\"board_filters\"} when the\nboard's filters change, {\"type\":\"question\",\"question\",\"options\"} when\nthe assistant asks, then exactly one {\"type\":\"result\",\"data\"} or\n{\"type\":\"error\",\"code\",\"message\"}. Auth, the thread, its cost cap (409\n`thread_cost_limit`) and the sources are settled before the stream\nstarts, so those refusals are ordinary HTTP errors.\n\n`data` is the assist payload plus thread_id, message_id (the assistant\nmessage `/applied` marks), reply, changes, board_filters, question,\ncoverage, source_check, sources, scope and cost_usd.","operationId":"builder_turn_api_v1_dashboards_turn_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuilderTurnRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/threads":{"get":{"tags":["dashboards"],"summary":"Latest Builder Thread","description":"The caller's latest thread for this report (or for a draft board when\nno report is named), or null.","operationId":"latest_builder_thread_api_v1_dashboards_threads_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","maxLength":64,"title":"Client Id"}},{"name":"report_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Report Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/threads/{thread_id}":{"get":{"tags":["dashboards"],"summary":"Get Builder Thread","description":"`{thread, messages, sources}`: for the creator, or an editor of the\nthread's report.","operationId":"get_builder_thread_api_v1_dashboards_threads__thread_id__get","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Thread Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/threads/{thread_id}/messages/{message_id}/applied":{"post":{"tags":["dashboards"],"summary":"Mark Builder Message Applied","description":"Record that an assistant reply was applied, with the board it replaced\n(the restore target).","operationId":"mark_builder_message_applied_api_v1_dashboards_threads__thread_id__messages__message_id__applied_post","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Thread Id"}},{"name":"message_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Message Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppliedRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/threads/{thread_id}/report":{"post":{"tags":["dashboards"],"summary":"Bind Builder Thread Report","description":"Bind a draft thread to the report it was saved as. The caller must be\nable to edit that report, and it must be the thread's client's.","operationId":"bind_builder_thread_report_api_v1_dashboards_threads__thread_id__report_post","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Thread Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BindReportRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/assist":{"post":{"tags":["dashboards"],"summary":"Assist","description":"Answer a question about the in-progress dashboard canvas.","operationId":"assist_api_v1_dashboards_assist_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistDashboardRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/widget-pick":{"post":{"tags":["dashboards"],"summary":"Widget Pick","description":"One phrase → one validated widget pick (add-popover AI escalation).","operationId":"widget_pick_api_v1_dashboards_widget_pick_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WidgetPickRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/widget-edit":{"post":{"tags":["dashboards"],"summary":"Widget Edit","description":"An instruction + declared controls → validated widget option patches.","operationId":"widget_edit_api_v1_dashboards_widget_edit_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WidgetEditRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/assist-feedback":{"post":{"tags":["dashboards"],"summary":"Assist Feedback","description":"Record one layout-assistant turn's feedback.\n\nGated `DASHBOARD_GENERATE` — the same editor+ tier as the surface that\nproduced the turn, so anyone who can spend a generation can say whether\nit was any good, and nobody else can write rows about a client they\ncannot draft for.\n\nA blank submission is refused rather than stored: a row with neither a\nverdict nor a note is not feedback, and the database CHECK says so too.","operationId":"assist_feedback_api_v1_dashboards_assist_feedback_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssistFeedbackRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/sources":{"post":{"tags":["dashboards"],"summary":"Upload Source","description":"Attach one report file. Returns `{source: {id, filename, media_type,\npage_count, status}, thread_id}`; the inventory is read in the background\n(poll `GET /{id}`).","operationId":"upload_source_api_v1_dashboards_sources_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_source_api_v1_dashboards_sources_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/sources/{source_id}":{"get":{"tags":["dashboards"],"summary":"Get Source","description":"Status and inventory of one file; while a PDF is read, `pages_read` of\n`pages_total`. A read lost to a restart (a `stored` or `reading` row whose\nclaim is older than `STALE_READ_AFTER`) is started again here and reads\nonly the unfinished pages.","operationId":"get_source_api_v1_dashboards_sources__source_id__get","parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Source Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/sources/{source_id}/retry":{"post":{"tags":["dashboards"],"summary":"Retry Source","description":"Read a failed file again without attaching it again. Pages already\nread are kept, so only the pages that were not read are called. 409 when\nthe file is not failed, 410 once it is purged.","operationId":"retry_source_api_v1_dashboards_sources__source_id__retry_post","parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Source Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/dashboards/sources/{source_id}/file":{"get":{"tags":["dashboards"],"summary":"Get Source File","description":"A signed URL valid for 60 seconds, for the side-by-side view. A PDF or\nimage opens inline (append `#page=N` for a PDF page); a spreadsheet\ndownloads. 410 once the file is purged.","operationId":"get_source_file_api_v1_dashboards_sources__source_id__file_get","parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Source Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/unify/uploads":{"post":{"tags":["unify"],"summary":"Create Upload","description":"Record one parsed upload. The bytes, if retained, are written separately\nto the private `unify-uploads` bucket and referenced by `storage_path`.","operationId":"create_upload_api_v1_unify_uploads_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUploadRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["unify"],"summary":"List Uploads","description":"A client's uploads, newest first. Deliberately WITHOUT `tables` — the\nparsed grid is large and a list view never renders it.","operationId":"list_uploads_api_v1_unify_uploads_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/unify/datasets":{"post":{"tags":["unify"],"summary":"Create Dataset","description":"Record a harmonized dataset built from one or more uploads.","operationId":"create_dataset_api_v1_unify_datasets_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDatasetRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["unify"],"summary":"List Datasets","description":"A client's datasets, newest first. WITHOUT `payload` — see list_uploads.","operationId":"list_datasets_api_v1_unify_datasets_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/unify/datasets/{dataset_id}":{"get":{"tags":["unify"],"summary":"Get Dataset","description":"One dataset WITH its payload — what the browser loads to render.","operationId":"get_dataset_api_v1_unify_datasets__dataset_id__get","parameters":[{"name":"dataset_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Dataset Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/data/sync-account/{ad_account_id}":{"post":{"tags":["data-operations"],"summary":"Sync Account","description":"Trigger a full pipeline sync for an ad account via the orchestrator.\n\nThis endpoint:\n1. Checks if the account exists and is active\n2. Resolves the tenant (agency) that owns the account\n3. Calls the orchestrator to run the full pipeline for that tenant\n   (Airbyte syncs -> data move -> dbt -> dimension sync -> cache flush)\n\nArgs:\n    ad_account_id: UUID of the ad account from database\n    auth: Authorizer; gates by client-scoped CLIENT_MUTATE.\n\nReturns:\n    APIResponse with sync trigger result","operationId":"sync_account_api_v1_data_sync_account__ad_account_id__post","parameters":[{"name":"ad_account_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Ad account ID (UUID)","title":"Ad Account Id"},"description":"Ad account ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/data/sync-status/{ad_account_id}":{"get":{"tags":["data-operations"],"summary":"Get Sync Status","description":"Get the latest sync status for an ad account.\n\nQueries the orchestration_run_tasks table to find the most recent sync.\n\nArgs:\n    ad_account_id: UUID of the ad account\n    auth: Authorizer; gates by client-scoped CLIENT_VIEW.\n\nReturns:\n    APIResponse with sync status details","operationId":"get_sync_status_api_v1_data_sync_status__ad_account_id__get","parameters":[{"name":"ad_account_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Ad account ID (UUID)","title":"Ad Account Id"},"description":"Ad account ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads":{"post":{"tags":["data_uploads"],"summary":"Create Upload","operationId":"create_upload_api_v1_clients__client_id__uploads_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_upload_api_v1_clients__client_id__uploads_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["data_uploads"],"summary":"List Uploads","description":"`include_deleted=false` (STR-1560 D13) leaves deleted uploads\n(status `retired`) out in the query, before `limit`; the Uploads page\nreads the list that way. History on the details page is the audit.\n\nSTR-1400: the retired original of a split of an imported upload stays\nlisted while its split is unfinished (it carries Retry and Undo split);\nonce the split is done, undone or finished (`_deleted_from_live_list`)\nit leaves like any deleted upload.","operationId":"list_uploads_api_v1_clients__client_id__uploads_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":100,"title":"Limit"}},{"name":"include_deleted","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Include Deleted"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/transfers":{"post":{"tags":["data_uploads"],"summary":"Open Upload Transfer","description":"Open a transfer: the browser sends this file's bytes straight to the\nclient's raw store, and this service never holds the body (STR-2193).\n\nThe answer carries the target URL, which is a WRITE CREDENTIAL for that\none object. It is stored on the row so a reloaded page resumes against\nthe same session rather than losing the upload, and it is never logged.\n\nLimits are unchanged: the declared size is checked against the same cap\nthe multipart intake enforces, and the stored object is measured again at\nfinalize, so a caller that under-declares is still refused.","operationId":"open_upload_transfer_api_v1_clients__client_id__uploads_transfers_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Body"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/transfers/{transfer_id}":{"get":{"tags":["data_uploads"],"summary":"Read Upload Transfer","description":"The transfer again, target URL included, so a page that reloaded mid\nupload continues the same session instead of starting a new file. A\nresumable target also tells the browser where it got to: that question is\nasked of the session itself, not of this service.","operationId":"read_upload_transfer_api_v1_clients__client_id__uploads_transfers__transfer_id__get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"transfer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Transfer Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["data_uploads"],"summary":"Abort Upload Transfer","description":"Give up on a transfer: its session is cancelled and anything it wrote\nis removed, so abandoned parts do not wait for the janitor.","operationId":"abort_upload_transfer_api_v1_clients__client_id__uploads_transfers__transfer_id__delete","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"transfer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Transfer Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/transfers/{transfer_id}/finalize":{"post":{"tags":["data_uploads"],"summary":"Finalize Upload Transfer","description":"The bytes are in the store; record the file.\n\nThe stored object is read back **in a stream**: its size is checked\nagainst the same cap the multipart intake enforces, its content hash is\ncomputed with the definition the dedupe index and the row-set pin are\nkeyed on, and a `gcs` object's `kmsKeyName` is compared exactly as a\nwrite compares it. The body itself is kept only for a format whose intake\nparses the whole file (`transfers.NEEDS_BODY`); for delimited text —\nthe shape that is measured in gigabytes — nothing larger than one chunk\nis ever resident.\n\nFrom there the decisions are the multipart intake's, unchanged: the\nsheet, a PDF's inventory, the duplicate rules, the row and its events.\n\nAn EXPIRED transfer is deliberately still finalized while its object is\nthere: the bytes arrived, and refusing them would throw away a finished\nupload over a clock. What ends a late finalize is the janitor having\nremoved the object, which answers `transfer_incomplete`. `GET` refuses an\nexpired transfer because what it hands back is a target to keep sending\nto, and that target is the thing that has expired.","operationId":"finalize_upload_transfer_api_v1_clients__client_id__uploads_transfers__transfer_id__finalize_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"transfer_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Transfer Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/analyze":{"post":{"tags":["data_uploads"],"summary":"Analyze Upload","description":"Queue the analysis (also the retry). One active job per upload.","operationId":"analyze_upload_api_v1_clients__client_id__uploads__upload_id__analyze_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AnalyzeRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/sheets":{"post":{"tags":["data_uploads"],"summary":"Load Sheets","description":"STR-1490 D14: one upload per sheet or table of this file, in one call.\nThe source row takes the first free sheet when it has none (its analysis\nstarts); every other sheet becomes its own upload (a server-side copy of\nthe stored file) whose analysis starts too. Sheets already held by a live\nrow of this client are skipped.","operationId":"load_sheets_api_v1_clients__client_id__uploads__upload_id__sheets_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SheetsRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/confirm/preview":{"post":{"tags":["data_uploads"],"summary":"Preview Confirm","description":"The same validation, gates and verdicts as confirm, persisted nowhere\nbut the display count `rows_to_import` (STR-1560 G1: the rows this\npreview imports, or null when it is refused). A search of the listed\nvalues (`value_query`) runs one at a time per user (STR-1401 A24): a\nsecond search while the first runs answers 429\n`preview_busy` at once, before it would wait for a heavy slot. A preview\nwithout a search is never capped: screens that predate the search (main's\nreview previews several dropped files at once) never send one, so no deploy\norder shows them a 429.\n\nSTR-1491 D3/D4: a preview waits its turn for a heavy slot (up to\n`batch.HEAVY_WAIT_SECONDS`); a newer preview of the same file by the same\nperson replaces a waiting one (409 `preview_superseded`), and one whose\nrequest went away leaves the queue.","operationId":"preview_confirm_api_v1_clients__client_id__uploads__upload_id__confirm_preview_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/app__routers__data_uploads__PreviewRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/confirm":{"post":{"tags":["data_uploads"],"summary":"Confirm Upload","description":"analyzed → confirmed with the versioned plan, gate results, merge plan\nand target the STR-1005 load job needs; no model in the path.","operationId":"confirm_upload_api_v1_clients__client_id__uploads__upload_id__confirm_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ConfirmRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/draft":{"put":{"tags":["data_uploads"],"summary":"Save Review Draft","description":"Save the review as edited (STR-1560 D16): the body is the\n`confirm/preview` request the review last sent (`value_query` and\n`include_sample` are dropped), or `null` to clear it. CLIENT_MUTATE;\n413 `draft_too_large` past 64 KB; 422 `invalid_draft` when it is no\n`PreviewRequest`; 409 `not_editable` unless the upload is `analyzed`, or\n`confirmed` and never loaded. Stored on `review_draft`; a non-null draft\nkeeps the file out of the no-click finisher. Read back on `GET /{id}`.","operationId":"save_review_draft_api_v1_clients__client_id__uploads__upload_id__draft_put","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/reject":{"post":{"tags":["data_uploads"],"summary":"Reject Upload","description":"Reject a file from its review (STR-1560 D6, \"Reject file\"):\nCLIENT_MUTATE. Allowed for an `analyzed` upload, or a `confirmed` one\nthat never loaded, with no active job (analyze included: `failed` is\nanalyzable, so a running analyze would write the row back to\n`analyzed` and undo the rejection); else 409 `not_rejectable`. The upload becomes `failed` with `error = {code:\n\"rejected\", detail: {reason}}` by compare-and-set, its saved review is\ncleared, and a `rejected` event is recorded. Its one next step is to\nupload a corrected file; Delete still removes it.","operationId":"reject_upload_api_v1_clients__client_id__uploads__upload_id__reject_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/RejectRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/load":{"post":{"tags":["data_uploads"],"summary":"Load Upload","description":"confirmed → loading → landed → available: re-parse with no model,\nexecute the stored plan, stage the rows in the upload rows table, publish\nthrough the CAS RPC and apply the generation (STR-1005, STR-1413). 202 +\na job of kind `load`, polled through GET /jobs/{job_id}. The caller is\nthe publish actor. 503 `upload_rows_not_configured` when this deployment\nhas no upload rows writer.","operationId":"load_upload_api_v1_clients__client_id__uploads__upload_id__load_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/try-again":{"post":{"tags":["data_uploads"],"summary":"Try Upload Again","description":"Try again on a file past its time target (STR-1500 D16), editor+\n(CLIENT_MUTATE), whoever started it.\n\n- A load that is running past its target: `try_again_upload_load` stops\n  it and queues a new load in ONE transaction (the old job fails\n  `stopped_to_try_again`; the file never reads \"needs a person\"), then\n  the new load is scheduled as the caller. The old runner stops at its\n  next lease check.\n- A save to dashboards (`landed`) past its target: `settle_upload_now`\n  makes the data set due now (or answers the wait of a live claim) and\n  restarts the clock.\n\nBoth RPCs record a `retried` event (the caller as actor, `detail.via`\n`try_again`) in the same transaction as what they do; a refusal records\nnothing.\n\nA load still waiting for its turn is 409 `still_waiting`; a file that is\nnot stuck is 409 `not_stuck` with its state. The original's bytes and the\nupload rows writer are checked BEFORE anything is stopped (409\n`raw_purged`, 503 `upload_rows_not_configured`). A confirmed file whose\nload failed keeps `POST /load`. Async (the scheduling needs the loop).","operationId":"try_upload_again_api_v1_clients__client_id__uploads__upload_id__try_again_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/rollback":{"post":{"tags":["data_uploads"],"summary":"Rollback Generation","description":"Republish an EARLIER generation's manifest as a new generation (admin+).\n\nHistory is never rewound in place: the dataset gains a generation whose\ncontent is the earlier one, and both stay in the journal. The upload rows\ntick applies it to the reader table within a few minutes (STR-1413).","operationId":"rollback_generation_api_v1_clients__client_id__uploads_rollback_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/RollbackRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/availability/retry":{"post":{"tags":["data_uploads"],"summary":"Retry Upload Availability","description":"Retired (STR-1414): 410 `upload_availability_retry_retired`, after the\nsame admin+ check as before.\n\nTry again restarted the warehouse pipeline after processing stopped\n(STR-1330). Since STR-1413 a load settles inline into the upload rows\ntable and the tick applies anything it left, so nothing stops that way\nand nothing dispatches the pipeline. The route stays until the follow-up\nremoves the dashboard's Try again path with it.","operationId":"retry_upload_availability_api_v1_clients__client_id__uploads__upload_id__availability_retry_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/retire/preview":{"get":{"tags":["data_uploads"],"summary":"Preview Retirement","description":"The entity-level diff of retiring this upload, BEFORE it is applied\n(admin+): rows retired, rows revived per grain signature, entities added,\nremoved and restated, and the totals delta. Read-only — it publishes\nnothing — and it reads the row sets the manifest pins (STR-1413), never\nthe raw bytes, so a purged upload previews exactly like any other. A\nrefused writer or a failed row read is 503 (`_retire_refusal_status`). The basis is the retire\njob's rule (`retire.retirement_basis`, STR-1340) and the preview is its\none dispatch (`retire.preview_for_basis`), so the preview always shows\nwhat the job does. 409 `not_served` for a file the current generation does\nnot list, unless its own retirement, a rollback or a race dropped it.\n\nA retirement a later publish covered (STR-1340) previews the current\ndata against itself: the file is already out and Retire only finishes the\nrecord, so nothing is retired or restored and the totals do not move. Its\npreview, and this answer, carry `finishing: true`; the preview also names\nthe `retirement_generation`. A file a rollback or a race dropped (STR-1347)\npreviews the same way, with `not_in_use_reason` (`rolled_back`, or null\nfor a race) and the `dropped_generation` instead: Retire clears it and\npublishes nothing. Every other preview has no `finishing`.","operationId":"preview_retirement_api_v1_clients__client_id__uploads__upload_id__retire_preview_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/campaign":{"patch":{"tags":["data_uploads"],"summary":"Set Upload Campaign","description":"Choose the campaign of a file never confirmed (STR-1485 D11): editor+\n(CLIENT_MUTATE), like analyze. Only an `uploaded`, `analyzed` or `failed`\nrow with no `dataset_id`; allowed while its analysis runs (that job's\ncompare-and-set never overwrites this choice), 409 `job_in_progress`\nwhile any other job runs. The choice is recorded on the row (basis\n`file`, who and when) and carried into the `confirmed` event; no event\nof its own. Answering a file whose names matched several campaigns sets\n`target.several_answered`.","operationId":"set_upload_campaign_api_v1_clients__client_id__uploads__upload_id__campaign_patch","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CampaignPatchRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}":{"delete":{"tags":["data_uploads"],"summary":"Delete Upload","description":"Delete an upload (STR-1560 D12): the one Delete, for anyone who can\nupload (CLIENT_MUTATE, editor+), with an optional reason. Admin Retire\nand editor Undo fold into it; the former undo/discard aliases are removed.\n\n- `retired` → 200 `{upload, outcome: \"deleted\"}`, as the first Delete\n  answered (STR-2071).\n- The file's own deletion running (a `retire` job, not a split and not\n  a new version) → 202 `{job_id, outcome: \"removing\"}` naming that job\n  (STR-2071). A new version's job is 409 `job_in_progress` with\n  `new_version: true`; a split's carries `split`.\n- Any other active job → 409 `job_in_progress`, except an `analyze` job\n  on a never-loaded file: analyze's writes are fenced by its analyzable\n  statuses, so the job ends as changed and cannot revive the row.\n- Never loaded (`loaded_at` null; `uploaded`, `analyzed`, `failed` or\n  `confirmed`) → deleted at once by compare-and-set: 200\n  `{upload, outcome: \"deleted\"}`.\n- Loaded → the retire job (`_prepare_retire`, `retire.run_retire_job`),\n  its `retired` event marked `via: delete`: 202\n  `{job_id, outcome: \"removing\"}`. No writer → 503\n  `upload_rows_not_configured`; a file not in reports → 409\n  `not_served` / `not_published`.\n\n`async def` (STR-1208): `schedule_job` needs the running loop; the\nupload checks and the job insert run in a thread.","operationId":"delete_upload_api_v1_clients__client_id__uploads__upload_id__delete","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/DeleteRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["data_uploads"],"summary":"Get Upload","description":"The row (proposal included, profile summarised) plus the latest job.","operationId":"get_upload_api_v1_clients__client_id__uploads__upload_id__get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/split/preview":{"post":{"tags":["data_uploads"],"summary":"Preview Split","description":"What splitting this loaded upload would do (editor+, read-only): its\nrows per value of the column, grouped in BigQuery (no row reaches the\napi), in the review's `CampaignValuesOut` shape, with the defaults by\nname and, with `checks: true` from an agency admin, the retire preview's\nrestored rows. A gating refusal is `blocked` in a 200; `split` is filled\nwhenever it can be computed. Its own rate bucket.\n\nThe checks parse the data set's whole generation manifest (one stamp per\nrow), as the admin-only retire preview does, so an editor's `checks` is\nignored (`checks` null): the split job refuses `split_restores_rows`\nbefore it changes anything (review R1, round 1).","operationId":"preview_split_api_v1_clients__client_id__uploads__upload_id__split_preview_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/split":{"post":{"tags":["data_uploads"],"summary":"Start Split","description":"Split a loaded upload into campaigns (editor+, Q5): a `retire` job on\nthe upload marked `split`. It retires the file, waits until its data set\nhas applied that, reopens the same bytes as a new upload in the file's\ncampaign with the rows choice preset, and analyzes it with the original's\ncolumn settings. A `split_id` the upload already carries resumes that\nsplit (Try again). A route that creates a campaign also needs the\ncampaign capability, as the review's confirm does.","operationId":"start_split_api_v1_clients__client_id__uploads__upload_id__split_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Body"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/split/undo":{"post":{"tags":["data_uploads"],"summary":"Undo Split","description":"Undo a split of a loaded upload (editor+, reason optional), from the\noriginal or any upload of the split: a `retire` job on the original\nmarked `undo`. It holds a job on every member, retires the loaded ones\nand withdraws the rest (head last), waits until every data set it\nchanged has applied, then reopens the original's bytes in its campaign\npreset with the original's own rows choice.","operationId":"undo_split_api_v1_clients__client_id__uploads__upload_id__split_undo_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Body"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/events":{"get":{"tags":["data_uploads"],"summary":"List Upload Events","description":"This upload's audit trail (admin+): who created, analyzed, confirmed,\noverrode a gate on, loaded, retired or rolled it back, with the written\nreason. Retained 12 months.","operationId":"list_upload_events_api_v1_clients__client_id__uploads__upload_id__events_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":200,"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/raw-download":{"post":{"tags":["data_uploads"],"summary":"Create Raw Download","description":"A short-lived signed URL to the upload's ORIGINAL file (admin+, STR-1020).\n\nThe bytes are the customer's file exactly as it arrived — not the\nformula-neutralised CSV an export writes — so this is an admin decision,\nlike reading the audit trail. The URL is signed for 60 seconds with an\nattachment disposition, returned once with `Cache-Control: no-store`, and\nnever logged or stored: the audit event carries only the TTL and the size.\nAfter the 30-day raw purge there is nothing to sign (409 `raw_purged`).\n\nPOST, not GET: each call mints a credential and writes an audit row.\nA sync route, so FastAPI runs the blocking storage call in its threadpool.","operationId":"create_raw_download_api_v1_clients__client_id__uploads__upload_id__raw_download_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/templates":{"get":{"tags":["data_uploads"],"summary":"List Templates","description":"Templates of this agency + client (STR-993 keys them per client, A5).","operationId":"list_templates_api_v1_clients__client_id__uploads_templates_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"lane","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lane"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/templates/{template_id}":{"patch":{"tags":["data_uploads"],"summary":"Rename Template","description":"Rename: admin+ (AGENCY_MUTATE on the owning agency) on top of the client gate.","operationId":"rename_template_api_v1_clients__client_id__uploads_templates__template_id__patch","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"template_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Template Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/TemplatePatchRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["data_uploads"],"summary":"Delete Template","description":"Delete: admin+. Uploads keep their own stored plan, so their\n`template_id` is cleared first (the FK has no ON DELETE action).","operationId":"delete_template_api_v1_clients__client_id__uploads_templates__template_id__delete","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"template_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Template Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/advertiser-names":{"get":{"tags":["data_uploads"],"summary":"List Advertiser Names","description":"The advertiser names an admin confirmed as this client's (STR-1489):\nadmin+ (`_authorize_admin`), active names only. 503\n`advertiser_names_unavailable` when the store can't be read.","operationId":"list_advertiser_names_api_v1_clients__client_id__uploads_advertiser_names_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/advertiser-names/{name_id}":{"delete":{"tags":["data_uploads"],"summary":"Remove Advertiser Name","description":"Remove a saved advertiser name (STR-1489): admin+. A soft delete\n(`removed_at`, `removed_by`), so the name stays as history; files with\nthat name stop and ask again, open ones included. 404\n`advertiser_name_not_found` for an unknown id, another client's, or one\nalready removed.","operationId":"remove_advertiser_name_api_v1_clients__client_id__uploads_advertiser_names__name_id__delete","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"name_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Name Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/campaigns":{"post":{"tags":["data_uploads"],"summary":"Create Upload Campaign","description":"Start an uploaded campaign without leaving Uploads (STR-1486): editor+\n(CLIENT_MUTATE on the client, then CAMPAIGN_GROUP_MUTATE). Both modes go\nthrough `uploaded_campaign.create_uploaded_campaign`, the one creation\npath. 201 when a campaign was created, otherwise 200 (`first_drop`\nreused the client's only campaign, or made none and says why in\n`reason`). Upload ids that are not this client's are ignored.","operationId":"create_upload_campaign_api_v1_clients__client_id__uploads_campaigns_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CampaignsRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/jobs/{job_id}":{"get":{"tags":["data_uploads"],"summary":"Poll Job","operationId":"poll_job_api_v1_clients__client_id__uploads_jobs__job_id__get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/field-mapping":{"get":{"tags":["data_uploads"],"summary":"Get Field Mapping","description":"Return editable field meanings and column metadata without reading source cells.","operationId":"get_field_mapping_api_v1_clients__client_id__uploads__upload_id__field_mapping_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/preview":{"get":{"tags":["data_uploads"],"summary":"Preview Upload","description":"Served from the profile sample recorded at analyze time — never a re-read.\n\nEditor+ (CLIENT_MUTATE, because it serves raw sample cells): the\nreview's Preview data shows the file as uploaded beside the rows as\nimported. Flagged personal columns are masked for every reader, and once\nthe original is purged (or due) it is 409 `raw_purged`.","operationId":"preview_upload_api_v1_clients__client_id__uploads__upload_id__preview_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"rows","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":50,"title":"Rows"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/inspect":{"get":{"tags":["data_uploads"],"summary":"Inspect Upload","operationId":"inspect_upload_api_v1_clients__client_id__uploads__upload_id__inspect_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/rows":{"get":{"tags":["data_uploads"],"summary":"Upload Rows","operationId":"upload_rows_api_v1_clients__client_id__uploads__upload_id__rows_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Page Size"}},{"name":"current","in":"query","required":false,"schema":{"type":"string","pattern":"^(true|false|all)$","default":"true","title":"Current"}},{"name":"generation","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}],"title":"Generation"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Search"}},{"name":"row_numbers","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":12000},{"type":"null"}],"title":"Row Numbers"}},{"name":"timeframe","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Timeframe"}},{"name":"filters","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":20000},{"type":"null"}],"title":"Filters"}},{"name":"contribution","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":30000},{"type":"null"}],"title":"Contribution"}},{"name":"contribution_period","in":"query","required":false,"schema":{"type":"string","pattern":"^(current|prior)$","default":"current","title":"Contribution Period"}},{"name":"campaign_group_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Campaign Group Id"}},{"name":"view","in":"query","required":false,"schema":{"type":"string","pattern":"^(all|refused|spread|ambiguous)$","default":"all","title":"View"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/verify":{"post":{"tags":["data_uploads"],"summary":"Verify Upload","operationId":"verify_upload_api_v1_clients__client_id__uploads__upload_id__verify_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/reprocess/preview":{"post":{"tags":["data_uploads"],"summary":"Preview Reprocess","operationId":"preview_reprocess_api_v1_clients__client_id__uploads__upload_id__reprocess_preview_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReprocessPreviewRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/reprocess":{"post":{"tags":["data_uploads"],"summary":"Apply Reprocess","operationId":"apply_reprocess_api_v1_clients__client_id__uploads__upload_id__reprocess_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReprocessRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/uploads/{upload_id}/plan":{"patch":{"tags":["data_uploads"],"summary":"Change Upload Plan","description":"Edit after import (STR-1982), editor+ (CLIENT_MUTATE), like every\ncampaign files write.\n\nThe body names what changes: `source` (a platform or a source name),\n`campaign_group_id` (another uploaded campaign of this client), `columns`\n(`{name, role, semantic}`), `period` (a dateless file's dates),\n`campaigns` (`{value, included}`, the file's ad campaigns this campaign\nkeeps) and `currency` (STR-2067: the ISO 4217 code the file's amounts are\nwritten in, which the FX path converts into the campaign's; a choice, so\nthe import template saves it, while an assumed USD never is). The choices\nare kept on the file (`plan_change`) and every later confirm with `{}`\nbuilds on them.\n\n- A file not yet imported (`analyzed`, `failed`): the plan is updated, the\n  campaign moved (`PATCH /{id}/campaign`'s rules), and the file checked\n  again; it stays ready unless the change leaves a question.\n- An imported file (`landed`, `available`): reprocessed as a new version\n  that replaces its own rows. Everything that can refuse runs first,\n  while its rows are still in reports: the campaign and the same-file\n  rule, the platform, an answer only an owner or admin may give again,\n  and a confirm preview of the new version's body (what the original was\n  confirmed with, then the change). Then the new version is created with\n  its bytes copied, and recorded on the original (`target.new_version`).\n  The new version is read, confirmed and loaded while the original stays\n  in reports, and its load publishes the original's retirement in the\n  same generation (STR-2542); a version that stops leaves the original\n  as it was. The reply is this file at `reprocessing`, with\n  `version_upload_id`.\n- An imported file a job still holds (STR-2067: a load settling it right\n  after import): the same checks run and the version is created and\n  recorded with `waiting: true`, then the reply is 202 as above. Nothing\n  starts while the job runs; once neither file has a job,\n  `reconcile_versions` starts it (`_start_waiting_version`).\n\nRefused: 409 `job_in_progress` (a file not yet imported that a job\nholds, or an imported one whose new version is still on its way),\n`not_editable`, `raw_purged`,\n`duplicate_upload`, `version_not_ready`; 403 `override_needs_admin`; 422\n`nothing_to_change`, `column_not_found`, `no_campaign_column`,\n`no_campaigns_included`, `unknown_platform`,\n`source_column_not_supported`, `currency_stated_in_file` (every money\ncolumn's header names a code, or a currency column holds codes: those\nwin over a chosen currency); 503 `version_not_created`.","operationId":"change_upload_plan_api_v1_clients__client_id__uploads__upload_id__plan_patch","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"upload_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Upload Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PlanChange"},{"type":"null"}],"title":"Body"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/files":{"get":{"tags":["campaign_files"],"summary":"List Campaign Files","description":"Polled while anything runs. One read, one shape, no per-file calls.\nSTR-2120: newest first; `limit` / `offset` page the rows, `limit=0`\nserves the summary alone (the campaign Overview's counts). Without\n`limit` the read stays one `FILE_LIMIT` read, since this is what polls.","operationId":"list_campaign_files_api_v1_clients__client_id__campaign_groups__campaign_group_id__files_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["campaign_files"],"summary":"Add Campaign File","description":"One file per request; the screens send a drop in parallel.\n\nIntake itself is `data_uploads.create_upload`, unchanged: the duplicate\ncheck, the sheet choice, the PDF inventory and the size limits are the\nsame ones every other path gets. This route only binds the campaign from\nthe URL and starts the check in the same call, so a drop is one request\nper file rather than two.","operationId":"add_campaign_file_api_v1_clients__client_id__campaign_groups__campaign_group_id__files_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_add_campaign_file_api_v1_clients__client_id__campaign_groups__campaign_group_id__files_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["campaign_files"],"summary":"Set Campaign File Sources","description":"One source across many files, which is how a person fixes a drop.\n\nA source a person typed is kept for the client and offered on every later\nfile (`upload_sources`), so the second file from a podcast network needs\nno typing. The reply is the whole view because an effect changes with a\nsource: a file that adds days under one source replaces an earlier file\nunder another.","operationId":"set_campaign_file_sources_api_v1_clients__client_id__campaign_groups__campaign_group_id__files_patch","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkSource"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/answers":{"post":{"tags":["campaign_files"],"summary":"Answer Campaign Questions","description":"A person answers a question, not a file.\n\nOne question covers every file that shares it, so an answer with no\n`upload_ids` lands on all of them, and one that lists `upload_ids` on\nthose files only. The reply is the whole view: answering a source\nquestion changes what the other files are compared against, so their\neffects change too.\n\nEditors and up (CLIENT_MUTATE). `{remove: true}` deletes the file (the\nDelete route's rules). Another client's file (`other_client`) imports\nhere on `{keep: true}` only for an agency owner or admin\n(`AGENCY_MUTATE`, 403 for anyone else, before anything is written), with\nthe `wrong_client_suspected` override and its reason (`answer.reason`, or\na standard one). A file whose printed totals differ (`source_totals`)\nimports as the file reports them on `{keep: true}`, with that check's\noverride and its reason. Every other answered file is checked again, so a\nquestion it no longer has leaves the list. A file whose act refuses says\nwhy on its row; the others still go ahead.","operationId":"answer_campaign_questions_api_v1_clients__client_id__campaign_groups__campaign_group_id__answers_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Answers"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/instructions":{"post":{"tags":["campaign_files"],"summary":"Add Campaign Instruction","description":"A person tells the plan what to do, in a sentence.\n\nThe instruction is kept for the campaign so that it can be applied to\nfiles dropped later. It is recorded, not yet planned: `applied` is null\nuntil the plan runs against it, an empty list once it has run and matched\nno file, and one plain line per change otherwise. A client whose model use\nis `never` or unreadable is refused (403 or 503) and no row is written.","operationId":"add_campaign_instruction_api_v1_clients__client_id__campaign_groups__campaign_group_id__instructions_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Instruction"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/upload-sources":{"get":{"tags":["campaign_files"],"summary":"List Upload Sources","description":"The picker's one list: the platforms, then the sources this client's\nown files have introduced. A client source is scoped to the client and is\nnever offered to another.","operationId":"list_upload_sources_api_v1_clients__client_id__upload_sources_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/import":{"post":{"tags":["campaign_files"],"summary":"Import Campaign Files","description":"One press imports everything that is ready, after the reply.\n\nAnswers 202 at once with the view and `queued`, the files this press\ntook; the confirms and loads run in the background\n(`import_queue.run`): a file is confirmed only while its data set is\nquiet, so each load publishes on the generation it was confirmed\nagainst, and data sets run side by side. A `queued` file (confirmed, its\nload not started or not finished) resumes at the load. A file with an\nopen required question is left at `needs_decision`; a file that refuses\nhas its cause written to its row, and the others go on. A file a press of\nthis worker already holds is not taken twice. `started` repeats `queued`\nand `held` is empty: refusals are read from the rows on the next poll.","operationId":"import_campaign_files_api_v1_clients__client_id__campaign_groups__campaign_group_id__import_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/datasets":{"get":{"tags":["datasets"],"summary":"List Client Datasets","operationId":"list_client_datasets_api_v1_clients__client_id__datasets_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"include_retired","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Retired"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{group_id}/datasets":{"get":{"tags":["datasets"],"summary":"List Campaign Group Datasets","operationId":"list_campaign_group_datasets_api_v1_clients__client_id__campaign_groups__group_id__datasets_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/sources":{"get":{"tags":["datasets"],"summary":"List Client Sources","operationId":"list_client_sources_api_v1_clients__client_id__sources_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{group_id}/datasets/{dataset_id}/marks":{"put":{"tags":["datasets"],"summary":"Set Dataset Marks","description":"Set or clear a hybrid campaign dataset's start and end marks.\n\nA day sets the mark and must equal the dataset's current boundary from\n`hybrid_dataset_bounds` (start: first day; end: raw last day), else 409\n`dataset_mark_stale` with the current day, so a mark never covers data the\nperson did not see. Null clears it (always allowed; the day and setter\nstay as history). Tenant checks first (404 before 403), then\n`CAMPAIGN_GROUP_MUTATE`. `updated_at` is never written. The answer is the\ndataset's recomputed source entry and the group's window.","operationId":"set_dataset_marks_api_v1_clients__client_id__campaign_groups__group_id__datasets__dataset_id__marks_put","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Group Id"}},{"name":"dataset_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Dataset Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatasetMarksRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/resolve":{"post":{"tags":["entity-groups"],"summary":"Resolve Term","operationId":"resolve_term_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups_resolve_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolveRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/options":{"get":{"tags":["entity-groups"],"summary":"Builder Options","description":"What a condition can be built from at `level`, and suggested groups.","operationId":"builder_options_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups_options_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"level","in":"query","required":false,"schema":{"enum":["campaign","ad_group","ad","creative"],"type":"string","default":"ad","title":"Level"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/preview":{"post":{"tags":["entity-groups"],"summary":"Preview Rule","description":"A draft rule's matches. Reads only; nothing is created.","operationId":"preview_rule_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups_preview_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__routers__entity_groups__PreviewRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/breakdowns":{"post":{"tags":["entity-groups"],"summary":"Create Breakdown","description":"A set and its groups in one request: every group is checked first (name,\nrule, at least one member), then the set and the ACTIVE groups are written\nand evaluated together on one scope read.","operationId":"create_breakdown_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups_breakdowns_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BreakdownRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/sets":{"get":{"tags":["entity-groups"],"summary":"List Sets","operationId":"list_sets_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups_sets_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["entity-groups"],"summary":"Create Set","operationId":"create_set_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups_sets_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/sets/{set_id}":{"patch":{"tags":["entity-groups"],"summary":"Rename Set","operationId":"rename_set_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups_sets__set_id__patch","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"set_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Set Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["entity-groups"],"summary":"Delete Set","description":"Detach the set's groups (the FK sets `set_id` null) and re-evaluate each\nalone: without the set, an entity held for review joins every group that\nwants it.","operationId":"delete_set_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups_sets__set_id__delete","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"set_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Set Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/reviews":{"get":{"tags":["entity-groups"],"summary":"List Reviews","operationId":"list_reviews_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups_reviews_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"status","in":"query","required":false,"schema":{"enum":["open","resolved","cleared","all"],"type":"string","default":"open","title":"Status"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/reviews/{review_id}/resolve":{"post":{"tags":["entity-groups"],"summary":"Resolve Review","description":"The chosen group keeps the entity (an include pin); every other group of\nthe review gets an exclude pin. `group_id = null` keeps it out of all.","operationId":"resolve_review_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups_reviews__review_id__resolve_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"review_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Review Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolveReviewRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups":{"get":{"tags":["entity-groups"],"summary":"List Groups","operationId":"list_groups_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Archived"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["entity-groups"],"summary":"Create Group","description":"Create a group, PROPOSED unless `activate` (the builder) makes it active\nat once. Its membership is computed first: a rule and pins\nthat match nothing create nothing (422 `entity_group_no_matches`).","operationId":"create_group_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/{entity_group_id}":{"get":{"tags":["entity-groups"],"summary":"Get Group","operationId":"get_group_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups__entity_group_id__get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"entity_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Entity Group Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":5000,"minimum":1,"default":500,"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["entity-groups"],"summary":"Update Group","description":"Rename, change the rule, or move into / out of a set (`set_id: null`).\nA rule or set change re-evaluates at once.","operationId":"update_group_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups__entity_group_id__patch","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"entity_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Entity Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/{entity_group_id}/pins":{"post":{"tags":["entity-groups"],"summary":"Update Pins","description":"Include or exclude candidates (a near miss, a member, any entity key).\nAdding a key to one list takes it off the other. Re-evaluates at once.","operationId":"update_pins_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups__entity_group_id__pins_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"entity_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Entity Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PinsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/{entity_group_id}/confirm":{"post":{"tags":["entity-groups"],"summary":"Confirm Group","description":"proposed → active: the group joins the catalog as a dimension.","operationId":"confirm_group_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups__entity_group_id__confirm_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"entity_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Entity Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/{entity_group_id}/archive":{"post":{"tags":["entity-groups"],"summary":"Archive Group","description":"Archive: out of the catalog and never re-evaluated. Its history stays.","operationId":"archive_group_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups__entity_group_id__archive_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"entity_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Entity Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/{entity_group_id}/evaluate":{"post":{"tags":["entity-groups"],"summary":"Evaluate Group","operationId":"evaluate_group_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups__entity_group_id__evaluate_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"entity_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Entity Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/campaign-groups/{campaign_group_id}/entity-groups/{entity_group_id}/generations":{"get":{"tags":["entity-groups"],"summary":"List Generations","operationId":"list_generations_api_v1_clients__client_id__campaign_groups__campaign_group_id__entity_groups__entity_group_id__generations_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"entity_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Entity Group Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/creative-classification":{"get":{"tags":["creative-classification"],"summary":"Latest Classification","operationId":"latest_classification_api_v1_clients__client_id__creative_classification_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["creative-classification"],"summary":"Start Classification","description":"An explicit, editor+ action (H12). `async` on purpose: it schedules a\ntask, and a sync route would run in a thread with no event loop (STR-1208).","operationId":"start_classification_api_v1_clients__client_id__creative_classification_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/clients/{client_id}/creative-classification/runs/{run_id}":{"get":{"tags":["creative-classification"],"summary":"Get Classification Run","operationId":"get_classification_run_api_v1_clients__client_id__creative_classification_runs__run_id__get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments":{"get":{"tags":["demo-studio"],"summary":"List Environments","description":"List the demo environments the caller may operate. Owner/admin.\n\nTwo shapes, one gate:\n\n  * `agency_id` given — the ordinary agency-scoped read, refused with the\n    STR-635 envelope when the caller's role there is too low.\n  * `agency_id` omitted or empty — the FLEET read, which is the registry's\n    reason for existing: an operator running one demo per prospect holds\n    several agencies and wants them in one list, not N calls. A caller who\n    manages NONE is refused through `auth.require` on their highest-tier\n    membership — the canonical envelope naming their real role, rather\n    than a misleading empty list.","operationId":"list_environments_api_v1_demo_studio_environments_get","parameters":[{"name":"agency_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Agency UUID to narrow to. Omitted OR EMPTY = every demo the caller manages.","title":"Agency Id"},"description":"Agency UUID to narrow to. Omitted OR EMPTY = every demo the caller manages."},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["demo-studio"],"summary":"Create Environment","description":"Materialize a Demo Pack into a NEW environment. Owner/admin.\n\nThe pack is VALIDATED synchronously, before the 202: a manifest that is one\nfield short should be a 422 the operator sees immediately, not a job that\nfails two minutes later in a row nobody is watching.","operationId":"create_environment_api_v1_demo_studio_environments_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEnvironmentRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/clone":{"post":{"tags":["demo-studio"],"summary":"Clone Environment","description":"Copy a pack under a new name and materialize it.\n\nThe clone is independent by CONSTRUCTION: every id derives from\n`(environment_id, kind, stable_key)` and the new environment id differs, so\nthe two share not a single row.","operationId":"clone_environment_api_v1_demo_studio_environments__environment_id__clone_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloneEnvironmentRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/reset":{"post":{"tags":["demo-studio"],"summary":"Reset Environment","description":"Re-materialize from the stored pack. Refused while FROZEN.\n\nThe frozen check is here as well as in the service so the refusal is\nSYNCHRONOUS — an operator asking to reset a pinned environment should be\ntold immediately, not by a failed job row.","operationId":"reset_environment_api_v1_demo_studio_environments__environment_id__reset_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}":{"delete":{"tags":["demo-studio"],"summary":"Delete Environment","description":"Tear down the environment. Destructive — the name is typed back.\n\nThe BigQuery half is NOT run from here: apps/api holds no warehouse\ncredential, deliberately. The response says so and the `demo-env.yml`\nworkflow runs the tenant deletes as its next step.","operationId":"delete_environment_api_v1_demo_studio_environments__environment_id__delete","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteEnvironmentRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["demo-studio"],"summary":"Get Environment Detail","description":"One environment, with its pack summary and its budget. Owner/admin.\n\nThe list deliberately does not select `pack_json`, so this is where a panel\ngets the shape of what it is editing.","operationId":"get_environment_detail_api_v1_demo_studio_environments__environment_id__get","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["demo-studio"],"summary":"Update Environment Settings","description":"Change the demo's start page. Stored in the pack, nothing rebuilt.\nRefused while frozen: it changes what the prospect sees first.","operationId":"update_environment_settings_api_v1_demo_studio_environments__environment_id__patch","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnvironmentSettingsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/from-brief":{"post":{"tags":["demo-studio"],"summary":"Create Environment From Brief","description":"Build a demo from a brief and keep the brief with it. Owner/admin.\n\nAuthorized like the build it starts: an industry on the operator's\n`agency_id`, a copy on the SOURCE demo's agency (as Copy for another\nprospect is). Every check runs before the 202 and the documents are\nstored before it too, so a refusal never leaves a half-made demo. The\nbrief row is written once the demo's registry row exists; a build that\nfails removes the stored documents.","operationId":"create_environment_from_brief_api_v1_demo_studio_environments_from_brief_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_environment_from_brief_api_v1_demo_studio_environments_from_brief_post"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/brief":{"get":{"tags":["demo-studio"],"summary":"Get Environment Brief","description":"The brief the demo was built from, or `null` for a demo built without\none (quick start). Owner/admin of the demo's agency.","operationId":"get_environment_brief_api_v1_demo_studio_environments__environment_id__brief_get","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/brief/documents/{document_id}":{"get":{"tags":["demo-studio"],"summary":"Download Brief Document","description":"One of the brief's documents, as a download. Owner/admin of the demo's\nagency; the bucket is private and this route is the only way to read it.","operationId":"download_brief_document_api_v1_demo_studio_environments__environment_id__brief_documents__document_id__get","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"document_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Document Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/jobs/{job_id}":{"get":{"tags":["demo-studio"],"summary":"Get Lifecycle Job","description":"Poll a lifecycle job. Authorized against the JOB'S OWN agency.\n\nIt used to take the agency as a QUERY PARAM and authorize on that, which\nauthorized nothing: a caller holding `DEMO_MANAGE` on any agency of their\nown could name it and then read any job id on the deployment — including\nanother agency's failure messages. A caller-supplied scope is not a scope.\n\nThe job's agency is resolved from the row, falling back to the environment\nthe job created (a create/clone job is inserted before its registry row\nexists, so its own `agency_id` is NULL for that window). A job whose agency\ncannot be resolved AT ALL is refused rather than shown: that combination\nmeans an in-flight create, and the only thing withholding it costs is a few\nseconds of polling.","operationId":"get_lifecycle_job_api_v1_demo_studio_jobs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/personas/password":{"post":{"tags":["demo-studio"],"summary":"Rotate Persona Credential","description":"Mint a fresh password for one persona and return it ONCE.\n\nThis is what replaces storing passwords on the job row. Nothing anywhere\nholds a working demo credential at rest; an operator who needs a login gets\na new one on demand. Rotating is also the honest primitive — a password\nsomeone forgot and a password someone never had are the same problem.\n\n**STR-732 makes this the quick-switch's credential source too**, rather\nthan adding a second endpoint that returns a password. One door means one\ngate, one rate limit and one audit line; a second door meaning the same\nthing is a second place to get the gate wrong. The consequence worth\nknowing is that switching to a persona ROTATES it, so a second presenter\nholding the old password loses it. That is the correct trade for a demo\nstack: a credential that stops working when someone else takes the seat is\nthe safer failure.\n\nRate-limited by its OWN bucket in `main.py` (12/min — sized to the\nquick-switch, which calls this once per switch, rather than to be the\nsmallest number in the file) because this is the only endpoint anywhere\nthat returns a working password, and AUDIT-LOGGED below on the success\npath — `auth.denial`\nalready logs the refusals, and a credential release that only appeared in\nthe logs when it FAILED would be the wrong half to record.","operationId":"rotate_persona_credential_api_v1_demo_studio_environments__environment_id__personas_password_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RotatePasswordRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/insights/{insight_id}":{"patch":{"tags":["demo-studio"],"summary":"Patch Insight Wording","description":"Rewrite a published card's wording, and set its curation fields.\n\nTWO gates, and both must pass. `DEMO_MANAGE` answers \"may this person\noperate demos\"; it does not answer \"is this a demo\", and every owner and\nadmin holds it on their own agency. So the tenant is checked separately and\na non-`is_demo` agency is refused — otherwise this is a service-role rewrite\nof a REAL client's published finding, bypassing the RLS that stops a\nfinalized insight being edited at all.\n\nAn edited NUMBER loses its verify affordance (its `execution_log_id` is\nstripped, `demo_edited` stamped in its place). The popover says it shows\n\"the exact query and result the engine recorded\"; on an edited value that\nsentence is false, and a popover contradicting the card is worse than no\npopover. See `app/services/demo_pack/curation.py` for the full rationale.","operationId":"patch_insight_wording_api_v1_demo_studio_insights__insight_id__patch","parameters":[{"name":"insight_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Insight Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsightWordingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/freeze":{"post":{"tags":["demo-studio"],"summary":"Freeze Environment","description":"Freeze or unfreeze. Owner/admin.\n\nA plain 200, not a 202: this writes one column and there is nothing to\npoll. An operator reaching for this is usually about to start a call.","operationId":"freeze_environment_api_v1_demo_studio_environments__environment_id__freeze_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreezeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/health":{"get":{"tags":["demo-studio"],"summary":"Environment Health","description":"The pre-dial health check. Owner/admin.\n\nOne line per probe, each with a verdict and a sentence saying what to do.\nCurl-able on purpose: the same endpoint answers \"is this demo ready\" for a\nperson about to dial in and for CI.\n\nThe caller's own Authorization header is relayed to data-api for the anchor\nprobe, so that check passes through the SAME tenancy gate the dashboard\ndoes. A probe that used a service-role warehouse read would answer a\ndifferent question from the one the demo will ask.","operationId":"environment_health_api_v1_demo_studio_environments__environment_id__health_get","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/pack":{"get":{"tags":["demo-studio"],"summary":"Get Environment Pack","description":"The stored manifest, in full. Owner/admin.\n\nThe brand kit, the data grid and the persona editor all render from this\none payload, because all three are views on the same document. Shipping it\nwhole rather than three shaped endpoints is what keeps the frontend's model\nof a demo identical to the server's.","operationId":"get_environment_pack_api_v1_demo_studio_environments__environment_id__pack_get","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/pack/edits":{"post":{"tags":["demo-studio"],"summary":"Edit Environment Pack","description":"Apply pack edits and re-materialize. Owner/admin. 202 unless `dry_run`.\n\nThis is the ONE write path behind the brand kit, the data grid and the\npersona editor. Nothing on those panels writes a store; they all assemble\nedit ops and post them here.\n\n**The edits are applied and the whole manifest re-validated synchronously,\nbefore the 202.** A batch that would leave the pack invalid — a campaign in\nno group, a colour that is not a hex triple, a scoped admin — is a 422 the\noperator sees while their form is still open, not a job that fails two\nminutes later in a row nobody is watching. The same reasoning as\n`create_environment`'s pack validation, for the same reason.\n\n`dry_run` returns that validation plus the affected-insights warning and\nstops there, which is what the panel calls to render \"this will change N\nthings and put M cards in question\" before the operator commits.","operationId":"edit_environment_pack_api_v1_demo_studio_environments__environment_id__pack_edits_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackEditsRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/budget":{"put":{"tags":["demo-studio"],"summary":"Set Environment Budget","description":"Set this environment's monthly LLM budget. Owner/admin.\n\nNOT frozen-gated. A freeze protects the demo's CONTENT; a ceiling is an\noperator's own spending control, and being unable to raise it while an\nenvironment is pinned for a call is exactly the wrong time to be unable to\nraise it.","operationId":"set_environment_budget_api_v1_demo_studio_environments__environment_id__budget_put","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BudgetRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/personas":{"get":{"tags":["demo-studio"],"summary":"List Personas","description":"The environment's personas and share links. Owner/admin.\n\nNo generated or typed password is here, because none is stored. The one\nexception (STR-1184): a DEFAULT-kind share link returns its stored default\npassword (`<short>-demo-<year>`), a courtesy lock whose secret half is the\nshare code, so Copy invite works any day. Any other working login comes from\nthe rotate endpoint, at the moment somebody needs one.","operationId":"list_personas_api_v1_demo_studio_environments__environment_id__personas_get","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["demo-studio"],"summary":"Add Environment Persona","description":"Add ONE login to an environment. Owner/admin. Returns its password ONCE.\n\n**Not a pack edit, and the difference is the whole point.** Every other\npersona change on this surface queues a `set_persona` op and rebuilds the\ntenant — two to four minutes, during which `_write_personas` mints a fresh\npassword for every persona it touches. Adding a fifth login that way would\nsilently invalidate the four already handed out, which is the last thing an\noperator needs an hour before a call. A persona is a leaf of the FK graph, so\nthis writes the pack and then materializes exactly that one row.\n\nIt still PERSISTS INTO THE PACK, which is the requirement that makes it more\nthan a convenience: a reset or a clone carries the added login, because the\npack is the source of truth for what an environment is. Since STR-1174 a\nreset and the nightly re-anchor also keep its PASSWORD — this is what the\nShare read-only access dialog calls, and a login in a prospect's inbox has to\nwork tomorrow. Only the rotate endpoint changes it.\n\nRate-limited by the credential bucket in `main.py` alongside the rotate\nendpoint — it is a write AND it hands back a working password — and\naudit-logged on the success path for the same reason.","operationId":"add_environment_persona_api_v1_demo_studio_environments__environment_id__personas_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddPersonaRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/personas/{persona_key}/new-link":{"post":{"tags":["demo-studio"],"summary":"New Persona Link","description":"A share login gets a new link; the old one stops working, the password\nstays (STR-1184 \"New link\"). Refused while frozen or rebuilding.","operationId":"new_persona_link_api_v1_demo_studio_environments__environment_id__personas__persona_key__new_link_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"persona_key","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"title":"Persona Key"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NewLinkRequest"},{"type":"null"}],"title":"Request"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/personas/{persona_key}":{"delete":{"tags":["demo-studio"],"summary":"Remove Environment Persona","description":"Remove ONE login, from the pack AND from auth. Owner/admin.\n\nRotating a password away leaves the account, its membership and its place in\nthe demo's member list intact; this is the verb that actually ends a login.\nNo typed confirmation: unlike a delete of an environment, this destroys no\ncurated material and the pack can mint an equivalent login back in one dialog.","operationId":"remove_environment_persona_api_v1_demo_studio_environments__environment_id__personas__persona_key__delete","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"persona_key","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"title":"Persona Key"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/operators":{"post":{"tags":["demo-studio"],"summary":"Create Demo Operator","description":"Mint a colleague an operator account. Owner/admin. Password shown ONCE.\n\n**Why this exists next to a perfectly good invite flow.** Settings → Members\ncovers it on any stack with mail. The demo stack has none: its Railway\nenvironment still carries the office365 SMTP variables production moved off\n(STRATOS-API-85), so an invite may never arrive and the failure is silent.\nRather than make a salesperson wait on an email nobody can prove was sent,\nthis mints the account directly — the same shown-once, stored-nowhere posture\nevery other credential on this surface has.\n\n**No new authorization.** The new account is an `admin` of one demo agency,\nwhich is exactly what `DemoLifecycle._admit_operator` already grants the\ncreator of an environment, and admin is the tier `DEMO_MANAGE` needs. From\nthere they can create and clone environments and are auto-admitted to what\nthey make.\n\nTakes no environment, so — like `/packs/golden` and `/composer/doors` — it\nauthorizes on the caller's BEST manageable membership when no `agency_id` is\ngiven, rather than on a target row it does not have.","operationId":"create_demo_operator_api_v1_demo_studio_operators_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOperatorRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/insights":{"get":{"tags":["demo-studio"],"summary":"List Environment Insights","description":"The environment's deck, in the order a persona will see it. Owner/admin.\n\nIncludes DISCARDED cards, which the live surface does not. That is the\npoint of a curation list: \"show me the one I hid so I can put it back\" is\nthe second thing anyone asks after hiding one, and a list that only shows\nwhat is visible makes un-hiding impossible.","operationId":"list_environment_insights_api_v1_demo_studio_environments__environment_id__insights_get","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/capture":{"post":{"tags":["demo-studio"],"summary":"Capture Environment","description":"Fold the live curated deck and board back into the stored pack.\n\nOwner/admin. SYNCHRONOUS, unlike the other write verbs, because it reads\nfour small tables and writes one column — there is no tenant to rebuild, so\na job row and a poll would be ceremony around something that finishes\nbefore the response does.\n\nFrom here on, reset restores THIS deck. That is the whole point: curation\nthat is not captured survives only until the next reset, which is the\nfailure that makes an operator stop trusting reset.","operationId":"capture_environment_api_v1_demo_studio_environments__environment_id__capture_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/board/reset":{"post":{"tags":["demo-studio"],"summary":"Reset Environment Board","description":"Put the board back, without touching data or branding. Owner/admin.\n\nThe light reset. After a rehearsal that moved cards around, a full reset\nwould also rebuild every persona password and re-run the generator over the\nentire entity tree, which is minutes of work and a fresh set of credentials\nto redistribute. This is six tables.","operationId":"reset_environment_board_api_v1_demo_studio_environments__environment_id__board_reset_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/regenerate":{"post":{"tags":["demo-studio"],"summary":"Regenerate Environment Insights","description":"Run the engine against this demo. Owner/admin. Expensive.\n\nThree gates before anything is dispatched, in this order:\n\n  1. `DEMO_MANAGE` on the environment's agency.\n  2. the environment is not frozen.\n  3. the environment is under its monthly budget (STR-733).\n\nBudget LAST because it is the only one that can be resolved by an operator\naction on this page: being told \"you are over budget\" is useful, being told\nit before \"you do not have permission\" is not.\n\n**Check-before-spend applies here and to nothing else that a demo does.** A\npersona using Stratbot mid-demo decrements the same ledger and is never\nblocked: a demo dying mid-pitch in front of a prospect is a far worse\noutcome than a few dollars of overage, and the person who would have to\nexplain it is not the person who set the ceiling.\n\nThe dispatch goes through the engine's ordinary `run-for-client` door with\nthe operator's own JWT, so a demo run is a real run in every respect the\nproduct can observe. That is the point: a curated deck must be engine\noutput revised by sales, not prose somebody typed.","operationId":"regenerate_environment_insights_api_v1_demo_studio_environments__environment_id__regenerate_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegenerateRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/insights/draft":{"post":{"tags":["demo-studio"],"summary":"Draft Environment Insight","description":"Draft one insight card with AI, for REVIEW. Owner/admin. Writes nothing.\n\nThe same gates as Describe a change (permission, freeze, budget; share\nlogins and personas never reach this router), the environment must be a\ndemo agency's, and drafts are rate-limited per environment. Publishing is\nthe `add_insight` op through `POST /pack/edits`; discarding is no call.","operationId":"draft_environment_insight_api_v1_demo_studio_environments__environment_id__insights_draft_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsightDraftRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/insights/check":{"post":{"tags":["demo-studio"],"summary":"Check Environment Insight","description":"Re-check an edited insight card's numbers. Owner/admin. No model call.\n\nReturns `{flagged, verified, preview}` against the same metrics table the\ndraft used and the publish uses, so what the salesperson sees before \"Add\nto demo\" is what the publish will decide. Writes nothing; demo agencies\nonly; refused while frozen like every Demo Studio verb that edits content.","operationId":"check_environment_insight_api_v1_demo_studio_environments__environment_id__insights_check_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsightCheckRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/composer/doors":{"get":{"tags":["demo-studio"],"summary":"List Composer Doors","description":"The prompt doors and what each owns. Owner/admin.\n\nServed rather than mirrored in the frontend so the panel cannot offer a\ndoor the server does not have — the same reason `/pack` returns `known_ops`.","operationId":"list_composer_doors_api_v1_demo_studio_composer_doors_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/compose":{"post":{"tags":["demo-studio"],"summary":"Compose Pack Edits","description":"Turn a prompt into a validated plan of pack edits. Owner/admin.\n\nA plain 200 and NOT a 202: nothing is written, so there is no job to poll.\nThe operator reviews the diff and presses Apply, which is\n`POST /pack/edits` with the returned ops.","operationId":"compose_pack_edits_api_v1_demo_studio_environments__environment_id__compose_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComposeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/compose/stream":{"post":{"tags":["demo-studio"],"summary":"Compose Pack Edits Stream","description":"Streaming twin, one frame per tool call. Owner/admin.\n\nFrames: {\"type\":\"status\",\"label\"} -> {\"type\":\"tool\",\"tool\",\"ok\",\"detail\"}*\n-> exactly one terminal {\"type\":\"result\",\"data\":<the /compose payload>} or\n{\"type\":\"error\",\"code\",\"message\"}.\n\n**Every gate runs BEFORE the first byte**, which is why `_authorize_compose`\nis called out here rather than inside the generator: once the response has\nstarted, a 403 is no longer available and a denial would have to be\nsmuggled into the body as an error frame that looks like a failure. A\nrefusal must be a refusal.","operationId":"compose_pack_edits_stream_api_v1_demo_studio_environments__environment_id__compose_stream_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComposeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/packs/golden":{"get":{"tags":["demo-studio"],"summary":"List Packs","description":"The golden-pack library. Owner/admin (STR-757).\n\nThe create dialog's empty state has always said \"create one from a golden\npack\" while the dialog offered only a raw-JSON paste. This is the\ncatalogue that makes the promise true.\n\nRead from `packs/golden/*.json` on EVERY request rather than cached: the\nlibrary is a directory in the source tree, a deploy changes it, and a cache\nwould mean a newly-added pack needs a restart to appear. It is a handful of\nsmall files.","operationId":"list_packs_api_v1_demo_studio_packs_golden_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/uploads/analyze":{"post":{"tags":["demo-studio"],"summary":"Analyze Upload","description":"Propose a column mapping for a spreadsheet. Owner/admin. Writes NOTHING.\n\nThe proposal is shown to the operator to confirm or override BEFORE\nanything loads, which is why this is a separate call rather than a step\ninside the load: a mapping is a guess, and a guess applied to a prospect's\nown numbers without being seen is how a demo shows the wrong figure.","operationId":"analyze_upload_api_v1_demo_studio_environments__environment_id__uploads_analyze_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_analyze_upload_api_v1_demo_studio_environments__environment_id__uploads_analyze_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo-studio/environments/{environment_id}/uploads/load":{"post":{"tags":["demo-studio"],"summary":"Load Upload","description":"Load a spreadsheet into the pack. Owner/admin. 202 unless `dry_run`.\n\n**The FULL file is re-parsed here**, deterministically and with no model in\nthe path. `rows_read` in the gap report is the count from the source, so an\noperator can check it against what the export said — which is the ticket's\n\"full-file load count equals source row count\" criterion, checkable rather\nthan asserted.\n\nRides the ordinary pack-edit job: one `load_series` op through\n`apply_pack_edits`, so the result is validated by the same schema and\nmaterialized by the same path as every other edit.","operationId":"load_upload_api_v1_demo_studio_environments__environment_id__uploads_load_post","parameters":[{"name":"environment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Environment Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_load_upload_api_v1_demo_studio_environments__environment_id__uploads_load_post"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/me":{"get":{"tags":["console"],"summary":"Read Me","description":"The console principal for the caller's session.","operationId":"read_me_admin_v1_me_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Me Admin V1 Me Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/registry":{"get":{"tags":["console"],"summary":"Read Registry","description":"Every client this caller may see, worst first.\n\nTHE SCOPE IS AN ARGUMENT, NOT A BRANCH. `require_listing` returns the scope\nattached to the caller's `console.read` grant, and that scope goes straight\ninto the service, which derives its filters from it. An unrestricted reader\nand an agency-bound reader run these same four lines; nothing here asks how\nwide the grant is. That is why there is no \"staff sees everything\" path to\nget wrong, and why a narrowed grant needs no new code.\n\n`unavailable` names the sub-reads that failed. It is a list rather than an\nomission because the screen has to tell \"this client has never ingested\"\nfrom \"we could not read freshness at all\", and a missing key cannot say\nwhich of those happened. `frozenset` is not JSON, so it is sorted into a\nlist — sorted rather than arbitrary so the response is stable to diff.","operationId":"read_registry_admin_v1_registry_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Registry Admin V1 Registry Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/agencies/{agency_id}/clients/{client_id}/zdr-fence":{"get":{"tags":["console"],"summary":"Read Zdr Fence","description":"This client's fence, where it was set, and whether you may change it.\n\n`console.read` reads; `console.settings_write` writes. Reading is one\ngrant across the console, so a read-only staff member sees the value and\nits provenance — and `may_write` false, which is what makes the control\nabsent rather than disabled on the screen.","operationId":"read_zdr_fence_admin_v1_agencies__agency_id__clients__client_id__zdr_fence_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Zdr Fence Admin V1 Agencies  Agency Id  Clients  Client Id  Zdr Fence Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["console"],"summary":"Set Zdr Fence","description":"Set the fence, and record who did it in the same request.","operationId":"set_zdr_fence_admin_v1_agencies__agency_id__clients__client_id__zdr_fence_put","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"X-Request-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FenceWrite"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Set Zdr Fence Admin V1 Agencies  Agency Id  Clients  Client Id  Zdr Fence Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/agencies/{agency_id}/clients/{client_id}/setup":{"get":{"tags":["console"],"summary":"Read Client Setup","operationId":"read_client_setup_admin_v1_agencies__agency_id__clients__client_id__setup_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Client Setup Admin V1 Agencies  Agency Id  Clients  Client Id  Setup Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/agencies/{agency_id}/setup":{"get":{"tags":["console"],"summary":"Read Agency Setup","operationId":"read_agency_setup_admin_v1_agencies__agency_id__setup_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Agency Setup Admin V1 Agencies  Agency Id  Setup Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/agencies/{agency_id}/clients/{client_id}/setup/{key}":{"put":{"tags":["console"],"summary":"Set Client Setting","operationId":"set_client_setting_admin_v1_agencies__agency_id__clients__client_id__setup__key__put","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"X-Request-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettingWrite"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Set Client Setting Admin V1 Agencies  Agency Id  Clients  Client Id  Setup  Key  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/agencies/{agency_id}/setup/{key}":{"put":{"tags":["console"],"summary":"Set Agency Setting","operationId":"set_agency_setting_admin_v1_agencies__agency_id__setup__key__put","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"X-Request-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SettingWrite"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Set Agency Setting Admin V1 Agencies  Agency Id  Setup  Key  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/environment":{"get":{"tags":["console"],"summary":"Read Environment","operationId":"read_environment_admin_v1_environment_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Environment Admin V1 Environment Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/agencies/{agency_id}/switches":{"get":{"tags":["console"],"summary":"Read Agency Switches","operationId":"read_agency_switches_admin_v1_agencies__agency_id__switches_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Agency Switches Admin V1 Agencies  Agency Id  Switches Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/agencies/{agency_id}/clients/{client_id}/switches":{"get":{"tags":["console"],"summary":"Read Client Switches","operationId":"read_client_switches_admin_v1_agencies__agency_id__clients__client_id__switches_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Client Switches Admin V1 Agencies  Agency Id  Clients  Client Id  Switches Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/environment/settings/{key}":{"put":{"tags":["console"],"summary":"Set Global Setting","operationId":"set_global_setting_admin_v1_environment_settings__key__put","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"X-Request-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalWrite"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Set Global Setting Admin V1 Environment Settings  Key  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/agencies/{agency_id}/switches/{key}":{"put":{"tags":["console"],"summary":"Set Agency Switch","operationId":"set_agency_switch_admin_v1_agencies__agency_id__switches__key__put","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"X-Request-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScopedWrite"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Set Agency Switch Admin V1 Agencies  Agency Id  Switches  Key  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/agencies/{agency_id}/clients/{client_id}/switches/{key}":{"put":{"tags":["console"],"summary":"Set Client Switch","operationId":"set_client_switch_admin_v1_agencies__agency_id__clients__client_id__switches__key__put","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"X-Request-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScopedWrite"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Set Client Switch Admin V1 Agencies  Agency Id  Clients  Client Id  Switches  Key  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/setup/agencies":{"get":{"tags":["console"],"summary":"List Setup Agencies","description":"Agencies this principal may place a client into.\n\n`require_unscoped` is NOT used here — an agency-bound principal may place\na client into the one agency it holds, and refusing the picker would hide\nthe only option it has. The scope the check returns decides the rows, the\nsame way `read_client_registry` derives its filters.","operationId":"list_setup_agencies_admin_v1_setup_agencies_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Setup Agencies Admin V1 Setup Agencies Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/setup/account":{"post":{"tags":["console"],"summary":"Create Account","description":"Perform the whole setup and return its progress list.\n\n200 even for a partial failure, deliberately. The body carries a per-step\noutcome and the ids of everything that WAS created; a 4xx or 5xx would\ntell the console the run did not happen, and the operator would create the\nagency a second time. A run that performed no step at all still returns\nits reasons.\n\nA `ConsoleAuditError` is the one thing that does propagate: a resource\nwritten with no audit row must not be reported as a success. See\n`services/console/audit.py`.","operationId":"create_account_admin_v1_setup_account_post","parameters":[{"name":"x-request-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Account Admin V1 Setup Account Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/setup/runs/{idempotency_key}":{"get":{"tags":["console"],"summary":"Read Setup Run","description":"What the audit store says this run did.\n\nTHE READ-BACK IS FROM THE AUDIT STORE, not from a cache of what the\nhandler returned. The ticket asks each step to \"read the result back\", and\nreading back the handler's own memory would confirm nothing — this is the\nonly version that would notice a step whose row was never written.\n\nRows are filtered through the caller's scope AFTER the read rather than in\nthe query, because a run key is not a tenant: a key is an opaque token\nanyone could present, so the rows it names must be checked against the\ncaller's scope on the subject column. `permits_agency` runs for every\nprincipal including an unscoped one — there is no branch that skips it.\n\nA row with NO subject agency (a refused `agency.create`, which never got\none) is shown only to an unscoped principal. An agency-bound caller has no\nagency to match it against, and showing it on the grounds that it names\nnobody is how a cross-tenant leak gets argued for.","operationId":"read_setup_run_admin_v1_setup_runs__idempotency_key__get","parameters":[{"name":"idempotency_key","in":"path","required":true,"schema":{"type":"string","title":"Idempotency Key"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Setup Run Admin V1 Setup Runs  Idempotency Key  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/clients/{client_id}/magenta":{"get":{"tags":["console"],"summary":"Read Magenta","description":"Every campaign group of one client, with its schedule and the gates.","operationId":"read_magenta_admin_v1_clients__client_id__magenta_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Magenta Admin V1 Clients  Client Id  Magenta Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/clients/{client_id}/magenta/groups/{campaign_group_id}/runs":{"get":{"tags":["console"],"summary":"Read Runs","description":"One campaign group's run history: status, duration, cost, gate outcome.","operationId":"read_runs_admin_v1_clients__client_id__magenta_groups__campaign_group_id__runs_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":25,"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Runs Admin V1 Clients  Client Id  Magenta Groups  Campaign Group Id  Runs Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/clients/{client_id}/magenta/groups/{campaign_group_id}/schedule":{"put":{"tags":["console"],"summary":"Put Schedule","description":"Create or change one campaign group's schedule.\n\nAn upsert on `(client_id, campaign_scope)` — the pair the unique index\nenforces — so a re-save replaces rather than adding a second schedule, i.e.\na second charged run every tick.","operationId":"put_schedule_admin_v1_clients__client_id__magenta_groups__campaign_group_id__schedule_put","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"x-request-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Put Schedule Admin V1 Clients  Client Id  Magenta Groups  Campaign Group Id  Schedule Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/clients/{client_id}/magenta/groups/{campaign_group_id}/schedule/enabled":{"post":{"tags":["console"],"summary":"Set Enabled","description":"Pause or resume one campaign group's schedule.\n\nResuming advances `next_run_at` to the next slot rather than leaving the\nstale one in place — see `magenta.set_schedule_enabled` for why that is the\ndifference between resuming and starting a charged run immediately.","operationId":"set_enabled_admin_v1_clients__client_id__magenta_groups__campaign_group_id__schedule_enabled_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Campaign Group Id"}},{"name":"x-request-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnabledBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Set Enabled Admin V1 Clients  Client Id  Magenta Groups  Campaign Group Id  Schedule Enabled Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/agencies/{agency_id}/settings":{"get":{"tags":["console"],"summary":"Read Settings","description":"Every setting for one agency, each carrying where it is set.\n\nA REFUSED read is audited; a successful one is not. The table anticipates\nread rows, but recording every page view of a screen staff keep open would\nbury the writes the audit exists to find — while a refusal is a fact about\nreach that nothing else records.","operationId":"read_settings_admin_v1_agencies__agency_id__settings_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"x-request-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Settings Admin V1 Agencies  Agency Id  Settings Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/agencies/{agency_id}/settings/models/{field}":{"put":{"tags":["console"],"summary":"Write Model Setting","description":"Set ONE model field for this agency: the account default, or one feature.\n\nBody:\n    value            the `provider:model` slug, or `null` to clear the\n                     field and let the layer below it decide.\n    if_updated_at    the `updated_at` the editor was looking at, or `null`\n                     when they were looking at an agency with no row yet.\n                     Required, not optional.\n    idempotency_key  makes a retried submit one row and one write.\n\n`if_updated_at` is a CONCURRENCY CHECK, not ceremony. `save_settings` is a\nfull-row upsert, so two staff editing two different fields from two stale\nforms would otherwise have the later save silently revert the earlier one,\nwith both audit rows reading `ok`. Comparing against a fresh strict read in\nthis request narrows that window to the microseconds between the read and\nthe upsert; it does NOT close it, and closing it needs a conditional update\nin the table rather than a check in the application. Narrowed-and-stated is\nworth more here than unstated.\n\nTHE BEFORE VALUE IS READ, NOT TRUSTED. It comes from `read_settings`, which\nis the STRICT read that raises rather than degrading to the platform\ndefault — a form rendered over a failed read would otherwise save defaults\nover an admin's real choice and record them as the before.","operationId":"write_model_setting_admin_v1_agencies__agency_id__settings_models__field__put","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"field","in":"path","required":true,"schema":{"type":"string","title":"Field"}},{"name":"x-request-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Write Model Setting Admin V1 Agencies  Agency Id  Settings Models  Field  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/activity":{"get":{"tags":["console"],"summary":"Read Activity","description":"The console-action timeline this principal may read.\n\n`result` repeats (`?result=refused&result=failed`). The vocabulary is\nclosed; an unknown value is a 400 rather than a filter that matches\nnothing, because a filter matching nothing and an environment in which\nnothing happened look identical on this screen.","operationId":"read_activity_admin_v1_activity_get","parameters":[{"name":"agency_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Agency Id"}},{"name":"client_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Client Id"}},{"name":"actor","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":320},{"type":"null"}],"title":"Actor"}},{"name":"action","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Action"}},{"name":"capability","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Capability"}},{"name":"result","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Result"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Since"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Until"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":500,"minimum":1},{"type":"null"}],"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Activity Admin V1 Activity Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/users":{"get":{"tags":["console"],"summary":"List Users","description":"Every membership and open invite the caller's scope permits.\n\nBehind `console.read`, not `console.user_admin`, because the spec's\n*Refused* state is a staff member seeing the list with the controls\nabsent. `may_write` in the response is what the screen renders them from.\n\nWhen `agency_id` is given the check NAMES it. When it is not, the read\nspans agencies and `require_unscoped` says so explicitly — the scope it\nreturns is what the service derives its filters from, so an agency-bound\nprincipal gets its own agencies through the same code an unrestricted one\nruns.","operationId":"list_users_admin_v1_users_get","parameters":[{"name":"agency_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Agency Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Users Admin V1 Users Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/users/auth-state":{"post":{"tags":["console"],"summary":"Read Users Auth State","description":"MFA enrolment and last sign-in for a set of users (STR-2331).\n\nA POST for a read, deliberately: the id set is up to fifty UUIDs and a\nquery string carrying them is a URL-length failure waiting on a wide\nagency. Nothing is mutated and no audit row is written — this is a read.\n\nBehind `console.user_admin` and scoped to a NAMED agency, which is what\nstops the endpoint from being an oracle: an operator may only ask about\npeople who are members of an agency they administer. Ids that are not\nmembers come back in `out_of_scope` rather than being answered, and\nrather than failing the whole call — a user removed between the list read\nand this one must not blank the screen.","operationId":"read_users_auth_state_admin_v1_users_auth_state_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthStateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Users Auth State Admin V1 Users Auth State Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/users/{user_id}/membership":{"patch":{"tags":["console"],"summary":"Update Membership","description":"Change a member's role, their client scope, or both.\n\nTHE CLIENT DIMENSION IS CHECKED PER CLIENT, and it is the only write here\nthat names one. A console grant scoped to a subset of an agency's clients\nmust not be able to hand a user access to a client outside that subset,\nand the only way to enforce that is to check each id — `require` with no\n`client_id` passes for any client in the agency.\n\nBoth ids are also checked against the AGENCY: a client belonging to some\nother agency would be a cross-tenant grant written through a form that\nlooks legitimate, and `ConsoleScope` cannot catch it because it does not\nknow which agency a client belongs to.","operationId":"update_membership_admin_v1_users__user_id__membership_patch","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"X-Request-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MembershipUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Membership Admin V1 Users  User Id  Membership Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/users/{user_id}/password-reset":{"post":{"tags":["console"],"summary":"Send Password Reset","description":"Send a password-reset email. The console never SETS a password.\n\nThere is no route in this module that writes a password, and\n`auth.admin.update_user_by_id` is deliberately not imported. The\ndifference is who ends up holding the credential: an operator who sets one\ncan sign in as the user, and every action after that is attributed to the\nuser. A reset link goes to the address on the ACCOUNT and is useful only\nto whoever reads that mailbox.\n\nThe address is read from `auth.users`, never from `public.users`, which\nits owner can edit.","operationId":"send_password_reset_admin_v1_users__user_id__password_reset_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"X-Request-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordResetRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Send Password Reset Admin V1 Users  User Id  Password Reset Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/users/{user_id}/mfa-reset":{"post":{"tags":["console"],"summary":"Reset User Mfa","description":"Remove every MFA factor on an account, after an identity check.\n\nWHAT THE CONSOLE CAN VERIFY, AND WHAT IT CANNOT\n───────────────────────────────────────────────\nIt can establish, by machine, all of:\n\n  * the actor is a console identity on an `aal2` session (the step-up is\n    checked on the dependency, not on the browser);\n  * that identity holds `console.user_admin` over THIS agency;\n  * the target is a member of that agency;\n  * what the account's factor state was before and after.\n\nIt cannot establish that the person who ASKED for the reset is the account\nholder. The console has no voice channel, no second factor to fall back\non — that is the thing being removed — and no out-of-band confirmation it\ncan perform itself. So the identity check is HUMAN, and this endpoint's\njob is to make the human's claim specific and permanent rather than to\npretend it verified something.\n\nThat is why `verification_method` is a closed vocabulary and not free\ntext. \"A reason was given\" is not reviewable; \"authorised on a video call\"\nversus \"authorised by the manager\" versus \"other\" is. `other` must carry a\nnote, because `other` alone records nothing.\n\nThe action is ONE-WAY: the factors are gone, the account signs in with a\npassword alone until it enrols again, and nothing here can put the old\nauthenticator back.","operationId":"reset_user_mfa_admin_v1_users__user_id__mfa_reset_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"X-Request-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MfaResetRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Reset User Mfa Admin V1 Users  User Id  Mfa Reset Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/users/{user_id}/membership/removal":{"post":{"tags":["console"],"summary":"Remove User Membership","description":"Remove a membership, with STR-513's semantics.\n\nThe mechanics are `services/membership_removal.py` — the same code the\ntenant endpoint runs, so there is one answer to \"what does removing\nsomeone actually do\" rather than two that drift.\n\nTHE GUARDRAILS THAT DIFFER, AND WHY\n───────────────────────────────────\nThe tenant endpoint refuses self-removal and refuses an admin removing an\nowner. Neither applies here and neither is silently dropped:\n\n  * self-removal is impossible by construction — a console identity holds\n    no agency membership, so the actor can never be the target;\n  * \"an admin may not remove an owner\" ranks two AGENCY roles, and the\n    console actor holds none. An operator with `console.user_admin` over\n    the agency may remove an owner, provided another owner remains. That\n    is a deliberate widening of what the dashboard allows, and it is the\n    reason the agency-wide invariant below is still enforced.\n\n`fallback_owner_id=None` for the dashboard hand-off: the tenant endpoint\nfalls back to the acting admin, and here the acting identity is staff.\nGiving a staff identity ownership of a tenant dashboard would collapse the\nseparation two constraint triggers exist to enforce. With no owner left,\nthe dashboards stay where they are and the response says\n`reports_transfer_unavailable` rather than implying a transfer happened.","operationId":"remove_user_membership_admin_v1_users__user_id__membership_removal_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"X-Request-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MembershipRemoval"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Remove User Membership Admin V1 Users  User Id  Membership Removal Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/invites/{invite_id}/resend":{"post":{"tags":["console"],"summary":"Resend Invite","description":"Resend an invite, reusing the tenant flow's semantics.\n\nExpire the old row, mint a new token, preserve the original role and\nclient-scope intent, and mail it — exactly what `routers/invites.py`\ndoes, because an invite resent from the console must grant what the\noriginal one promised.\n\n`invited_by` is NOT rewritten to the console identity. It is an FK to\n`public.users`, which a staff identity deliberately does not appear in as\nan agency member, and the invitee's email names the person who invited\nthem. Who resent it is recorded where that belongs: the audit row.","operationId":"resend_invite_admin_v1_invites__invite_id__resend_post","parameters":[{"name":"invite_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Invite Id"}},{"name":"X-Request-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteAction"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Resend Invite Admin V1 Invites  Invite Id  Resend Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/invites/{invite_id}/revoke":{"post":{"tags":["console"],"summary":"Revoke Invite","description":"Revoke an invite by expiring it — the tenant flow's `cancel_invite`.\n\nExpiry rather than deletion, so the row that proves someone was invited\nsurvives the revocation. The token stops working either way.","operationId":"revoke_invite_admin_v1_invites__invite_id__revoke_post","parameters":[{"name":"invite_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Invite Id"}},{"name":"X-Request-ID","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Request-Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteAction"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Revoke Invite Admin V1 Invites  Invite Id  Revoke Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/agencies/{agency_id}/clients/{client_id}/health":{"get":{"tags":["console"],"summary":"Read Health","description":"This client's campaigns, connections and recent uploads, with health.","operationId":"read_health_admin_v1_agencies__agency_id__clients__client_id__health_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Health Admin V1 Agencies  Agency Id  Clients  Client Id  Health Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/v1/pipeline":{"get":{"tags":["console"],"summary":"Read Pipeline","description":"The last nightly processing run, its dbt build, and recent failures.","operationId":"read_pipeline_admin_v1_pipeline_get","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Read Pipeline Admin V1 Pipeline Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/insights/user-card":{"post":{"tags":["insights"],"summary":"Create User Card","description":"Create ONE operator-authored insight card from a watchout.","operationId":"create_user_card_api_v1_insights_user_card_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserCardRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/insights/{insight_id}/feedback":{"post":{"tags":["insights"],"summary":"Submit Insight Feedback","description":"Record graded feedback on one insight card (STR-1044).\n\nGated `CLIENT_VIEW`, not `CLIENT_MUTATE`, and that is deliberate: an\nopinion about OUR output is not a mutation of the client's data, and the\npeople who read insights most are viewers. Restricting this to editors\nwould cost exactly the responses the preference loop needs. A viewer can\nwrite a feedback row and still nothing else.\n\nTwo things happen here that the database cannot do for itself:\n\n* the insight is resolved under the CALLER's client scope, so a rating for\n  an insight belonging to another client 404s rather than leaking that it\n  exists (the composite FK would refuse the write anyway — this refuses it\n  earlier, and without disclosing);\n* the engine's own claim is SNAPSHOTTED onto the row. Calibration compares\n  a human score against what the engine asserted, and `categorize(force=True)`\n  can regenerate that assertion — so reading priority at analysis time\n  would silently compare today's score against tomorrow's claim.","operationId":"submit_insight_feedback_api_v1_insights__insight_id__feedback_post","parameters":[{"name":"insight_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Insight Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsightFeedbackRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["insights"],"summary":"Read Insight Feedback State","description":"Whether the CALLING USER has already rated this insight (STR-2186).\n\nThe rating is asked once, after the operator acts, so the asking surfaces\nneed this answer, and `insight_feedback` has no browser policy to read it\nfrom. It carries a yes or no and no scores: nothing the dashboard renders\nneeds them. Per user, like the seen marker. An insight outside this client\nreads as not rated, so the answer discloses nothing about it.","operationId":"read_insight_feedback_state_api_v1_insights__insight_id__feedback_get","parameters":[{"name":"insight_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Insight Id"}},{"name":"client_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/insights/impressions":{"post":{"tags":["insights"],"summary":"Record Insight Impressions","description":"Record that these insights were seen (STR-1044).\n\nWHY THIS EXISTS. Measured on the production mirror the day this shipped:\n2,436 insights published, 4 ever acted on or skipped, 909 action steps\nstill `pending`, last completion two months ago, and ZERO rows in every\nfeedback table we had already built. Without impressions there is no way\nto tell \"the insights are not worth acting on\" from \"nobody opened them\",\nand those need opposite fixes.\n\nGated `CLIENT_VIEW` — the same tier as seeing the insight in the first\nplace, which is the only thing being reported.\n\nIds that do not belong to `client_id` are silently SKIPPED by the SQL\nfunction rather than refused: a batch is assembled by a browser from\nwhatever is on screen, and one stale card must not discard the other\ntwenty-nine impressions. The response says how many landed, so a caller\n(and the metric) can see the difference.","operationId":"record_insight_impressions_api_v1_insights_impressions_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsightImpressionsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["insights"],"summary":"List Seen Insights","description":"The read half of the impression beacon (STR-1044): when this client's\ninsights were first/last seen by the CALLING USER, and whether each was\nopened — the insights page reads it once per client per page load to mark\na repeat card as a repeat instead of letting unchanged content resurface\nlooking like new work.\n\nGated `CLIENT_VIEW`, the same tier as seeing the insight at all. Per user:\nthe marker answers \"have I read this\", never \"has anyone read this\".","operationId":"list_seen_insights_api_v1_insights_impressions_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/run-for-client":{"post":{"tags":["intelligence"],"summary":"Run For Client","description":"Trigger an on-demand Magenta run for the selected client. EDITOR+ (STR-505).\n\nGated at apps/api (EDITOR+ via `INTELLIGENCE_RUN_SIMPLE`, scoped to the\nclient) BEFORE the engine is called, then forwarded with the caller's JWT for\nthe engine's own re-check. Returns the engine's 202 {engagement_id, run_id}.\n\nSTR-505: this used to be `INTELLIGENCE_RUN` (owner/admin). Editors now start\nruns on the named preset tiers. The capability only says \"may start a run\" —\nit does NOT authorize configuring one. The engine refuses every advanced\nfield (`model_config` / `engine_profile` / `orchestration_v2` / `run_knobs` /\n`experiment` / `force`) — and any tier in the engine's `ADMIN_ONLY_TIERS`, empty today — unless the caller also holds\n`INTELLIGENCE_ADMIN`, so an editor cannot escalate by hand-crafting a body.","operationId":"run_for_client_api_v1_intelligence_run_for_client_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunForClientRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/run-cost-estimate":{"post":{"tags":["intelligence"],"summary":"Run Cost Estimate","description":"Pre-run cost estimate for a Magenta run under a model selection (STR-181).\nSame gate as the trigger — the estimate exists to inform that decision, so\nanyone who may run must be able to price it (STR-505: EDITOR+, was\nowner/admin). The engine computes it from llm_call history + substrate size —\nno LLM call, and no API key required.","operationId":"run_cost_estimate_api_v1_intelligence_run_cost_estimate_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunCostEstimateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/run-costs":{"get":{"tags":["intelligence"],"summary":"Client Run Costs","description":"Past Magenta runs for a client with their actual LLM spend (STR-181).\nAdmin-gated like the trigger; the engine aggregates `llm_call` per\nengagement and re-checks tenant RBAC on the forwarded JWT.","operationId":"client_run_costs_api_v1_intelligence_clients__client_id__run_costs_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/provenance/{execution_log_id}":{"get":{"tags":["intelligence"],"summary":"Number Provenance","description":"The re-runnable SOURCE behind ONE Magenta number (STR-377 — verifiable cards).\n\nThe dashboard's number \"verify\" affordance fetches the `intelligence.execution_log`\nrow (the SQL/code + returned rows) that produced a stated number. Gated on\n`Capability.CLIENT_VIEW` — viewer+ (anyone who can see the client's insight cards\ncan verify a number on them), NOT the admin-only `INTELLIGENCE_RUN` the cost/trigger\nproxies use. The engine re-checks `INTELLIGENCE_VIEW` on the forwarded JWT and masks\na cross-client / unknown execution_log_id as 404 (defence-in-depth; never enumerable).","operationId":"number_provenance_api_v1_intelligence_clients__client_id__provenance__execution_log_id__get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"execution_log_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Execution Log Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/runs/{engagement_id}/insights":{"delete":{"tags":["intelligence"],"summary":"Discard Run Insights","description":"Delete a Magenta run from Recent runs: soft-delete its published insights\n(STR-288) and leave the run out of run-costs (STR-2151). Admin-gated like\nthe trigger (`INTELLIGENCE_RUN`, owner/admin) BEFORE forwarding; the caller's\nJWT is relayed so the engine re-checks `INTELLIGENCE_ADMIN` and confirms the\nrun belongs to the client (cross-tenant → 404, queued/running → 409, both\nrelayed verbatim). Returns the engine's {discarded_count, run_id, client_id}.","operationId":"discard_run_insights_api_v1_intelligence_clients__client_id__runs__engagement_id__insights_delete","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"engagement_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engagement Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/brand-profile":{"get":{"tags":["intelligence"],"summary":"Get Brand Profile","description":"Read the latest completed brand profile for a client (STR-269).\n\nSTR-567 relaxed the READ to `Capability.CLIENT_VIEW` (viewer+) — it is one of\nthe sources /memory projects, and that surface is open to every member of the\nowning agency. The engine re-checks `INTELLIGENCE_VIEW` on the forwarded JWT.\nThe REFRESH below stays admin-gated: it spends money on web research.\nReturns {profile, researching, web_search_available}.","operationId":"get_brand_profile_api_v1_intelligence_clients__client_id__brand_profile_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/memory/notebook":{"get":{"tags":["intelligence"],"summary":"Get Memory Notebook","operationId":"get_memory_notebook_api_v1_intelligence_clients__client_id__memory_notebook_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"scope","in":"query","required":false,"schema":{"type":"string","default":"brand","title":"Scope"}},{"name":"export","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Export"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/memory/notebook/{action}":{"post":{"tags":["intelligence"],"summary":"Write Memory Notebook","operationId":"write_memory_notebook_api_v1_intelligence_clients__client_id__memory_notebook__action__post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"action","in":"path","required":true,"schema":{"enum":["save","preview"],"type":"string","title":"Action"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/memory/tree":{"get":{"tags":["intelligence"],"summary":"Get Memory Tree","description":"Every agent-memory inode for the client + meta (counts, scopes, owners,\nlast promote time). Viewer+ (`CLIENT_VIEW`, client-scoped — STR-567).","operationId":"get_memory_tree_api_v1_intelligence_clients__client_id__memory_tree_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/memory/file":{"get":{"tags":["intelligence"],"summary":"Get Memory File","description":"One memory file's inode meta + markdown body. The engine masks an\nunknown/unsafe path as 404 (relayed verbatim). Viewer+ (STR-567).","operationId":"get_memory_file_api_v1_intelligence_clients__client_id__memory_file_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"scope","in":"query","required":true,"schema":{"type":"string","title":"Scope"}},{"name":"owner","in":"query","required":true,"schema":{"type":"string","title":"Owner"}},{"name":"relpath","in":"query","required":true,"schema":{"type":"string","title":"Relpath"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/memory/timeline":{"get":{"tags":["intelligence"],"summary":"Get Memory Timeline","description":"The agent-memory write/read/promote audit timeline (newest first).\nViewer+ (STR-567).","operationId":"get_memory_timeline_api_v1_intelligence_clients__client_id__memory_timeline_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":200,"title":"Limit"}},{"name":"scope","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scope"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/ml-signals":{"get":{"tags":["intelligence"],"summary":"Get Client Ml Signals","description":"The client's standing ML signals (forecast / anomaly / creative / mmm),\neach block carrying its own status so an empty read is never confused with an\nunreadable one. Viewer+ (`CLIENT_VIEW`, client-scoped — STR-567).","operationId":"get_client_ml_signals_api_v1_intelligence_clients__client_id__ml_signals_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"kinds","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kinds"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":200,"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/findings":{"get":{"tags":["intelligence"],"summary":"Get Client Findings","description":"Run-level findings for the client, newest first. The engine scopes the read\nthrough the client's own engagements, so another agency's `engagement_id`\nyields an empty list. Viewer+ (`CLIENT_VIEW`, client-scoped — STR-567).\n\nSTR-1199: `withheld_only=true` narrows to findings the decision gate ASSESSED\nand REFUSED, and serves the gate's verdict (`reasons`, `errors`, `waived`)\nbeside each one. It is the read behind the withheld-review surface — a card\nthe engine declined to publish is otherwise visible nowhere but a Railway log\nline, which rolls. Relayed with the caller's JWT forwarded, so the engine\nre-authorises the client scope itself rather than trusting this hop. Still\n`CLIENT_VIEW`: judging a refusal is reading, not mutating.","operationId":"get_client_findings_api_v1_intelligence_clients__client_id__findings_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"engagement_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Engagement Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":200,"title":"Limit"}},{"name":"withheld_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Withheld Only"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/knowledge/forest":{"get":{"tags":["intelligence"],"summary":"Get Client Knowledge Forest","description":"The client's whole knowledge-base forest — nodes (every node type and\nlifecycle, class roots included), parent links, and each node's board row id\n(STR-884). The engine scopes every read to the client's own tenant, and its\nenvelope distinguishes an empty forest from an unreadable one. Viewer+\n(`CLIENT_VIEW`, client-scoped — the same gate as the insights page).","operationId":"get_client_knowledge_forest_api_v1_intelligence_clients__client_id__knowledge_forest_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":2000,"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/brand-profile/refresh":{"post":{"tags":["intelligence"],"summary":"Refresh Brand Profile","description":"Trigger web research of a client's brand profile (STR-269). ADMIN-ONLY.\nGated at apps/api (`INTELLIGENCE_RUN`, owner/admin) BEFORE forwarding; the\nengine re-checks admin, resolves the client, and fires research in the\nbackground (202). The engine's 409 (already researching) / 422 (unresolvable)\n/ 503 (no web search) surface verbatim.","operationId":"refresh_brand_profile_api_v1_intelligence_clients__client_id__brand_profile_refresh_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/model-catalog":{"get":{"tags":["intelligence"],"summary":"Get Model Catalog","description":"Each provider's live model list for the settings drawer (STR-1210).\nADMIN-ONLY like run-tiers: the response is model ids and rates. The engine\nre-checks admin on the forwarded JWT.","operationId":"get_model_catalog_api_v1_intelligence_clients__client_id__model_catalog_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/run-tiers":{"get":{"tags":["intelligence"],"summary":"Get Run Tiers","description":"The agency's effective run-tier ladder (STR-505). ADMIN-ONLY.\n\nDeliberately NOT on the editor tier even though it is a read: the response\ncarries the model slugs behind each tier, which is precisely what the tier\nabstraction exists to hide from everyone but an admin.","operationId":"get_run_tiers_api_v1_intelligence_clients__client_id__run_tiers_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/run-tiers/{tier_key}":{"put":{"tags":["intelligence"],"summary":"Put Run Tier","description":"Redefine one tier for this agency. ADMIN-ONLY, full-replace.\n\nThe engine owns validation (known provider, three non-empty slugs, resolvable\nmodel slugs + API key present) and its 422 relays verbatim — re-implementing\nthose checks here would just be a second copy to drift.","operationId":"put_run_tier_api_v1_intelligence_clients__client_id__run_tiers__tier_key__put","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"tier_key","in":"path","required":true,"schema":{"type":"string","title":"Tier Key"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunTierPresetRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["intelligence"],"summary":"Delete Run Tier","description":"Revert one tier to the shipped default. ADMIN-ONLY, idempotent.","operationId":"delete_run_tier_api_v1_intelligence_clients__client_id__run_tiers__tier_key__delete","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"tier_key","in":"path","required":true,"schema":{"type":"string","title":"Tier Key"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/agencies/{agency_id}/model-catalog":{"get":{"tags":["intelligence"],"summary":"Get Agency Model Catalog","description":"Each provider's live model list, for the agency's AI models page.","operationId":"get_agency_model_catalog_api_v1_intelligence_agencies__agency_id__model_catalog_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/agencies/{agency_id}/run-tiers":{"get":{"tags":["intelligence"],"summary":"Get Agency Run Tiers","description":"The agency's effective run-tier ladder. ADMIN-ONLY, like its twin.","operationId":"get_agency_run_tiers_api_v1_intelligence_agencies__agency_id__run_tiers_get","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/agencies/{agency_id}/run-tiers/{tier_key}":{"put":{"tags":["intelligence"],"summary":"Put Agency Run Tier","description":"Redefine one tier for this agency. Same body as the client route; the\nengine owns validation and its 422 relays verbatim.","operationId":"put_agency_run_tier_api_v1_intelligence_agencies__agency_id__run_tiers__tier_key__put","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"tier_key","in":"path","required":true,"schema":{"type":"string","title":"Tier Key"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunTierPresetRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["intelligence"],"summary":"Delete Agency Run Tier","description":"Revert one tier to the shipped default. ADMIN-ONLY, idempotent.","operationId":"delete_agency_run_tier_api_v1_intelligence_agencies__agency_id__run_tiers__tier_key__delete","parameters":[{"name":"agency_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Agency Id"}},{"name":"tier_key","in":"path","required":true,"schema":{"type":"string","title":"Tier Key"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/schedule":{"get":{"tags":["intelligence"],"summary":"Get Schedule","description":"Read the recurring Magenta run schedule for a (client, scope) — STR-240.\n`campaign_group_id` omitted ⇒ the whole-client schedule. Admin-gated; the\nengine re-checks admin on the forwarded JWT.","operationId":"get_schedule_api_v1_intelligence_clients__client_id__schedule_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["intelligence"],"summary":"Put Schedule","description":"Create/update the client's recurring Magenta run schedule (STR-240).\nRecurring runs are IN ADDITION to the manual Run-Magenta trigger. ADMIN-ONLY.","operationId":"put_schedule_api_v1_intelligence_clients__client_id__schedule_put","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["intelligence"],"summary":"Delete Schedule","description":"Remove the recurring Magenta run schedule for a (client, scope) — STR-240.\n`campaign_group_id` omitted ⇒ the whole-client schedule. ADMIN-ONLY.","operationId":"delete_schedule_api_v1_intelligence_clients__client_id__schedule_delete","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/budget":{"get":{"tags":["intelligence"],"summary":"Get Budget","description":"Agency-level Magenta budget status for the client's tenant (STR-240 cost\nrail: month-to-date spend vs the monthly ceiling). ADMIN-ONLY.","operationId":"get_budget_api_v1_intelligence_clients__client_id__budget_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/fleet/runs":{"get":{"tags":["intelligence"],"summary":"Fleet Runs","description":"Fleet/run view for one agency (STR-240): queued/running clients, recent\nruns with actual spend, schedules, budget, concurrency caps. ADMIN-ONLY,\nagency-scoped (tenant == agency).","operationId":"fleet_runs_api_v1_intelligence_fleet_runs_get","parameters":[{"name":"tenant_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Tenant Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/refresh-policy":{"get":{"tags":["intelligence"],"summary":"Get Refresh Policy","description":"Read the per-component refresh-control policy for a (client, campaign_scope)\n(STR-278). CLIENT-addressed: gated on client-scoped INTELLIGENCE_RUN (admin), then\nforwarded for the engine's own admin re-check on the JWT. `campaign_group_id`\nomitted ⇒ the whole-client default; set ⇒ that group's policy WITH the inherit chain\napplied engine-side. An absent row resolves to the DEFAULT (all 'bust_full')\nengine-side, so the dashboard always renders complete state.","operationId":"get_refresh_policy_api_v1_intelligence_clients__client_id__refresh_policy_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["intelligence"],"summary":"Put Refresh Policy","description":"Full-replace the refresh-control policy for a (client, campaign_scope) (STR-278).\nCLIENT-addressed + admin-gated at apps/api (client-scoped INTELLIGENCE_RUN), then\nforwarded with the JWT for the engine's admin re-check. `campaign_group_id` (when\nset) scopes the write to a campaign group; the engine resolves+validates it (422 on\na bad/cross-client group, surfaced verbatim). The engine validates the values +\nrejects the prompt/model rails (its 422 surfaces verbatim). **STR-485:** `seed_identity`\n(∈ 'bust_full'/'ignore', default 'bust_full') is the 4th component — whether an edited\noperator seed-question set busts the group's next run to a full regeneration.\n**STR-483:** `ml_watermark` is the 5th component — whether a moved ML-suite\nstanding-output watermark busts the group's next run to a full regeneration.","operationId":"put_refresh_policy_api_v1_intelligence_clients__client_id__refresh_policy_put","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshPolicyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["intelligence"],"summary":"Delete Refresh Policy","description":"Reset a campaign group's refresh-policy override to the client default (STR-278):\nforwards to the engine, which DELETEs the (client, campaign_scope) row so the group\nre-inherits the whole-client '*' default. CLIENT-addressed + admin-gated; the engine\nrequires `campaign_group_id` (the whole-client default can't be deleted) and echoes\nthe now-effective inherited policy.","operationId":"delete_refresh_policy_api_v1_intelligence_clients__client_id__refresh_policy_delete","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/seed-questions":{"get":{"tags":["intelligence"],"summary":"Get Seed Questions","description":"Read a campaign group's operator seed questions (STR-485). `campaign_group_id` is\nREQUIRED (seed questions are per-group; a missing param 422s at apps/api before the\nengine is ever called). Client-scoped INTELLIGENCE_RUN gate, mirroring the\nrefresh-policy proxy; the engine re-checks admin on the forwarded JWT and 422s an\nunresolvable/cross-client group. Returns {questions, source, version, defaults,\nupdated_by, updated_at} — `source` is 'override' or 'defaults'.","operationId":"get_seed_questions_api_v1_intelligence_clients__client_id__seed_questions_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"query","required":true,"schema":{"type":"string","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["intelligence"],"summary":"Put Seed Questions","description":"Full-replace a campaign group's operator seed questions (STR-485). ADMIN-ONLY,\nclient-scoped INTELLIGENCE_RUN gate; forwarded with the JWT for the engine's admin\nre-check + bounds validation (1-10 items / 5-300 chars each, trimmed) — its 422\nsurfaces verbatim. Returns the GET shape with source='override'. Saving is\ndeliberately consequential (the next run for this group becomes a full\nregeneration unless the refresh-policy `seed_identity` component is set to\n'ignore') — the dashboard's two-step confirm makes that explicit before calling\nthis route.","operationId":"put_seed_questions_api_v1_intelligence_clients__client_id__seed_questions_put","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeedQuestionsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["intelligence"],"summary":"Delete Seed Questions","description":"Revert a campaign group's seed questions to the engine defaults (STR-485).\nIdempotent — reverting an already-default group still 200s with the GET shape\n(source='defaults'). `campaign_group_id` is REQUIRED, same as the GET. Client-scoped\nINTELLIGENCE_RUN gate; the engine re-checks admin on the forwarded JWT.","operationId":"delete_seed_questions_api_v1_intelligence_clients__client_id__seed_questions_delete","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"campaign_group_id","in":"query","required":true,"schema":{"type":"string","title":"Campaign Group Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/engagements/{engagement_id}/runs/{run_id}":{"get":{"tags":["intelligence"],"summary":"Get Run Status","description":"Poll a run's status. Forwarded to the engine, which tenant-scopes the\npoll via the engagement (cross-tenant → 404). No extra apps/api capability\ngate is needed — the engine's `require_engagement(INTELLIGENCE_VIEW)` is the\nauthority; this proxy only requires the caller be authenticated.","operationId":"get_run_status_api_v1_intelligence_engagements__engagement_id__runs__run_id__get","parameters":[{"name":"engagement_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Engagement Id"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/runs/in-progress":{"get":{"tags":["intelligence"],"summary":"Runs In Progress","description":"The client's queued or running engine runs, oldest first, as\n`{\"runs\": [{\"run_id\", \"engagement_id\", \"status\"}]}`; an empty list when none\nis going. Filtered by the client AND its agency (`tenant_id`), so a row\nstamped with another agency never answers. A row that has claimed to be\nrunning for longer than the console's stale bound\n(`magenta_runs.STALE_RUN_AFTER_HOURS`, the same derivation) is not going:\nits process died without finishing it, and following it would poll a run\nthat never ends. A queued row never picked up is measured from when it was\nmade.","operationId":"runs_in_progress_api_v1_intelligence_clients__client_id__runs_in_progress_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/engine-features":{"get":{"tags":["intelligence"],"summary":"Get Engine Features","description":"Current RESOLVED state of the durable-insight-knowledge-base kill\nswitch (STR-618) for THIS client — its value plus the layer that\ndecided it.\n\nPROXIED to the engine, like every other route on this router, because the\nENGINE is the only process that can answer it. Its own\n`INTELLIGENCE_KB_*_ENABLED` env vars are the deployment-level HARD GATE, and\napps/api is a separate hermetic service that cannot read them. An earlier\nbuild had apps/api read `intelligence.control_settings` directly while\nkeeping a hardcoded copy of those defaults; that copy could not see a real\nfleet-wide kill, so this endpoint reported a switch ON while every run\nresolved it OFF — misreporting a safety control in precisely the situation\nthe control exists for. Owner/admin of the client's OWN agency,\nclient-scoped (the neighbouring schedule / refresh-policy / run-tier gate);\nthe engine re-checks admin on the forwarded JWT.","operationId":"get_engine_features_api_v1_intelligence_clients__client_id__engine_features_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["intelligence"],"summary":"Put Engine Features","description":"Upsert a per-(tenant, client) override for the knowledge-base switch\n(STR-618). PROXIED for the same reason as the GET: the engine owns the\ntable, applies the deployment hard gate, and returns the resolved state this\nhandler relays back — so a PUT can never report a value the engine would not\nhonour. The caller's identity rides as `X-Updated-By` so the stored\n`updated_by` is who actually flipped it rather than a service literal.\nOwner/admin of the client's OWN agency, client-scoped.","operationId":"put_engine_features_api_v1_intelligence_clients__client_id__engine_features_put","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineFeaturesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/surface-tasks":{"get":{"tags":["intelligence"],"summary":"List Surface Tasks","description":"The tasks a surface may run — id, description and param shape.\n\nThe instructions and the routing tier stay in the engine; this is what a\nconsent screen or a picker enumerates.","operationId":"list_surface_tasks_api_v1_intelligence_clients__client_id__surface_tasks_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intelligence/clients/{client_id}/surface-tasks/{task_id}/run":{"post":{"tags":["intelligence"],"summary":"Run Surface Task","description":"Run one registered task for this client and return its text.\n\nThe trigger timeout, not the poll one: this waits on a model call rather\nthan a database read, and a task that times out at 30s would fail for slow\nrather than for wrong.","operationId":"run_surface_task_api_v1_intelligence_clients__client_id__surface_tasks__task_id__run_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"task_id","in":"path","required":true,"schema":{"type":"string","maxLength":64,"title":"Task Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunSurfaceTaskBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/brand-memory/clients/{client_id}/chat":{"post":{"tags":["brand-memory"],"summary":"Memory Chat","operationId":"memory_chat_api_v1_brand_memory_clients__client_id__chat_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemoryChatRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/stratbot/clients/{client_id}/conversations":{"post":{"tags":["stratbot"],"summary":"Create Conversation","operationId":"create_conversation_api_v1_stratbot_clients__client_id__conversations_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewConversationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["stratbot"],"summary":"List Conversations","operationId":"list_conversations_api_v1_stratbot_clients__client_id__conversations_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/stratbot/clients/{client_id}/conversations/{conversation_id}":{"get":{"tags":["stratbot"],"summary":"Get Conversation","description":"One page of a transcript; `before` (a message `seq`) asks for older messages\n(STR-2525). The engine decides the page; this relays it.","operationId":"get_conversation_api_v1_stratbot_clients__client_id__conversations__conversation_id__get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","title":"Client Id"}},{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"title":"Before"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/stratbot/clients/{client_id}/conversations/{conversation_id}/messages":{"post":{"tags":["stratbot"],"summary":"Post Message","description":"Ask Stratbot a question and stream the answer.\n\nViewer+, client-scoped — anyone who can see a client's data may ask about it. The\nengine re-checks on the forwarded token; this gate is the first of two, not the only\none.","operationId":"post_message_api_v1_stratbot_clients__client_id__conversations__conversation_id__messages_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","title":"Client Id"}},{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/stratbot/clients/{client_id}/conversations/{conversation_id}/messages/{message_id}/feedback":{"post":{"tags":["stratbot"],"summary":"Post Message Feedback","description":"Record a rating on one answer.\n\nGated `CLIENT_VIEW`, the same tier that may ask the question — anyone who\ncan talk to Stratbot about a client may say whether the answer was any\ngood, and nobody else can write rows about a client they cannot see.\n\nThe path carries the whole chain (client, conversation, message) and the\nDATABASE enforces that it is consistent: the message must belong to the\nconversation and the conversation to the client, through composite foreign\nkeys. So a caller cannot mis-attribute a rating by pairing one client's id\nwith another's turn — the equivalent hole on `insight_feedback` was real\nuntil review caught it, which is why this path does not trust its own\narguments.\n\nRe-rating the same turn UPDATES rather than accumulating: the operator has\none opinion per answer, and the last one is it.\n\nA failure here is reported honestly rather than swallowed. The client\ntreats it as fire-and-forget, but a 500 that pretends to be a 200 would\nmake a silently-empty corpus look like an unused feature.","operationId":"post_message_feedback_api_v1_stratbot_clients__client_id__conversations__conversation_id__messages__message_id__feedback_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","title":"Client Id"}},{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}},{"name":"message_id","in":"path","required":true,"schema":{"type":"string","title":"Message Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StratbotFeedbackRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/brand-memory/clients/{client_id}/prefs":{"get":{"tags":["brand-memory"],"summary":"Get Memory Prefs","operationId":"get_memory_prefs_api_v1_brand_memory_clients__client_id__prefs_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["brand-memory"],"summary":"Save Memory Prefs","operationId":"save_memory_prefs_api_v1_brand_memory_clients__client_id__prefs_put","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavePrefsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/miniapps/installs":{"get":{"tags":["miniapps"],"summary":"List Installs","description":"The gallery's read: registry metadata joined with the agency's installs.\n\nViewer+ (`AGENCY_READ`). What comes back follows the AUDIENCE rule (§4.1):\na non-manager sees only ENABLED apps whose audience admits them —\n'members', or 'selected' with a grant row of their own; 'admins' never.\nOwners/admins see the apps their agency has been INVITED to (an install\nrow exists — enabled or not; they run the consent flow on it) plus every\n'stable' self-serve app; an experimental app with no row is invisible\neven to managers (invite-only, module docstring). Install rows whose app\nwas pulled from the repo are omitted entirely: no registry entry, no data\npath, nothing to render.","operationId":"list_installs_api_v1_miniapps_installs_get","parameters":[{"name":"agency_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","description":"Agency UUID","title":"Agency Id"},"description":"Agency UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/miniapps/installs/{app_id}":{"put":{"tags":["miniapps"],"summary":"Save Install","description":"Enable/disable + consent write. Owner/admin (`MINIAPP_MANAGE`),\non an INVITED app only (the seeded install row is the invite).","operationId":"save_install_api_v1_miniapps_installs__app_id__put","parameters":[{"name":"app_id","in":"path","required":true,"schema":{"type":"string","description":"Registered mini-app id","title":"App Id"},"description":"Registered mini-app id"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveInstallRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/miniapps/installs/{app_id}/users":{"put":{"tags":["miniapps"],"summary":"Save Install Users","description":"FULL REPLACE of the per-user grant list (`audience='selected'`).\n\nOwner/admin (`MINIAPP_MANAGE`). The install row must exist (grants refine\nan install decision; there is nothing to refine before the invite), and\nevery grantee must be a member of the agency — grants are AGENCY-grained,\nso no client-scope narrowing applies (deliberate: an app grant is not a\nclient grant). Owner/admins never need a row; granting them one is\nharmless and ignored by the manager bypass.","operationId":"save_install_users_api_v1_miniapps_installs__app_id__users_put","parameters":[{"name":"app_id","in":"path","required":true,"schema":{"type":"string","description":"Registered mini-app id","title":"App Id"},"description":"Registered mini-app id"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveInstallUsersRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/miniapps/{app_id}/rpc":{"post":{"tags":["miniapps"],"summary":"Broker Rpc","description":"The data broker (§4.3) — enforcement (STR-576) + scope handlers (STR-577).\n\nCheck order is deliberate: registry (a pulled app is a 404, its installs\ninert) → the caller's own membership (cap 1 of the sandwich) → the install\nrow (enabled → audience → method namespace → scope snapshot ∩ manifest) →\nthe method handler. Every refusal names its reason — the host shows the\napp a legible error, and none of these are secrets (the gallery already\nlists enablement).","operationId":"broker_rpc_api_v1_miniapps__app_id__rpc_post","parameters":[{"name":"app_id","in":"path","required":true,"schema":{"type":"string","description":"Registered mini-app id","title":"App Id"},"description":"Registered mini-app id"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RpcRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/miniapps/{app_id}/feedback":{"post":{"tags":["miniapps"],"summary":"Submit Feedback","description":"File feedback on an app the caller can open (design §6).\n\nEvery app gets feedback capture for free because the HOST owns the button;\nan app cannot implement (or suppress) its own. Access is the open rule —\na member who cannot see the app cannot review it.","operationId":"submit_feedback_api_v1_miniapps__app_id__feedback_post","parameters":[{"name":"app_id","in":"path","required":true,"schema":{"type":"string","description":"Registered mini-app id","title":"App Id"},"description":"Registered mini-app id"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["miniapps"],"summary":"List Feedback","description":"The full feedback list for one app — owner/admin (`MINIAPP_MANAGE`).\n\nDeliberately NOT readable by the members who wrote it: an agency's\nfeedback is other people's words about a shared tool.","operationId":"list_feedback_api_v1_miniapps__app_id__feedback_get","parameters":[{"name":"app_id","in":"path","required":true,"schema":{"type":"string","description":"Registered mini-app id","title":"App Id"},"description":"Registered mini-app id"},{"name":"agency_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","description":"Agency UUID","title":"Agency Id"},"description":"Agency UUID"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/miniapps/{app_id}/events":{"post":{"tags":["miniapps"],"summary":"Record Event","description":"Record an `open` / `close` usage beacon for an app the caller can open.\n\nFire-and-forget: 204, no body. `duration_ms` rides the CLOSE only — an\n`open` carrying one is a client bug, and storing it would double-count the\nsession in the median, so it is dropped rather than trusted.","operationId":"record_event_api_v1_miniapps__app_id__events_post","parameters":[{"name":"app_id","in":"path","required":true,"schema":{"type":"string","description":"Registered mini-app id","title":"App Id"},"description":"Registered mini-app id"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/miniapps/overview":{"get":{"tags":["miniapps"],"summary":"Usage Overview","description":"The Apps -> Overview board (design §5.1) — owner/admin (`MINIAPP_MANAGE`).\n\nOne card per app the agency has an install row for, whether enabled or\nnot: \"we turned it off and nobody used it anyway\" is exactly the kind of\nanswer this surface exists to give. Apps pulled from the repo are omitted\n(no registry entry, nothing to name).","operationId":"usage_overview_api_v1_miniapps_overview_get","parameters":[{"name":"agency_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","description":"Agency UUID","title":"Agency Id"},"description":"Agency UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/miniapps/admin/suspensions":{"get":{"tags":["miniapps-admin"],"summary":"List Suspensions","description":"Everything currently stopped, plus the deployment-level ceiling.","operationId":"list_suspensions_api_v1_miniapps_admin_suspensions_get","parameters":[{"name":"x-admin-token","in":"header","required":true,"schema":{"type":"string","title":"X-Admin-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["miniapps-admin"],"summary":"Suspend","description":"Stop an app — or every app — on the next broker call.\n\nIdempotent by upsert on the partial unique indexes: pressing it twice\nupdates the reason rather than failing, which is the behaviour you want from\nsomething reached for during an incident.","operationId":"suspend_api_v1_miniapps_admin_suspensions_post","parameters":[{"name":"x-admin-token","in":"header","required":true,"schema":{"type":"string","title":"X-Admin-Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuspendRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["miniapps-admin"],"summary":"Unsuspend","description":"Let it run again, on the next broker call.","operationId":"unsuspend_api_v1_miniapps_admin_suspensions_delete","parameters":[{"name":"app_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Omit or '*' for the fleet-wide row","title":"App Id"},"description":"Omit or '*' for the fleet-wide row"},{"name":"x-admin-token","in":"header","required":true,"schema":{"type":"string","title":"X-Admin-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ml/freshness":{"get":{"tags":["ml"],"summary":"Get Freshness","description":"Gold-watermark + per-job freshness for a tenant (STR-470). Viewer-tier\nread — any member of the agency may see ML data freshness, the same tier\nas the insight cards that surface ML numbers. Relays the ML suite's plain\ndict verbatim (the ML suite returns no APIResponse envelope).","operationId":"get_freshness_api_v1_ml_freshness_get","parameters":[{"name":"tenant_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Tenant Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ml/ensure-current":{"post":{"tags":["ml"],"summary":"Ensure Current","description":"Trigger the ML suite to bring every job current for a tenant\n(STR-470). ADMIN-ONLY — a deliberate reuse of\n`Capability.INTELLIGENCE_RUN`: a batch ensure is an expensive compute\naction, the same product tier as triggering an engine run. Relays the ML\nsuite's plain dict verbatim (no APIResponse envelope); the ML suite\n503s when the Gold watermark is unreadable, surfaced as-is rather than\nflattened to a generic 502.","operationId":"ensure_current_api_v1_ml_ensure_current_post","parameters":[{"name":"tenant_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Tenant Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/ml/trigger/{job}":{"post":{"tags":["ml"],"summary":"Trigger Job","description":"Force-run one ML batch job for a tenant, bypassing the cadence/\nfreshness gate `ensure-current` respects (STR-477). ADMIN-ONLY — the SAME\ndeliberate `Capability.INTELLIGENCE_RUN` reuse as `ensure-current`: an\noperator force-run is the same product tier as a batch ensure. Relays the\nML suite's plain dict verbatim (`scheduled` / `already_running` /\n`no_compute_home` — see `services/ml/app/main.py:_make_trigger`).\n\nSTR-500: `seed_origins` is the operator opt-in for BACKDATED history —\nforecast-only, and bounded here as well as in the ML service (defence in\ndepth) because each origin is a full forecast run of several minutes. It\nforces seeding even when history already clears the automatic floor, which\nis what makes a second test run on the same campaign possible; the origin\nplanner stays idempotent, so pressing it twice seeds only what is missing.","operationId":"trigger_job_api_v1_ml_trigger__job__post","parameters":[{"name":"job","in":"path","required":true,"schema":{"type":"string","title":"Job"}},{"name":"tenant_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Tenant Id"}},{"name":"seed_origins","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":12,"minimum":1},{"type":"null"}],"title":"Seed Origins"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/clients/{client_id}/feeds":{"get":{"tags":["news"],"summary":"List Client News Feeds","description":"List all news feeds for a given client.\n\nUsed by the Dashboard \"Customize News\" panel to show the client's feeds.","operationId":"list_client_news_feeds_api_v1_news_clients__client_id__feeds_get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client ID (UUID)","title":"Client Id"},"description":"Client ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/feeds":{"post":{"tags":["news"],"summary":"Create News Feed","description":"Create a new news feed for a client.","operationId":"create_news_feed_api_v1_news_feeds_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateNewsFeedRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/feeds/{news_feed_id}":{"patch":{"tags":["news"],"summary":"Update News Feed","description":"Update a news feed's editable fields.\n\nSupports updating `name`, `type`, and/or `search_prompt`.","operationId":"update_news_feed_api_v1_news_feeds__news_feed_id__patch","parameters":[{"name":"news_feed_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"News feed ID (UUID)","title":"News Feed Id"},"description":"News feed ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateNewsFeedRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["news"],"summary":"Delete News Feed","description":"Delete a news feed and all its associated news items.","operationId":"delete_news_feed_api_v1_news_feeds__news_feed_id__delete","parameters":[{"name":"news_feed_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"News feed ID (UUID)","title":"News Feed Id"},"description":"News feed ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/items":{"get":{"tags":["news"],"summary":"List News Items","description":"List news feeds + items for a given client.\n\nNotes:\n- Uses service-role Supabase key for data access, so we must enforce authz manually.\n- Returns up to `limit` items per feed, sorted by `published_at` (desc).","operationId":"list_news_items_api_v1_news_items_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","description":"Client UUID","title":"Client Id"},"description":"Client UUID"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"description":"Max items per feed","default":10,"title":"Limit"},"description":"Max items per feed"},{"name":"include_disabled_feeds","in":"query","required":false,"schema":{"type":"boolean","description":"If true, include disabled feeds","default":false,"title":"Include Disabled Feeds"},"description":"If true, include disabled feeds"},{"name":"bookmarked_only","in":"query","required":false,"schema":{"type":"boolean","description":"If true, return only items bookmarked by the user","default":false,"title":"Bookmarked Only"},"description":"If true, return only items bookmarked by the user"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/feeds/{news_feed_id}/items":{"get":{"tags":["news"],"summary":"List News Items For Feed","description":"List paginated news items for a single feed.\n\nNotes:\n- Uses service-role Supabase key for data access, so we must enforce authz manually.\n- Returns items sorted by `published_at` (desc), then `created_at` (desc).","operationId":"list_news_items_for_feed_api_v1_news_feeds__news_feed_id__items_get","parameters":[{"name":"news_feed_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"News feed ID (UUID)","title":"News Feed Id"},"description":"News feed ID (UUID)"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"description":"1-based page number","default":1,"title":"Page"},"description":"1-based page number"},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"description":"Items per page","default":15,"title":"Page Size"},"description":"Items per page"},{"name":"bookmarked_only","in":"query","required":false,"schema":{"type":"boolean","description":"If true, return only items bookmarked by the user","default":false,"title":"Bookmarked Only"},"description":"If true, return only items bookmarked by the user"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/items/{news_item_id}/bookmark":{"patch":{"tags":["news"],"summary":"Set News Item Bookmark","description":"Upsert bookmark state for a news item for the current user.\nWrites into `news_item_user_state` (PK: user_id, news_item_id).","operationId":"set_news_item_bookmark_api_v1_news_items__news_item_id__bookmark_patch","parameters":[{"name":"news_item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"News item ID (UUID)","title":"News Item Id"},"description":"News item ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetBookmarkRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/items/{news_item_id}/image":{"get":{"tags":["news"],"summary":"Get News Item Image","description":"Serve an article's artwork from our own origin (STR-1801).\n\nThe dashboard used to point `<img src>` straight at the publisher URL,\nwhich forced the CSP to carry `img-src https:` — any TLS origin — because\npublisher hosts cannot be enumerated. ZAP raises that as\n`CSP: Wildcard Directive` (Medium). Serving the bytes here lets the policy\nname one origin.\n\nThis is NOT a URL proxy: the caller passes a news item id, the id is\nauthorized through the same NEWS_VIEW path as every other item route, and\nthe URL is read from the stored row. There is no parameter a caller can\npoint at a host of their choosing.","operationId":"get_news_item_image_api_v1_news_items__news_item_id__image_get","parameters":[{"name":"news_item_id","in":"path","required":true,"schema":{"type":"string","description":"News item ID (UUID)","title":"News Item Id"},"description":"News item ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/preview/auto-detect-search-names":{"post":{"tags":["news"],"summary":"Preview Auto Detect Search Names","description":"Preview auto-detect for NEW feeds (before they're saved to DB).\n\nUses client context + feed type to generate search name suggestions.\nDoes NOT require a feed ID - useful when creating a new feed.","operationId":"preview_auto_detect_search_names_api_v1_news_preview_auto_detect_search_names_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewAutoDetectRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/preview/generate-example-prompt":{"post":{"tags":["news"],"summary":"Preview Generate Example Prompt","description":"Preview example prompt generation for NEW feeds (before they're saved to DB).\n\nUses client context to generate an example search prompt.\nDoes NOT require a feed ID - useful when creating a new feed.","operationId":"preview_generate_example_prompt_api_v1_news_preview_generate_example_prompt_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewExamplePromptRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/feeds/{news_feed_id}/auto-detect-search-names":{"post":{"tags":["news"],"summary":"Auto Detect Search Names","description":"Auto-detect flow (inside feed editor):\n- Load the existing `news_feeds` row by `news_feed_id`\n- Verify the authenticated user belongs to the feed's client agency\n- Generate ~3–5 `search_names` using the client info + feed type\n- Return the generated names WITHOUT saving to database","operationId":"auto_detect_search_names_api_v1_news_feeds__news_feed_id__auto_detect_search_names_post","parameters":[{"name":"news_feed_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"News feed ID (UUID)","title":"News Feed Id"},"description":"News feed ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/feeds/{news_feed_id}/search-names":{"patch":{"tags":["news"],"summary":"Update Feed Search Names","description":"Manual textbox flow: overwrite `news_feeds.search_names` for an existing feed.\n\nThis does NOT call OpenAI. It only saves what the user entered.","operationId":"update_feed_search_names_api_v1_news_feeds__news_feed_id__search_names_patch","parameters":[{"name":"news_feed_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"News feed ID (UUID)","title":"News Feed Id"},"description":"News feed ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSearchNamesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/feeds/{news_feed_id}/generate-example-prompt":{"post":{"tags":["news"],"summary":"Generate Example Search Prompt","description":"Generate an example search prompt for a custom news feed using AI.\n\nUses the client context (name, website, existing feed search names) to create a relevant example prompt.","operationId":"generate_example_search_prompt_api_v1_news_feeds__news_feed_id__generate_example_prompt_post","parameters":[{"name":"news_feed_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"News feed UUID","title":"News Feed Id"},"description":"News feed UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/feeds/{news_feed_id}/fetch-news":{"post":{"tags":["news"],"summary":"Fetch News For Feed","description":"Trigger an on-demand news fetch for a specific feed.\n\nThis calls the LinkUp API to fetch news articles and stores them in news_items.\nUseful for immediately populating a newly created or updated custom feed.","operationId":"fetch_news_for_feed_api_v1_news_feeds__news_feed_id__fetch_news_post","parameters":[{"name":"news_feed_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"News feed UUID","title":"News Feed Id"},"description":"News feed UUID"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/feeds/{news_feed_id}/insight":{"get":{"tags":["news"],"summary":"Get Feed Intel Insight","description":"Return the latest active intel insight for this feed, plus whether\nthe calling user has dismissed it. The insight content itself is\nagency-shared; only the dismissal flag varies per user.","operationId":"get_feed_intel_insight_api_v1_news_feeds__news_feed_id__insight_get","parameters":[{"name":"news_feed_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"News Feed Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/feeds/{news_feed_id}/insight/dismiss":{"post":{"tags":["news"],"summary":"Dismiss Feed Intel Insight","description":"Mark the calling user as having dismissed the current active intel\ninsight for this feed. No-op if there's no active insight.","operationId":"dismiss_feed_intel_insight_api_v1_news_feeds__news_feed_id__insight_dismiss_post","parameters":[{"name":"news_feed_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"News Feed Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/feeds/{news_feed_id}/insight/restore":{"post":{"tags":["news"],"summary":"Restore Feed Intel Insight","description":"Undo a prior dismissal for this user on this feed's current\nactive intel insight.","operationId":"restore_feed_intel_insight_api_v1_news_feeds__news_feed_id__insight_restore_post","parameters":[{"name":"news_feed_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"News Feed Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/items/{news_item_id}/insight":{"post":{"tags":["news"],"summary":"Get Or Generate News Item Insight","description":"Get the per-article AI brief, generating it on demand if missing.\n\nRead-then-write: if `ai_insights` is already populated on the row,\nwe return it as-is (cached for every future caller). Otherwise we\ncall `generate_news_insight`, persist the result onto\n`news_items.ai_insights`, and return it. Subsequent clicks for any\nuser are cache-hits.\n\nDesigned for the \"Summarize article\" button in the dashboard's\nNewsCard — gives the user an explicit, predictable surface for the\nAI brief instead of the description-fallback + tooltip the\nexisting render path uses.","operationId":"get_or_generate_news_item_insight_api_v1_news_items__news_item_id__insight_post","parameters":[{"name":"news_item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"News item ID (UUID)","title":"News Item Id"},"description":"News item ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/news/clients/{client_id}/refresh-intel":{"post":{"tags":["news"],"summary":"Refresh Client Intel","description":"On-demand refresh of feed-level intel insights for a client.\n\nFired by the dashboard when the user enters /insights (INTEL category)\nor /news on a fresh login or after a data refresh. The daily\n`news_feed_scan` scheduler is the steady-state generator (11am UTC);\nthis endpoint covers the gap between data landing and the next\nscheduled run, so users never see an empty INTEL category just\nbecause they happened to log in before 11am.\n\nCost-shape: `run_intel_for_feed` cache-hits on unchanged\n`article_set_hash` (returns the existing row without calling\nOpenAI), so this is cheap when nothing's new. The first call after\na fresh `make refresh-prod-data` (zero intel rows) is the only\nexpensive run — one LLM call per enabled feed, ~3 calls/client for\na typical setup (client_news + competitor_watch + trend_radar).\n\nPer-feed errors are isolated: one feed's OpenAI / Supabase failure\ndoesn't block the rest. The response carries per-status counts so\nthe dashboard can decide whether to refetch the insights list or\nsurface a partial-failure toast.","operationId":"refresh_client_intel_api_v1_news_clients__client_id__refresh_intel_post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Client ID (UUID)","title":"Client Id"},"description":"Client ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/signals/anomalies":{"get":{"tags":["signals"],"summary":"Get Anomalies","description":"Latest run's anomaly flags for a client, severity-first.","operationId":"get_anomalies_api_v1_signals_anomalies_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":100,"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/signals/anomaly-series":{"get":{"tags":["signals"],"summary":"Get Anomaly Series","description":"A flagged series in context: gap-filled actuals + its expected band.","operationId":"get_anomaly_series_api_v1_signals_anomaly_series_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"grain","in":"query","required":true,"schema":{"type":"string","title":"Grain"}},{"name":"entity_id","in":"query","required":true,"schema":{"type":"string","title":"Entity Id"}},{"name":"metric","in":"query","required":true,"schema":{"type":"string","title":"Metric"}},{"name":"freq","in":"query","required":false,"schema":{"type":"string","default":"D","title":"Freq"}},{"name":"method","in":"query","required":false,"schema":{"type":"string","default":"statsforecast-autoets","title":"Method"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/signals/forecast-options":{"get":{"tags":["signals"],"summary":"Get Forecast Options","description":"Series available in recent forecast runs -- feeds the explorer pickers.\n\nCLIENT-SCOPED downstream (see `_SCOPED_READS`): the ML service narrows the\npicker pool to this client's own campaigns and groups inside its own query,\nbefore the per-grain cap.","operationId":"get_forecast_options_api_v1_signals_forecast_options_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/signals/forecast":{"get":{"tags":["signals"],"summary":"Get Forecast","description":"Actuals + the forward forecast band for one series.","operationId":"get_forecast_api_v1_signals_forecast_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"grain","in":"query","required":true,"schema":{"type":"string","title":"Grain"}},{"name":"entity_id","in":"query","required":true,"schema":{"type":"string","title":"Entity Id"}},{"name":"metric","in":"query","required":true,"schema":{"type":"string","title":"Metric"}},{"name":"freq","in":"query","required":true,"schema":{"type":"string","title":"Freq"}},{"name":"method","in":"query","required":true,"schema":{"type":"string","title":"Method"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/signals/forecast-scores":{"get":{"tags":["signals"],"summary":"Get Forecast Scores","description":"Backtest-ranked forecast series -- the ranked picker table.\n\nCLIENT-SCOPED downstream, and the pair must be scoped TOGETHER: the\nForecast Band picks its series from the options pool and grades it from\nthese scores, so narrowing one without the other would let it pick a\nseries it cannot grade.","operationId":"get_forecast_scores_api_v1_signals_forecast_scores_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/signals/creative":{"get":{"tags":["signals"],"summary":"Get Creative","description":"Latest run's creative scores, best-first.","operationId":"get_creative_api_v1_signals_creative_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":100,"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/signals/mmm":{"get":{"tags":["signals"],"summary":"Get Mmm","description":"Latest run's MMM ROI/shares/curves + the allocation.","operationId":"get_mmm_api_v1_signals_mmm_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/signals/summary":{"get":{"tags":["signals"],"summary":"Get Summary","description":"The verdict-strip summary across the four ML feeds (latest-run anomaly\nseverity counts, forecast grade mix, creative rising/fading outlook, MMM\nas-of) -- relayed verbatim from the ML service's `/signals/summary`.\nSame read tier as the feeds it summarises; like every ins__* read the\ndata is tenant(=agency)-wide -- client_id authorizes and resolves the\nowning agency, it does not filter.","operationId":"get_summary_api_v1_signals_summary_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/telemetry/client-events":{"post":{"tags":["telemetry"],"summary":"Record Client Event","description":"Record a client-side telemetry event as a structured log line.\n\nReturns 204 No Content — the dashboard beacon is fire-and-forget and\nnever reads the body.","operationId":"record_client_event_api_v1_telemetry_client_events_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClientEventRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/widget-insights":{"post":{"tags":["widget-insights"],"summary":"Generate Widget Insight","description":"Generate an AI-powered insight for a dashboard widget.\n\nOPTIMIZED: Receives raw data points, AI calculates its own summaries.\nThis reduces token usage by ~30% compared to sending pre-calculated stats.\n\nWidget types:\n- timeseries/barchart: Trend data points, AI finds patterns\n- ranking: Top N items by value, AI identifies concentration\n- breakdown: Segment distribution, AI compares allocations\n\nPerformance settings:\n- Model: the agency's `widget_insights` pick, else its account default\n- reasoning.effort: minimal\n- verbosity: low","operationId":"generate_widget_insight_api_v1_widget_insights_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsightRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsightResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/withheld-review/clients/{client_id}":{"get":{"tags":["withheld-review"],"summary":"List Withheld For Review","description":"Withheld findings for this client, each with the gate's refusal and the\ncaller's own verdict if they have already recorded one.\n\nViewer+ (`CLIENT_VIEW`), the same gate `insight_feedback` settled on and\nfor the same reason: judging our own output is reading, not mutating the\nclient's data, and the people who read insights most are viewers.\n\nONLY THE CALLER'S OWN verdict is attached. One reviewer seeing another's\nanswer before forming theirs turns independent judgements into a\nconsensus, and a population of agreeing reviewers is worth much less than\na population of independent ones for the question this is here to answer.\nThe full set is readable — it is one table — but not from the surface\nwhere the judging happens.","operationId":"list_withheld_for_review_api_v1_withheld_review_clients__client_id__get","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"engagement_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Engagement Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":200,"title":"Limit"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/withheld-review/clients/{client_id}/findings/{finding_id}":{"post":{"tags":["withheld-review"],"summary":"Record Withheld Verdict","description":"Record (or correct) this reviewer's verdict on one withheld finding.\n\nTHE FINDING IS RESOLVED THROUGH THE ENGINE'S OWN CLIENT-SCOPED WITHHELD\nREAD BEFORE THE WRITE IS ACCEPTED, and that check is load-bearing rather\nthan defensive politeness. `withheld_finding_verdicts.finding_id` carries\nno foreign key — the finding lives in another schema, and a cascade would\ndelete the evidence that a human examined the refusal, which is the exact\ndisappearance this surface exists to stop. So the integrity the FK would\nhave bought is bought here instead: a finding id belonging to another\nclient, or one the gate never refused, has no row to attach to and gets a\n404 that discloses nothing. Same discipline as the read — the query is the\nboundary, because the service role bypasses RLS.\n\nThe gate's refusal is snapshotted onto the row in the same call, because a\nverdict is only interpretable against what the gate actually said when the\nreviewer read it, and `decision_support` is regenerable.\n\nA VERDICT CHANGES NOTHING IN THE ENGINE. Nothing here writes back to the\nfinding, the run, the gate or a prompt; `tests/test_str1199_verdict_isolation.py`\nfails if that ever stops being true.","operationId":"record_withheld_verdict_api_v1_withheld_review_clients__client_id__findings__finding_id__post","parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Client Id"}},{"name":"finding_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Finding Id"}},{"name":"engagement_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Engagement Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WithheldVerdictRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/widgets/definitions":{"post":{"tags":["widgets"],"summary":"Create Definition","operationId":"create_definition_api_v1_widgets_definitions_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWidgetDefinitionRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["widgets"],"summary":"List Definitions","operationId":"list_definitions_api_v1_widgets_definitions_get","parameters":[{"name":"client_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"}},{"name":"agency_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agency Id"}},{"name":"scope","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scope"}},{"name":"report_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Id"}},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/widgets/definitions/{definition_id}":{"get":{"tags":["widgets"],"summary":"Get Definition","operationId":"get_definition_api_v1_widgets_definitions__definition_id__get","parameters":[{"name":"definition_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Widget definition ID (UUID)","title":"Definition Id"},"description":"Widget definition ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["widgets"],"summary":"Update Definition","operationId":"update_definition_api_v1_widgets_definitions__definition_id__put","parameters":[{"name":"definition_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Widget definition ID (UUID)","title":"Definition Id"},"description":"Widget definition ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWidgetDefinitionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["widgets"],"summary":"Delete Definition","operationId":"delete_definition_api_v1_widgets_definitions__definition_id__delete","parameters":[{"name":"definition_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Widget definition ID (UUID)","title":"Definition Id"},"description":"Widget definition ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/widgets/definitions/{definition_id}/promote":{"post":{"tags":["widgets"],"summary":"Promote Definition","operationId":"promote_definition_api_v1_widgets_definitions__definition_id__promote_post","parameters":[{"name":"definition_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Widget definition ID (UUID)","title":"Definition Id"},"description":"Widget definition ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromoteWidgetDefinitionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/widgets/verdicts":{"post":{"tags":["widgets"],"summary":"Create Verdict","operationId":"create_verdict_api_v1_widgets_verdicts_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateVerdictRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/widgets/verdicts/{verdict_id}/outcome":{"patch":{"tags":["widgets"],"summary":"Update Verdict Outcome","operationId":"update_verdict_outcome_api_v1_widgets_verdicts__verdict_id__outcome_patch","parameters":[{"name":"verdict_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Widget verdict ID (UUID)","title":"Verdict Id"},"description":"Widget verdict ID (UUID)"},{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateVerdictOutcomeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/widgets/gap-reports":{"post":{"tags":["widgets"],"summary":"Create Gap Report","operationId":"create_gap_report_api_v1_widgets_gap_reports_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateGapReportRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/widgets/assess":{"post":{"tags":["widgets"],"summary":"Assess Widget","description":"A freeform prompt -> a fit/compose/dedup/gap verdict + a draft the\nuser can place. DASHBOARD_GENERATE (editor+, client-scoped): the gate\nfollows what the call spends (one LLM run per request, like the STR-531\nauthoring routes) and only an editor can persist the result; a verdict\nis still a draft, not a\nwrite — anyone who can see the client can draft for it. Definition\nwrites stay REPORT_MUTATE (see `create_definition`).","operationId":"assess_widget_api_v1_widgets_assess_post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","description":"Bearer token for authentication","title":"Authorization"},"description":"Bearer token for authentication"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssessWidgetRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/healthz":{"get":{"summary":"Healthz","operationId":"healthz_healthz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/APIResponse"}}}}}}}},"components":{"schemas":{"APIResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"data":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Data"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details"}},"type":"object","required":["success","message"],"title":"APIResponse"},"AdAccount":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"status":{"anyOf":[{"$ref":"#/components/schemas/AdAccountStatus"},{"type":"null"}]}},"type":"object","required":["id","name"],"title":"AdAccount"},"AdAccountStatus":{"type":"string","enum":["ACTIVE","INACTIVE"],"title":"AdAccountStatus","description":"Ad account status enum."},"AdData":{"properties":{"id":{"type":"string","title":"Id"},"platform_ad_id":{"type":"string","title":"Platform Ad Id"},"platform_ad_name":{"type":"string","title":"Platform Ad Name"},"adgroup_ids":{"items":{"type":"string"},"type":"array","title":"Adgroup Ids"},"campaign_ids":{"items":{"type":"string"},"type":"array","title":"Campaign Ids","default":[]},"creative_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Creative Title"},"creative_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Creative Body"},"thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnail Url"},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Url"},"content_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Type"},"creative_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Creative Key"}},"type":"object","required":["id","platform_ad_id","platform_ad_name","adgroup_ids"],"title":"AdData","description":"Ad with ad group associations."},"AdGroupData":{"properties":{"id":{"type":"string","title":"Id"},"platform_adgroup_id":{"type":"string","title":"Platform Adgroup Id"},"platform_adgroup_name":{"type":"string","title":"Platform Adgroup Name"},"campaign_ids":{"items":{"type":"string"},"type":"array","title":"Campaign Ids"}},"type":"object","required":["id","platform_adgroup_id","platform_adgroup_name","campaign_ids"],"title":"AdGroupData","description":"Ad group with campaign associations."},"AddPersonaRequest":{"properties":{"display_name":{"type":"string","maxLength":200,"minLength":1,"title":"Display Name"},"role":{"type":"string","enum":["editor","viewer","member"],"title":"Role"},"client_scope_keys":{"items":{"type":"string"},"type":"array","maxItems":50,"title":"Client Scope Keys"},"password":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Password","description":"Optional. Set exactly this password instead of generating one (12+ characters). Returned once, never stored."}},"type":"object","required":["display_name","role"],"title":"AddPersonaRequest"},"AdjustParametersRequest":{"properties":{"client_id":{"type":"string","format":"uuid","title":"Client Id","description":"Client that owns the target entity. Authorization subject: the caller must hold parameter_adjustments.write on this client, and the entity must belong to it."},"platform":{"type":"string","enum":["fb_marketing","tiktok_marketing","ttd_marketing"],"title":"Platform","description":"Advertising platform slug identifier"},"scope":{"type":"string","enum":["platform","campaign","ad_set","ad_group","ad"],"title":"Scope","description":"Entity type to adjust (ad_set and ad_group are equivalent). Use 'platform' for account-wide bulk operations when supported by a platform adapter."},"entity_id":{"type":"string","title":"Entity Id","description":"Platform-specific entity identifier (campaign ID, ad set ID, or ad ID)"},"parameters":{"items":{"$ref":"#/components/schemas/AdjustmentParameter"},"type":"array","minItems":1,"title":"Parameters","description":"List of parameters to adjust"},"dry_run":{"type":"boolean","title":"Dry Run","description":"If true, validate the request but do not apply changes","default":false},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Request-level metadata (e.g., user context, idempotency key)"}},"type":"object","required":["client_id","platform","scope","entity_id","parameters"],"title":"AdjustParametersRequest","description":"Request payload for adjusting advertising entity parameters.\n\nRepresents a unified contract across advertising platforms with binary\noutcome semantics: either all parameters are applied successfully or none are.\n\nSupports adjustments at different hierarchy levels: campaign, ad set/ad group, or ad."},"AdjustmentParameter":{"properties":{"name":{"type":"string","enum":["daily_budget","lifetime_budget","status","bid_amount","bid_strategy","optimization_goal","campaign_objective","billing_event","start_date","end_date"],"title":"Name","description":"Parameter name to adjust"},"value":{"title":"Value","description":"New value for the parameter"},"unit":{"anyOf":[{"type":"string","enum":["currency","percent","enum","raw"]},{"type":"null"}],"title":"Unit","description":"Unit type for the value (helps adapters interpret the value correctly)"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Platform-specific metadata (e.g., currency code, timezone, constraints)"}},"type":"object","required":["name","value"],"title":"AdjustmentParameter","description":"Represents a single parameter to be adjusted on an advertising entity.\n\nSupports common cross-platform parameters with explicit typing and an\nescape-hatch metadata field for platform-specific nuances."},"AdminOverviewAiDashboarding":{"properties":{"month_start":{"type":"string","title":"Month Start"},"calls_this_month":{"type":"integer","title":"Calls This Month"},"cost_usd_this_month":{"type":"number","title":"Cost Usd This Month"},"unpriced_calls_this_month":{"type":"integer","title":"Unpriced Calls This Month"},"by_surface":{"items":{"$ref":"#/components/schemas/AdminOverviewAiSurface"},"type":"array","title":"By Surface"},"recent_runs":{"items":{"$ref":"#/components/schemas/AdminOverviewAiRun"},"type":"array","title":"Recent Runs"},"last_call_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Call At"}},"type":"object","required":["month_start","calls_this_month","cost_usd_this_month","unpriced_calls_this_month","by_surface","recent_runs","last_call_at"],"title":"AdminOverviewAiDashboarding","description":"Month-to-date spend of the four AI dashboarding surfaces from\npublic.llm_call (STR-1046, superseding ai_dashboard_llm_call), filtered to\nthe dashboarding surfaces, plus the last runs."},"AdminOverviewAiRun":{"properties":{"run_id":{"type":"string","title":"Run Id"},"request_id":{"type":"string","title":"Request Id"},"surface":{"type":"string","title":"Surface"},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"},"client_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Name"},"models":{"items":{"type":"string"},"type":"array","title":"Models"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"last_call_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Call At"},"calls":{"type":"integer","title":"Calls"},"cost_usd":{"type":"number","title":"Cost Usd"},"unpriced_calls":{"type":"integer","title":"Unpriced Calls"},"error_calls":{"type":"integer","title":"Error Calls"},"input_tokens":{"type":"integer","title":"Input Tokens"},"cached_input_tokens":{"type":"integer","title":"Cached Input Tokens"},"output_tokens":{"type":"integer","title":"Output Tokens"}},"type":"object","required":["run_id","request_id","surface","client_id","client_name","models","started_at","last_call_at","calls","cost_usd","unpriced_calls","error_calls","input_tokens","cached_input_tokens","output_tokens"],"title":"AdminOverviewAiRun","description":"One run (one server-minted run_id) from ai_dashboard_recent_runs."},"AdminOverviewAiSurface":{"properties":{"surface":{"type":"string","title":"Surface"},"calls":{"type":"integer","title":"Calls"},"cost_usd":{"type":"number","title":"Cost Usd"},"unpriced_calls":{"type":"integer","title":"Unpriced Calls"},"error_calls":{"type":"integer","title":"Error Calls"},"input_tokens":{"type":"integer","title":"Input Tokens"},"cached_input_tokens":{"type":"integer","title":"Cached Input Tokens"},"output_tokens":{"type":"integer","title":"Output Tokens"}},"type":"object","required":["surface","calls","cost_usd","unpriced_calls","error_calls","input_tokens","cached_input_tokens","output_tokens"],"title":"AdminOverviewAiSurface","description":"One surface's month-to-date row from ai_dashboard_spend_by_surface."},"AdminOverviewData":{"properties":{"agency_id":{"type":"string","title":"Agency Id"},"clients_total":{"type":"integer","title":"Clients Total"},"clients_by_status":{"additionalProperties":{"type":"integer"},"type":"object","title":"Clients By Status"},"ad_accounts_total":{"type":"integer","title":"Ad Accounts Total"},"ad_accounts_by_status":{"additionalProperties":{"type":"integer"},"type":"object","title":"Ad Accounts By Status"},"campaigns_configured":{"type":"integer","title":"Campaigns Configured"},"members":{"$ref":"#/components/schemas/AdminOverviewMembers"},"pipeline":{"$ref":"#/components/schemas/AdminOverviewPipeline"},"llm_by_feature":{"anyOf":[{"items":{"$ref":"#/components/schemas/AdminOverviewLlmFeature"},"type":"array"},{"type":"null"}],"title":"Llm By Feature"},"ai_dashboarding":{"anyOf":[{"$ref":"#/components/schemas/AdminOverviewAiDashboarding"},{"type":"null"}]}},"type":"object","required":["agency_id","clients_total","clients_by_status","ad_accounts_total","ad_accounts_by_status","campaigns_configured","members","pipeline"],"title":"AdminOverviewData","description":"Everything the Admin tab shows from Supabase in one response."},"AdminOverviewLlmFeature":{"properties":{"feature":{"type":"string","title":"Feature"},"calls":{"type":"integer","title":"Calls"},"cost_usd":{"type":"number","title":"Cost Usd"},"unpriced_calls":{"type":"integer","title":"Unpriced Calls"},"error_calls":{"type":"integer","title":"Error Calls"},"input_tokens":{"type":"integer","title":"Input Tokens"},"cached_input_tokens":{"type":"integer","title":"Cached Input Tokens"},"output_tokens":{"type":"integer","title":"Output Tokens"}},"type":"object","required":["feature","calls","cost_usd","unpriced_calls","error_calls","input_tokens","cached_input_tokens","output_tokens"],"title":"AdminOverviewLlmFeature","description":"One feature's month-to-date LLM spend (STR-1048/STR-188 subset).\n\nDistinct from `AdminOverviewAiSurface`, which covers ONLY the four AI\ndashboarding surfaces. This covers EVERY apps/api LLM caller — news\nrelevance, brand memory chat, client context, document extraction, the\ndemo composer — which between them are most of the calls and were\ninvisible in this panel until now."},"AdminOverviewMembers":{"properties":{"total":{"type":"integer","title":"Total"},"by_role":{"additionalProperties":{"type":"integer"},"type":"object","title":"By Role"},"pending_invites":{"type":"integer","title":"Pending Invites"},"seen_last_30d":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seen Last 30D"},"seen_basis":{"type":"string","title":"Seen Basis","default":"last_sign_in_at"}},"type":"object","required":["total","by_role","pending_invites","seen_last_30d"],"title":"AdminOverviewMembers","description":"Roster shape for the admin overview."},"AdminOverviewPipeline":{"properties":{"runs_last_7d":{"type":"integer","title":"Runs Last 7D"},"failures_last_7d":{"type":"integer","title":"Failures Last 7D"},"last_run_job":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Run Job"},"last_run_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Run State"},"last_run_started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Run Started At"},"last_run_ended_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Run Ended At"},"recent_runs":{"items":{"$ref":"#/components/schemas/AdminOverviewPipelineRun"},"type":"array","title":"Recent Runs"},"runs_total":{"type":"integer","title":"Runs Total"}},"type":"object","required":["runs_last_7d","failures_last_7d","last_run_job","last_run_state","last_run_started_at","last_run_ended_at","recent_runs","runs_total"],"title":"AdminOverviewPipeline","description":"Data-pipeline recency for the agency (public.orchestration_runs,\nattributed via metadata.tenant_ids)."},"AdminOverviewPipelineRun":{"properties":{"job_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Name"},"state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"ended_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ended At"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"platforms":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Platforms"},"connection_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Connection Count"}},"type":"object","required":["job_name","state","started_at","ended_at","error_message","platforms","connection_count"],"title":"AdminOverviewPipelineRun","description":"One orchestration run row, as the Admin tab's log view shows it."},"AdminOverviewResponse":{"properties":{"data":{"$ref":"#/components/schemas/AdminOverviewData"}},"type":"object","required":["data"],"title":"AdminOverviewResponse","description":"Response wrapper for the admin overview."},"AdminRunsPageResponse":{"properties":{"runs":{"items":{"$ref":"#/components/schemas/AdminOverviewPipelineRun"},"type":"array","title":"Runs"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"per_page":{"type":"integer","title":"Per Page"}},"type":"object","required":["runs","total","page","per_page"],"title":"AdminRunsPageResponse","description":"One page of the agency's orchestration-run log (cog → Admin tab)."},"AgencyInput":{"properties":{"mode":{"type":"string","enum":["create","existing"],"title":"Mode"},"name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Name"},"agency_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Agency Id"},"owner_email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Owner Email"},"owner_first_name":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Owner First Name"},"owner_last_name":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Owner Last Name"}},"type":"object","required":["mode"],"title":"AgencyInput"},"AgencyMembersResponse":{"properties":{"members":{"items":{"$ref":"#/components/schemas/MemberData"},"type":"array","title":"Members"},"pending_invites":{"items":{"$ref":"#/components/schemas/PendingInviteData"},"type":"array","title":"Pending Invites"}},"type":"object","required":["members","pending_invites"],"title":"AgencyMembersResponse","description":"Response model for agency members and invites."},"AgencyResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Url"},"num_employees":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Num Employees"},"num_clients":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Num Clients"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"currency_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency Code"}},"type":"object","required":["id","name","website","logo_url","num_employees","num_clients","created_at","updated_at"],"title":"AgencyResponse","description":"Response model for agency data."},"AnalyzeRequest":{"properties":{"sheet":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sheet"}},"type":"object","title":"AnalyzeRequest"},"Answer":{"properties":{"question_id":{"type":"string","title":"Question Id"},"upload_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":500},{"type":"null"}],"title":"Upload Ids"},"answer":{"additionalProperties":true,"type":"object","title":"Answer"}},"type":"object","required":["question_id"],"title":"Answer"},"Answers":{"properties":{"answers":{"items":{"$ref":"#/components/schemas/Answer"},"type":"array","title":"Answers"}},"type":"object","required":["answers"],"title":"Answers"},"AppliedRequest":{"properties":{"board_before":{"additionalProperties":true,"type":"object","title":"Board Before"}},"type":"object","required":["board_before"],"title":"AppliedRequest"},"AssessCard":{"properties":{"type":{"type":"string","maxLength":64,"title":"Type"},"name":{"type":"string","maxLength":400,"title":"Name"},"description":{"type":"string","maxLength":400,"title":"Description","default":""},"purpose":{"items":{"type":"string"},"type":"array","maxItems":12,"title":"Purpose"},"metrics":{"$ref":"#/components/schemas/AssessCardMetrics"},"dimensions":{"$ref":"#/components/schemas/AssessCardDimensions"},"encodingChannels":{"items":{"type":"string"},"type":"array","maxItems":8,"title":"Encodingchannels"},"controls":{"items":{"$ref":"#/components/schemas/WidgetControl"},"type":"array","maxItems":8,"title":"Controls"},"exemplarPrompts":{"items":{"type":"string"},"type":"array","maxItems":8,"title":"Exemplarprompts"},"whenToPrefer":{"items":{"$ref":"#/components/schemas/AssessCardWhenToPrefer"},"type":"array","maxItems":8,"title":"Whentoprefer"},"notWhen":{"items":{"type":"string"},"type":"array","maxItems":8,"title":"Notwhen"},"layoutFootprint":{"$ref":"#/components/schemas/AssessCardLayoutFootprint"}},"type":"object","required":["type","name"],"title":"AssessCard"},"AssessCardDimensions":{"properties":{"count":{"type":"integer","minimum":0.0,"title":"Count","default":0},"cardinalitySweetSpot":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Cardinalitysweetspot"},"temporalRequired":{"type":"boolean","title":"Temporalrequired","default":false}},"type":"object","title":"AssessCardDimensions"},"AssessCardLayoutFootprint":{"properties":{"minW":{"type":"integer","maximum":12.0,"minimum":1.0,"title":"Minw","default":1},"minH":{"type":"integer","maximum":12.0,"minimum":1.0,"title":"Minh","default":1}},"type":"object","title":"AssessCardLayoutFootprint"},"AssessCardMetrics":{"properties":{"min":{"type":"integer","minimum":0.0,"title":"Min","default":1},"max":{"type":"integer","minimum":0.0,"title":"Max","default":1},"additiveOnly":{"type":"boolean","title":"Additiveonly","default":false}},"type":"object","title":"AssessCardMetrics"},"AssessCardWhenToPrefer":{"properties":{"over":{"type":"string","maxLength":64,"title":"Over","default":""},"when":{"type":"string","maxLength":400,"title":"When","default":""}},"type":"object","title":"AssessCardWhenToPrefer"},"AssessMetric":{"properties":{"id":{"type":"string","maxLength":64,"title":"Id"},"label":{"type":"string","maxLength":120,"title":"Label"},"format":{"type":"string","enum":["currency","percent","ratio","integer","number"],"title":"Format","default":"number"},"additive":{"type":"boolean","title":"Additive","default":false},"aliases":{"items":{"type":"string","maxLength":80},"type":"array","maxItems":12,"title":"Aliases"}},"type":"object","required":["id","label"],"title":"AssessMetric"},"AssessOp":{"properties":{"name":{"type":"string","maxLength":64,"title":"Name"},"semantics":{"type":"string","maxLength":600,"title":"Semantics","default":""},"params_schema":{"additionalProperties":true,"type":"object","title":"Params Schema"},"layer":{"type":"string","maxLength":64,"title":"Layer","default":""}},"type":"object","required":["name"],"title":"AssessOp"},"AssessWidgetRequest":{"properties":{"semantic_catalog":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Semantic Catalog"},"semantic_catalog_hash":{"anyOf":[{"type":"string","pattern":"^[a-f0-9]{64}$"},{"type":"null"}],"title":"Semantic Catalog Hash"},"client_id":{"type":"string","title":"Client Id"},"report_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Id"},"prompt":{"type":"string","maxLength":2000,"minLength":1,"title":"Prompt"},"cards":{"items":{"$ref":"#/components/schemas/AssessCard"},"type":"array","maxItems":40,"minItems":1,"title":"Cards"},"ops":{"items":{"$ref":"#/components/schemas/AssessOp"},"type":"array","maxItems":20,"title":"Ops"},"metrics":{"items":{"$ref":"#/components/schemas/AssessMetric"},"type":"array","maxItems":200,"title":"Metrics"},"existing_widgets":{"items":{"$ref":"#/components/schemas/ExistingWidget"},"type":"array","maxItems":60,"title":"Existing Widgets"},"promoted":{"items":{"$ref":"#/components/schemas/PromotedRef"},"type":"array","maxItems":200,"title":"Promoted"},"mode":{"type":"string","enum":["create","amend"],"title":"Mode","default":"create"},"current_envelope":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Current Envelope"}},"additionalProperties":false,"type":"object","required":["client_id","prompt","cards"],"title":"AssessWidgetRequest","description":"STR-675 — the FE-built assess payload: `catalogPayload.ts:buildCatalogPayload`'s\nprecedent, extended with the ops registry, the client's metric catalog,\nthe dashboard's existing widgets, and the agency's promoted templates.\nNo `model` field — the model is the agency's `widget_ai_edit` setting\n(`model_settings.resolve_model`), chosen by an admin on the settings page;\na request-level override would let the browser pick which model bills\nthe agency.\n\n`mode == \"amend\"` is the editor's \"AI edit\" path: the widget being\namended rides `current_envelope`, and the judge is asked to revise it\nrather than draft something new. `create` (the default) is unchanged."},"AssignAdvertisersRequest":{"properties":{"client_id":{"type":"string","title":"Client Id","description":"Client ID to assign advertisers to"},"platform":{"type":"string","title":"Platform","description":"Platform name (e.g., 'tiktok', 'meta')"},"advertiser_ids":{"items":{"type":"string"},"type":"array","title":"Advertiser Ids","description":"List of advertiser IDs to assign"}},"type":"object","required":["client_id","platform","advertiser_ids"],"title":"AssignAdvertisersRequest","description":"Request body for assigning advertisers to a client."},"AssignableMemberData":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Name"}},"type":"object","required":["user_id","email","first_name","last_name"],"title":"AssignableMemberData","description":"A teammate who can be assigned an insight / action step — identity ONLY.\n\nDeliberately carries NO role, NO client scope, and NO pending invites: it's\nthe read-tier roster for the board's assignee picker, so an editor/viewer can\npopulate the dropdown they're allowed to see without exposing membership\nmanagement data (which lives on the AGENCY_MANAGE_ROLES `/members` endpoint)."},"AssignableMembersResponse":{"properties":{"members":{"items":{"$ref":"#/components/schemas/AssignableMemberData"},"type":"array","title":"Members"}},"type":"object","required":["members"],"title":"AssignableMembersResponse","description":"Response model for the assignable-members roster (STR-249)."},"AssistDashboardRequest":{"properties":{"semantic_catalog":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Semantic Catalog"},"semantic_catalog_hash":{"anyOf":[{"type":"string","pattern":"^[a-f0-9]{64}$"},{"type":"null"}],"title":"Semantic Catalog Hash"},"client_id":{"type":"string","title":"Client Id"},"question":{"type":"string","maxLength":2000,"minLength":1,"title":"Question"},"current_picks":{"items":{"$ref":"#/components/schemas/WidgetPick"},"type":"array","maxItems":100,"title":"Current Picks"},"catalog":{"items":{"$ref":"#/components/schemas/CatalogWidget"},"type":"array","maxItems":40,"minItems":1,"title":"Catalog"},"prompt":{"type":"string","maxLength":2000,"title":"Prompt","default":""},"tags":{"items":{"type":"string","maxLength":64},"type":"array","maxItems":12,"title":"Tags"},"archetype":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Archetype"},"history":{"items":{"$ref":"#/components/schemas/AssistHistoryEntry"},"type":"array","maxItems":12,"title":"History"},"layout":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Layout"},"layouts":{"items":{"$ref":"#/components/schemas/LayoutInfo"},"type":"array","maxItems":12,"title":"Layouts"},"bands":{"items":{"$ref":"#/components/schemas/BandInfo"},"type":"array","maxItems":20,"title":"Bands"},"layout_grammar":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Layout Grammar"},"quiet_platforms":{"items":{"type":"string"},"type":"array","maxItems":12,"title":"Quiet Platforms"}},"type":"object","required":["client_id","question","catalog"],"title":"AssistDashboardRequest"},"AssistFeedbackRequest":{"properties":{"client_id":{"type":"string","title":"Client Id"},"surface":{"type":"string","enum":["assist","generate"],"title":"Surface","default":"assist"},"rating":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":1.0},{"type":"null"}],"title":"Rating"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"verdict":{"anyOf":[{"type":"string","enum":["up","down"]},{"type":"null"}],"title":"Verdict"},"note":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Note"},"question":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Question"},"advice":{"anyOf":[{"type":"string","maxLength":8000},{"type":"null"}],"title":"Advice"},"model":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Model"},"stop_reason":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Stop Reason"},"applied":{"type":"boolean","title":"Applied","default":false},"tools":{"items":{"$ref":"#/components/schemas/AssistToolReceipt"},"type":"array","maxItems":16,"title":"Tools"},"change_summary":{"items":{"type":"string"},"type":"array","maxItems":32,"title":"Change Summary"},"report_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Id"}},"type":"object","required":["client_id"],"title":"AssistFeedbackRequest","description":"STR-680 — one turn's feedback. Graded since STR-1044.\n\nCarries the CASE, not just the score: the question, what came back,\nwhich tools ran and what actually changed. A bare thumbs-down is a\nnumber nobody can act on; this is something a person can re-ask.\n\nEvery free-text field is bounded here as well as in the database — a\nmodel's own output is the input to this endpoint, and an unbounded\nsink one runaway loop from being the largest table we have."},"AssistHistoryEntry":{"properties":{"role":{"type":"string","enum":["user","assistant"],"title":"Role"},"text":{"type":"string","maxLength":1000,"minLength":1,"title":"Text"}},"type":"object","required":["role","text"],"title":"AssistHistoryEntry"},"AssistToolReceipt":{"properties":{"tool":{"type":"string","maxLength":64,"title":"Tool"},"count":{"type":"integer","maximum":1000.0,"minimum":0.0,"title":"Count","default":0},"rejected":{"type":"integer","maximum":1000.0,"minimum":0.0,"title":"Rejected","default":0}},"type":"object","required":["tool"],"title":"AssistToolReceipt"},"AuthStateRequest":{"properties":{"agency_id":{"type":"string","format":"uuid","title":"Agency Id"},"user_ids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":50,"minItems":1,"title":"User Ids"}},"type":"object","required":["agency_id","user_ids"],"title":"AuthStateRequest","description":"STR-2331: enrolment for a SET of users, in one call."},"BandInfo":{"properties":{"id":{"type":"string","maxLength":48,"title":"Id"},"seats":{"type":"integer","maximum":8.0,"minimum":1.0,"title":"Seats","default":1},"band":{"$ref":"#/components/schemas/BandObject"}},"type":"object","required":["id","band"],"title":"BandInfo","description":"One named band component from the FE's BAND_LIBRARY: the id the\ndesigner references, its seat count, and the canonical band object the\nserver resolves the name into."},"BandObject":{"properties":{"slots":{"items":{"$ref":"#/components/schemas/BandSlot"},"type":"array","maxItems":4,"minItems":1,"title":"Slots"},"rows":{"anyOf":[{"type":"integer","maximum":12.0,"minimum":1.0},{"type":"null"}],"title":"Rows"},"hero":{"type":"boolean","title":"Hero","default":false}},"type":"object","required":["slots"],"title":"BandObject","description":"The canonical band shape (mirrors the FE's RowBand / the wire's\nInlineBandSpec band entries): slots summing to 12, an optional fixed\nheight in grid rows, an optional hero flag."},"BandSlot":{"properties":{"span":{"type":"integer","maximum":12.0,"minimum":1.0,"title":"Span"},"role":{"anyOf":[{"type":"string","maxLength":24},{"type":"null"}],"title":"Role"},"stack":{"anyOf":[{"items":{"$ref":"#/components/schemas/BandStackCell"},"type":"array","maxItems":4},{"type":"null"}],"title":"Stack"}},"type":"object","required":["span"],"title":"BandSlot","description":"One slot in a band: a span (grammar: from {4,6,8,12}, summing to 12\nacross the band), optionally role-tagged; `stack` makes it a vertical\ncolumn of 2-3 cells partitioning the band's fixed height."},"BandStackCell":{"properties":{"rows":{"type":"integer","maximum":12.0,"minimum":1.0,"title":"Rows"},"role":{"anyOf":[{"type":"string","maxLength":24},{"type":"null"}],"title":"Role"}},"type":"object","required":["rows"],"title":"BandStackCell","description":"One cell of a stacked slot: `rows` tall, optionally role-tagged."},"BindBy":{"properties":{"qualifier":{"type":"string","title":"Qualifier"},"values":{"additionalProperties":{"type":"string"},"type":"object","title":"Values"}},"additionalProperties":false,"type":"object","required":["qualifier"],"title":"BindBy","description":"A per-value binding (STR-1027 E2): a context-dependent metric column\n(Meta's `Results`, whose meaning `Result indicator` names per row) binds\neach qualifier value to its own Standard semantic, or to `ignore`."},"BindReportRequest":{"properties":{"report_id":{"type":"string","format":"uuid","title":"Report Id"}},"type":"object","required":["report_id"],"title":"BindReportRequest"},"BoardFilters":{"properties":{"start":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Start"},"end":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"End"},"preset":{"anyOf":[{"type":"string","enum":["last_7_days","last_30_days","last_90_days","this_month","last_month","all_time"]},{"type":"null"}],"title":"Preset"},"platforms":{"items":{"type":"string","maxLength":64},"type":"array","maxItems":12,"title":"Platforms"},"campaign_group_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Campaign Group Id"}},"type":"object","title":"BoardFilters","description":"The board's filters as the builder reads and sets them (STR-2152)."},"BoardFitRequest":{"properties":{"semantic_catalog":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Semantic Catalog"},"semantic_catalog_hash":{"anyOf":[{"type":"string","pattern":"^[a-f0-9]{64}$"},{"type":"null"}],"title":"Semantic Catalog Hash"},"client_id":{"type":"string","title":"Client Id"},"current_picks":{"items":{"$ref":"#/components/schemas/WidgetPick"},"type":"array","maxItems":100,"title":"Current Picks"},"board_filters":{"anyOf":[{"$ref":"#/components/schemas/BoardFilters"},{"type":"null"}]}},"type":"object","required":["client_id"],"title":"BoardFitRequest","description":"`POST /fit` (STR-2508): a saved board's cards and filters."},"Body_add_campaign_context_files_api_v1_clients__client_id__campaign_context_files_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files","description":"Source documents"},"campaign_group_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"}},"type":"object","required":["files"],"title":"Body_add_campaign_context_files_api_v1_clients__client_id__campaign_context_files_post"},"Body_add_campaign_file_api_v1_clients__client_id__campaign_groups__campaign_group_id__files_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File","description":"One export"},"sheet":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sheet"},"counting_drop_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counting Drop Id"}},"type":"object","required":["file"],"title":"Body_add_campaign_file_api_v1_clients__client_id__campaign_groups__campaign_group_id__files_post"},"Body_analyze_upload_api_v1_demo_studio_environments__environment_id__uploads_analyze_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_analyze_upload_api_v1_demo_studio_environments__environment_id__uploads_analyze_post"},"Body_create_agency_agencies_post":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"logo":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Logo"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"num_employees":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Num Employees"},"num_clients":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Num Clients"}},"type":"object","required":["name"],"title":"Body_create_agency_agencies_post"},"Body_create_client_api_v1_clients_post":{"properties":{"name":{"type":"string","title":"Name"},"theme":{"type":"string","title":"Theme"},"agency_id":{"type":"string","title":"Agency Id"},"logo":{"type":"string","contentMediaType":"application/octet-stream","title":"Logo"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"client_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Context"},"client_palette":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Palette"},"brand_color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Brand Color"},"source_colors":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Colors"},"currency_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency Code"}},"type":"object","required":["name","theme","agency_id","logo"],"title":"Body_create_client_api_v1_clients_post"},"Body_create_environment_from_brief_api_v1_demo_studio_environments_from_brief_post":{"properties":{"brief":{"type":"string","title":"Brief","description":"The brief, as JSON (`BriefInput`)."},"documents":{"anyOf":[{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array"},{"type":"null"}],"title":"Documents"}},"type":"object","required":["brief"],"title":"Body_create_environment_from_brief_api_v1_demo_studio_environments_from_brief_post"},"Body_create_upload_api_v1_clients__client_id__uploads_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File","description":"One CSV / TSV / TXT / XLSX / XLSM / PDF export"},"sheet":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sheet"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"campaign_group_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"},"force":{"type":"boolean","title":"Force","default":false},"campaign_basis":{"anyOf":[{"type":"string","enum":["file","drop","default","campaign_files"]},{"type":"null"}],"title":"Campaign Basis"},"analyze":{"type":"boolean","title":"Analyze","default":false},"counting_drop_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Counting Drop Id"}},"type":"object","required":["file"],"title":"Body_create_upload_api_v1_clients__client_id__uploads_post"},"Body_extract_campaign_context_api_v1_clients__client_id__campaign_context_extract_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files","description":"Source documents"},"campaign_group_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"}},"type":"object","required":["files"],"title":"Body_extract_campaign_context_api_v1_clients__client_id__campaign_context_extract_post"},"Body_load_upload_api_v1_demo_studio_environments__environment_id__uploads_load_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"request":{"type":"string","title":"Request","description":"A JSON `UploadLoadRequest`."}},"type":"object","required":["file","request"],"title":"Body_load_upload_api_v1_demo_studio_environments__environment_id__uploads_load_post"},"Body_submit_extract_job_api_v1_clients__client_id__campaign_context_extract_jobs_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files","description":"Source documents"},"campaign_group_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"}},"type":"object","required":["files"],"title":"Body_submit_extract_job_api_v1_clients__client_id__campaign_context_extract_jobs_post"},"Body_submit_files_add_job_api_v1_clients__client_id__campaign_context_files_jobs_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files","description":"Source documents"},"campaign_group_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"}},"type":"object","required":["files"],"title":"Body_submit_files_add_job_api_v1_clients__client_id__campaign_context_files_jobs_post"},"Body_update_agency_agencies__agency_id__patch":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"logo":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Logo"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"num_employees":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Num Employees"},"num_clients":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Num Clients"},"currency_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency Code"}},"type":"object","required":["name"],"title":"Body_update_agency_agencies__agency_id__patch"},"Body_update_client_api_v1_clients__client_id__patch":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"theme":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Theme"},"logo":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Logo"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"client_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Context"},"client_palette":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Palette"},"brand_color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Brand Color"},"source_colors":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Colors"},"currency_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency Code"}},"type":"object","title":"Body_update_client_api_v1_clients__client_id__patch"},"Body_upload_source_api_v1_dashboards_sources_post":{"properties":{"client_id":{"type":"string","format":"uuid","title":"Client Id"},"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"thread_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Thread Id"}},"type":"object","required":["client_id","file"],"title":"Body_upload_source_api_v1_dashboards_sources_post"},"BreakdownGroup":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"rule":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Rule"},"include_keys":{"items":{"type":"string"},"type":"array","title":"Include Keys"},"exclude_keys":{"items":{"type":"string"},"type":"array","title":"Exclude Keys"}},"type":"object","required":["name"],"title":"BreakdownGroup"},"BreakdownRequest":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"level":{"type":"string","enum":["campaign","ad_group","ad","creative"],"title":"Level"},"groups":{"items":{"$ref":"#/components/schemas/BreakdownGroup"},"type":"array","maxItems":12,"minItems":2,"title":"Groups"}},"type":"object","required":["name","level","groups"],"title":"BreakdownRequest"},"BreakdownSegment":{"properties":{"label":{"type":"string","title":"Label"},"value":{"type":"number","title":"Value"},"percentage":{"type":"number","title":"Percentage"}},"type":"object","required":["label","value","percentage"],"title":"BreakdownSegment","description":"A pie chart segment - percentage is 0-1, AI converts to display."},"BudgetRequest":{"properties":{"ceiling_usd":{"anyOf":[{"type":"number","minimum":0.0},{"type":"null"}],"title":"Ceiling Usd","description":"Monthly ceiling in USD. 0 disables the rail. Null restores the deployment default."}},"type":"object","title":"BudgetRequest"},"BuilderScope":{"properties":{"kind":{"type":"string","enum":["board","widget","new_widget"],"title":"Kind","default":"board"},"widget_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Widget Id"}},"type":"object","title":"BuilderScope"},"BuilderTurnRequest":{"properties":{"semantic_catalog":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Semantic Catalog"},"semantic_catalog_hash":{"anyOf":[{"type":"string","pattern":"^[a-f0-9]{64}$"},{"type":"null"}],"title":"Semantic Catalog Hash"},"client_id":{"type":"string","title":"Client Id"},"thread_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Thread Id"},"message":{"type":"string","maxLength":2000,"minLength":1,"title":"Message"},"scope":{"$ref":"#/components/schemas/BuilderScope"},"source_ids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":5,"title":"Source Ids"},"use_dashboard_dates":{"type":"boolean","title":"Use Dashboard Dates","default":true},"board_filters":{"anyOf":[{"$ref":"#/components/schemas/BoardFilters"},{"type":"null"}]},"report_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Report Id"},"current_picks":{"items":{"$ref":"#/components/schemas/WidgetPick"},"type":"array","maxItems":100,"title":"Current Picks"},"catalog":{"items":{"$ref":"#/components/schemas/CatalogWidget"},"type":"array","maxItems":40,"minItems":1,"title":"Catalog"},"prompt":{"type":"string","maxLength":2000,"title":"Prompt","default":""},"tags":{"items":{"type":"string","maxLength":64},"type":"array","maxItems":12,"title":"Tags"},"archetype":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Archetype"},"layout":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Layout"},"layouts":{"items":{"$ref":"#/components/schemas/LayoutInfo"},"type":"array","maxItems":12,"title":"Layouts"},"bands":{"items":{"$ref":"#/components/schemas/BandInfo"},"type":"array","maxItems":20,"title":"Bands"},"layout_grammar":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Layout Grammar"},"quiet_platforms":{"items":{"type":"string"},"type":"array","maxItems":12,"title":"Quiet Platforms"},"repair":{"type":"boolean","title":"Repair","default":false}},"type":"object","required":["client_id","message","catalog"],"title":"BuilderTurnRequest","description":"`POST /turn` (STR-2152): an assist request without `question` and\n`history` (the thread holds the history), plus the message, its scope,\nattached sources, the board's filters and the report it belongs to."},"BulkSource":{"properties":{"upload_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Upload Ids"},"source":{"$ref":"#/components/schemas/Source"}},"type":"object","required":["upload_ids","source"],"title":"BulkSource"},"Campaign":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"}},"type":"object","required":["id","name"],"title":"Campaign"},"CampaignChange":{"properties":{"value":{"type":"string","maxLength":1000,"minLength":1,"title":"Value"},"included":{"type":"boolean","title":"Included"}},"additionalProperties":false,"type":"object","required":["value","included"],"title":"CampaignChange"},"CampaignData":{"properties":{"id":{"type":"string","title":"Id"},"platform_campaign_id":{"type":"string","title":"Platform Campaign Id"},"platform_campaign_name":{"type":"string","title":"Platform Campaign Name"},"platform_id":{"type":"string","title":"Platform Id"},"campaign_group_ids":{"items":{"type":"string"},"type":"array","title":"Campaign Group Ids"},"primary_campaign_group_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Campaign Group Id"},"ingestion_mode":{"type":"string","title":"Ingestion Mode","default":"connector"}},"type":"object","required":["id","platform_campaign_id","platform_campaign_name","platform_id","campaign_group_ids"],"title":"CampaignData","description":"Campaign with platform and campaign group associations.\n\nSTR-116 — `campaign_group_ids` is the full membership list (the\ncampaign appears in all of these groups, organizationally).\n`primary_campaign_group_id` is the one group that \"owns\" the\ncampaign for attribution: spend/impression aggregators filter on\nprimary so totals don't double-count under cross-group sums.\nNull when the campaign isn't in any group yet."},"CampaignGroupData":{"properties":{"kind":{"type":"string","title":"Kind","default":"live"},"data_coverage_start":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data Coverage Start"},"data_coverage_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data Coverage End"},"last_upload_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Upload At"},"last_successful_sync":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Successful Sync"},"has_connected_accounts":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Has Connected Accounts"},"upload_file_names":{"items":{"type":"string"},"type":"array","title":"Upload File Names","default":[]},"last_uploaded_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Uploaded By Name"},"last_uploaded_by_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Uploaded By Email"},"reporting_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reporting Currency"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"week_anchor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Week Anchor"},"reporting_policy_version":{"type":"integer","title":"Reporting Policy Version","default":1},"dataset_names":{"items":{"type":"string"},"type":"array","title":"Dataset Names","default":[]},"dataset_count":{"type":"integer","title":"Dataset Count","default":0},"complete_through":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Complete Through"},"data_sources":{"items":{"$ref":"#/components/schemas/DataSourceFact"},"type":"array","title":"Data Sources","default":[]},"complete_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Complete From"},"hybrid_pacing":{"anyOf":[{"$ref":"#/components/schemas/HybridPacingFact"},{"type":"null"}]},"plan":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Plan"},"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"is_active":{"type":"boolean","title":"Is Active"},"goal":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Goal"},"start_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Date"},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Date"},"budget":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Budget"},"created_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By Name"},"created_by_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By Email"}},"type":"object","required":["id","name","is_active","goal"],"title":"CampaignGroupData"},"CampaignGroupResponse":{"properties":{"reporting_currency":{"anyOf":[{"type":"string","pattern":"^[A-Z]{3}$"},{"type":"null"}],"title":"Reporting Currency"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"week_anchor":{"anyOf":[{"type":"string","enum":["monday","week_ending_saturday","week_ending_sunday","broadcast"]},{"type":"null"}],"title":"Week Anchor"},"kind":{"type":"string","enum":["live","static","hybrid"],"title":"Kind","default":"live"},"separate_accounts":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Separate Accounts"},"data_coverage_start":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data Coverage Start"},"data_coverage_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data Coverage End"},"last_upload_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Upload At"},"last_uploaded_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Uploaded By"},"reporting_policy_version":{"type":"integer","title":"Reporting Policy Version","default":1},"success":{"type":"boolean","title":"Success"},"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"client_id":{"type":"string","title":"Client Id"},"campaign_ids":{"items":{"type":"string"},"type":"array","title":"Campaign Ids"},"status":{"type":"string","title":"Status"},"goal":{"anyOf":[{"type":"string","enum":["reach","conversion","engagement"]},{"type":"null"}],"title":"Goal"},"start_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Date"},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Date"},"budget":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Budget"}},"type":"object","required":["success","id","name","client_id","campaign_ids","status","goal"],"title":"CampaignGroupResponse"},"CampaignGroupsResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"data":{"items":{"$ref":"#/components/schemas/CampaignGroupData"},"type":"array","title":"Data"}},"type":"object","required":["success","data"],"title":"CampaignGroupsResponse","description":"STR-1042: the light read behind the campaign scope switcher."},"CampaignInput":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"kind":{"type":"string","enum":["static","live","hybrid"],"title":"Kind","default":"static"},"goal":{"anyOf":[{"type":"string","enum":["reach","conversion","engagement"]},{"type":"null"}],"title":"Goal"},"reporting_currency":{"anyOf":[{"type":"string","pattern":"^[A-Z]{3}$"},{"type":"null"}],"title":"Reporting Currency"},"timezone":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Timezone"},"week_anchor":{"anyOf":[{"type":"string","enum":["monday","week_ending_saturday","week_ending_sunday","broadcast"]},{"type":"null"}],"title":"Week Anchor"}},"type":"object","required":["name"],"title":"CampaignInput"},"CampaignPatchRequest":{"properties":{"campaign_group_id":{"type":"string","format":"uuid","title":"Campaign Group Id"},"reason":{"anyOf":[{"type":"string","enum":["first_drop","new_campaign"]},{"type":"null"}],"title":"Reason"}},"type":"object","required":["campaign_group_id"],"title":"CampaignPatchRequest","description":"`PATCH /{id}/campaign` (STR-1485): the campaign a person chose.\n`reason` (STR-1486 D20) is sent only when the page stores a file it bound\nto a campaign it just made (the first drop's, or a new one) and the\nserver could not bind it yet: it records the same `campaign_reason`\n`uploaded_campaign.bind_uploads` would have."},"CampaignsRequest":{"properties":{"mode":{"type":"string","enum":["first_drop","new"],"title":"Mode"},"name":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Name"},"goal":{"anyOf":[{"type":"string","enum":["reach","conversion","engagement"]},{"type":"null"}],"title":"Goal"},"upload_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":100},{"type":"null"}],"title":"Upload Ids"}},"type":"object","required":["mode"],"title":"CampaignsRequest","description":"`POST /campaigns` (STR-1486). `first_drop` makes \"<Client> uploads\"\nfor a client with no active uploaded campaign (or reuses its only one);\n`new` makes the named campaign. Either binds the given uploads that are\nthis client's, have no campaign and were never confirmed."},"CatalogWidget":{"properties":{"type":{"type":"string","maxLength":64,"title":"Type"},"name":{"type":"string","maxLength":120,"title":"Name"},"description":{"type":"string","maxLength":400,"title":"Description","default":""},"category":{"type":"string","maxLength":80,"title":"Category","default":""},"dataset_capable":{"type":"boolean","title":"Dataset Capable","default":false},"requires_metric":{"type":"boolean","title":"Requires Metric","default":false},"metrics":{"items":{"type":"string","maxLength":64},"type":"array","maxItems":64,"title":"Metrics"},"sizes":{"items":{"type":"string","enum":["hero","large","medium","compact"]},"type":"array","title":"Sizes"},"supports_3d":{"type":"boolean","title":"Supports 3D","default":false},"compares_platforms":{"type":"boolean","title":"Compares Platforms","default":false},"controls":{"items":{"$ref":"#/components/schemas/WidgetControl"},"type":"array","maxItems":8,"title":"Controls"},"min_span":{"additionalProperties":{"type":"integer"},"type":"object","title":"Min Span"},"max_metrics":{"additionalProperties":{"type":"integer"},"type":"object","title":"Max Metrics"}},"type":"object","required":["type","name"],"title":"CatalogWidget","description":"One renderable widget type, as declared by the frontend.\n\nEvery string is length-capped: catalog text is interpolated into the\nLLM prompt, so unbounded fields are a token-cost amplification vector\n(the request is authenticated and DASHBOARD_GENERATE-gated — editor+ since\nSTR-531 — but the catalog is still caller-supplied and must be bounded)."},"ChatTurn":{"properties":{"role":{"type":"string","enum":["operator","memory"],"title":"Role"},"content":{"type":"string","maxLength":4000,"title":"Content"}},"type":"object","required":["role","content"],"title":"ChatTurn"},"ClaimPatchModel":{"properties":{"index":{"type":"integer","minimum":0.0,"title":"Index"},"claim_text":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Claim Text"},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"integer"},{"type":"null"}],"title":"Value"},"unit":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Unit"}},"type":"object","required":["index"],"title":"ClaimPatchModel"},"ClientDataModel":{"properties":{"campaign_groups":{"items":{"$ref":"#/components/schemas/CampaignGroupData"},"type":"array","title":"Campaign Groups"},"platforms":{"items":{"$ref":"#/components/schemas/PlatformData"},"type":"array","title":"Platforms"},"campaigns":{"items":{"$ref":"#/components/schemas/CampaignData"},"type":"array","title":"Campaigns"},"ad_groups":{"items":{"$ref":"#/components/schemas/AdGroupData"},"type":"array","title":"Ad Groups"},"ads":{"items":{"$ref":"#/components/schemas/AdData"},"type":"array","title":"Ads"},"molecular_overlay":{"anyOf":[{"$ref":"#/components/schemas/MolecularOverlayData"},{"type":"null"}]}},"type":"object","required":["campaign_groups","platforms","campaigns","ad_groups","ads"],"title":"ClientDataModel","description":"Complete campaign data for a client."},"ClientDataResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"data":{"$ref":"#/components/schemas/ClientDataModel"}},"type":"object","required":["success","data"],"title":"ClientDataResponse","description":"Response model for client data."},"ClientEventRequest":{"properties":{"event":{"type":"string","const":"oauth_popup_blocked","title":"Event"},"platform":{"type":"string","enum":["meta","tiktok","google_ads","reddit_ads"],"maxLength":32,"title":"Platform"}},"type":"object","required":["event","platform"],"title":"ClientEventRequest","description":"Strictly whitelisted client event. Extend the Literals as new events\nare introduced — never accept free-form strings (log-injection sink)."},"ClientInput":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"currency_code":{"anyOf":[{"type":"string","pattern":"^[A-Z]{3}$"},{"type":"null"}],"title":"Currency Code"},"timezone":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Timezone"},"upload_raw_store":{"type":"string","enum":["supabase","gcs"],"title":"Upload Raw Store","default":"supabase"}},"type":"object","required":["name"],"title":"ClientInput"},"CloneEnvironmentRequest":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"prospect_name":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Prospect Name"},"prospect_kind":{"anyOf":[{"type":"string","enum":["brand","agency"]},{"type":"null"}],"title":"Prospect Kind"}},"type":"object","required":["name"],"title":"CloneEnvironmentRequest"},"ColumnChange":{"properties":{"name":{"type":"string","maxLength":500,"minLength":1,"title":"Name"},"role":{"type":"string","title":"Role"},"semantic":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Semantic"}},"additionalProperties":false,"type":"object","required":["name","role"],"title":"ColumnChange"},"ComposeRequest":{"properties":{"door":{"type":"string","title":"Door","description":"Which area's tools to scope this prompt to. A prompt outside the door's scope is refused with a message naming the area that owns it."},"prompt":{"type":"string","maxLength":1000,"minLength":1,"title":"Prompt"}},"type":"object","required":["door","prompt"],"title":"ComposeRequest"},"ConfirmRequest":{"properties":{"plan":{"$ref":"#/components/schemas/Plan"},"target":{"$ref":"#/components/schemas/Target"},"merge":{"$ref":"#/components/schemas/Merge"},"save_template":{"type":"boolean","title":"Save Template","default":false},"template_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Template Name"},"fx_snapshot_hash":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Fx Snapshot Hash"}},"additionalProperties":false,"type":"object","title":"ConfirmRequest"},"CreateCampaignGroupRequest":{"properties":{"reporting_currency":{"anyOf":[{"type":"string","pattern":"^[A-Z]{3}$"},{"type":"null"}],"title":"Reporting Currency"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"week_anchor":{"anyOf":[{"type":"string","enum":["monday","week_ending_saturday","week_ending_sunday","broadcast"]},{"type":"null"}],"title":"Week Anchor"},"client_id":{"type":"string","title":"Client Id"},"name":{"type":"string","title":"Name"},"campaign_ids":{"items":{"type":"string"},"type":"array","title":"Campaign Ids"},"kind":{"type":"string","enum":["live","static","hybrid"],"title":"Kind","default":"live"},"goal":{"type":"string","enum":["reach","conversion","engagement"],"title":"Goal"},"start_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Date"},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Date"},"budget":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Budget"}},"type":"object","required":["client_id","name","goal"],"title":"CreateCampaignGroupRequest"},"CreateDatasetRequest":{"properties":{"client_id":{"type":"string","format":"uuid","title":"Client Id"},"name":{"type":"string","maxLength":512,"minLength":1,"title":"Name"},"payload":{"additionalProperties":true,"type":"object","title":"Payload"},"upload_ids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":100,"title":"Upload Ids"}},"type":"object","required":["client_id","name","payload"],"title":"CreateDatasetRequest"},"CreateEnvironmentRequest":{"properties":{"agency_id":{"type":"string","format":"uuid","title":"Agency Id","description":"The agency whose demos this operator manages. Authorization is on THIS agency; the environment gets its own newly-created one."},"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"pack":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Pack","description":"A Demo Pack manifest."},"pack_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Pack Id","description":"A golden pack's `meta.pack_id`, from GET /packs/golden."},"template":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Template","description":"A vertical key from GET /packs/golden's `templates`. The library picks the pack built for it, newest version first."},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"},"prospect_name":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Prospect Name"},"prospect_kind":{"anyOf":[{"type":"string","enum":["brand","agency"]},{"type":"null"}],"title":"Prospect Kind"},"brand_color":{"anyOf":[{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},{"type":"null"}],"title":"Brand Color"},"start_page":{"anyOf":[{"type":"string","enum":["brand","agency"]},{"type":"null"}],"title":"Start Page"},"share":{"type":"boolean","title":"Share","default":true}},"type":"object","required":["agency_id","name"],"title":"CreateEnvironmentRequest"},"CreateGapReportRequest":{"properties":{"client_id":{"type":"string","title":"Client Id"},"report_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Id"},"original_request":{"type":"string","minLength":1,"title":"Original Request"},"assessment_trail":{"anyOf":[{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"}],"title":"Assessment Trail"},"proposed_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proposed Type"},"proposed_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proposed Description"},"capability_card_draft":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Capability Card Draft"},"geometry_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Geometry Description"},"example_query_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Example Query Config"}},"additionalProperties":false,"type":"object","required":["client_id","original_request","assessment_trail"],"title":"CreateGapReportRequest"},"CreateNewsFeedRequest":{"properties":{"client_id":{"type":"string","title":"Client Id","description":"Client ID (UUID)"},"name":{"type":"string","minLength":1,"title":"Name","description":"Display name for this news feed"},"type":{"type":"string","enum":["client_news","competitor_watch","trend_radar","custom"],"title":"Type","description":"News feed type","default":"custom"},"search_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search Prompt","description":"Custom search prompt for the feed"}},"type":"object","required":["client_id","name"],"title":"CreateNewsFeedRequest"},"CreateOperatorRequest":{"properties":{"display_name":{"type":"string","maxLength":200,"minLength":1,"title":"Display Name"},"email":{"type":"string","maxLength":320,"minLength":3,"pattern":"^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$","title":"Email"},"agency_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Agency Id"}},"type":"object","required":["display_name","email"],"title":"CreateOperatorRequest"},"CreateReportRequest":{"properties":{"client_id":{"type":"string","title":"Client Id","description":"Client ID (UUID)"},"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name","description":"Report name"}},"type":"object","required":["client_id","name"],"title":"CreateReportRequest","description":"Request body for creating a new report."},"CreateRequest":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"level":{"type":"string","enum":["campaign","ad_group","ad","creative"],"title":"Level"},"rule":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Rule"},"include_keys":{"items":{"type":"string"},"type":"array","title":"Include Keys"},"exclude_keys":{"items":{"type":"string"},"type":"array","title":"Exclude Keys"},"set_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Set Id"},"created_via":{"type":"string","enum":["ui","chat"],"title":"Created Via","default":"ui"},"activate":{"type":"boolean","title":"Activate","default":false}},"type":"object","required":["name","level"],"title":"CreateRequest"},"CreateUploadRequest":{"properties":{"client_id":{"type":"string","format":"uuid","title":"Client Id"},"file_name":{"type":"string","maxLength":512,"minLength":1,"title":"File Name"},"content_hash":{"type":"string","maxLength":128,"minLength":8,"title":"Content Hash"},"byte_size":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Byte Size"},"tables":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Tables"},"notes":{"items":{"type":"string"},"type":"array","maxItems":200,"title":"Notes"}},"type":"object","required":["client_id","file_name","content_hash"],"title":"CreateUploadRequest"},"CreateVerdictRequest":{"properties":{"client_id":{"type":"string","title":"Client Id"},"prompt":{"type":"string","minLength":1,"title":"Prompt"},"rung":{"type":"string","title":"Rung"},"engine":{"additionalProperties":true,"type":"object","title":"Engine"},"verdict":{"additionalProperties":true,"type":"object","title":"Verdict"},"definition_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Definition Id"},"envelope_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Envelope Hash"},"dedup_refs":{"items":{"type":"string"},"type":"array","title":"Dedup Refs"}},"additionalProperties":false,"type":"object","required":["client_id","prompt","rung","engine","verdict"],"title":"CreateVerdictRequest"},"CreateWidgetDefinitionRequest":{"properties":{"agency_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agency Id","description":"Required when client_id is not given (agency-level draft)."},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"},"report_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Id"},"scope":{"type":"string","enum":["user_draft","dashboard"],"title":"Scope","default":"user_draft"},"envelope":{"additionalProperties":true,"type":"object","title":"Envelope"},"envelope_version":{"type":"integer","title":"Envelope Version"}},"additionalProperties":false,"type":"object","required":["envelope","envelope_version"],"title":"CreateWidgetDefinitionRequest"},"DataSourceFact":{"properties":{"source":{"type":"string","enum":["connected","uploaded"],"title":"Source"},"platform_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Platform Slug"},"platform_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Platform Name"},"data_through":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Data Through"},"status":{"type":"string","enum":["active","final","ended","unknown","loading"],"title":"Status"},"dataset_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dataset Id"},"dataset_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dataset Name"},"first_day":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Day"},"last_day":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Day"},"start_mark":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Mark"},"start_mark_applies":{"type":"boolean","title":"Start Mark Applies","default":false},"start_mark_void":{"type":"boolean","title":"Start Mark Void","default":false},"end_mark":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Mark"},"end_mark_applies":{"type":"boolean","title":"End Mark Applies","default":false},"end_mark_void":{"type":"boolean","title":"End Mark Void","default":false},"sets_complete_from":{"type":"boolean","title":"Sets Complete From","default":false},"sets_complete_through":{"type":"boolean","title":"Sets Complete Through","default":false}},"type":"object","required":["source","status"],"title":"DataSourceFact","description":"One source of a hybrid campaign (viewer-safe: no account, no user id).\n\nSTR-1806: a connected entry is one per platform. STR-1848: an uploaded\nentry is one per dataset (`hybrid_dataset_bounds`), with its raw first\nand last day, its marks and whether each applies (a set mark that does\nnot apply is void), and whether it sets the window's ends. Its platform\nmay be null. `data_through` is the last day capped at yesterday.\n`loading`: its uploads landed but the warehouse has not built them."},"DatasetMarksRequest":{"properties":{"start":{"anyOf":[{"$ref":"#/components/schemas/MarkChange"},{"type":"null"}]},"end":{"anyOf":[{"$ref":"#/components/schemas/MarkChange"},{"type":"null"}]}},"additionalProperties":false,"type":"object","title":"DatasetMarksRequest","description":"`{start?: {day}, end?: {day}}`; at least one side."},"Decision":{"properties":{"entity_kind":{"type":"string","enum":["campaign","ad_group","ad"],"title":"Entity Kind"},"variant":{"type":"string","title":"Variant"},"canonical":{"type":"string","title":"Canonical"},"decision":{"type":"string","enum":["accept","reject"],"title":"Decision"}},"additionalProperties":false,"type":"object","required":["entity_kind","variant","canonical","decision"],"title":"Decision"},"DeleteEnvironmentRequest":{"properties":{"confirm_name":{"type":"string","minLength":1,"title":"Confirm Name","description":"The environment's name, typed back. A boolean would confirm that you meant to delete something; the mistake worth catching is deleting the WRONG one."}},"type":"object","required":["confirm_name"],"title":"DeleteEnvironmentRequest"},"DeleteRequest":{"properties":{"reason":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Reason"}},"type":"object","title":"DeleteRequest","description":"Delete (STR-1560 D12): the reason is optional and never asked in the\nUI; blank means none."},"DisconnectAdAccountRequest":{"properties":{"platform_account_id":{"type":"string","title":"Platform Account Id","description":"Platform account UUID"},"ad_account_id":{"type":"string","title":"Ad Account Id","description":"Ad account ID (advertiser ID)"},"client_id":{"type":"string","title":"Client Id","description":"Client ID the account is connected to"}},"type":"object","required":["platform_account_id","ad_account_id","client_id"],"title":"DisconnectAdAccountRequest","description":"Request body for disconnecting an ad account from a client."},"DuplicateReportTemplateRequest":{"properties":{"client_id":{"type":"string","title":"Client Id","description":"Client ID to create the report for"}},"type":"object","required":["client_id"],"title":"DuplicateReportTemplateRequest","description":"Request body for duplicating a report template."},"EnabledBody":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"idempotency_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency Key"}},"type":"object","required":["enabled"],"title":"EnabledBody","description":"Pause or resume. One field, because that is the whole action."},"EngineFeaturesRequest":{"properties":{"kb_admission_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Kb Admission Enabled"}},"type":"object","title":"EngineFeaturesRequest","description":"PUT body: the knowledge-base switch. An omitted key is left UNTOUCHED."},"Enrichment":{"properties":{"join_key":{"type":"string","title":"Join Key"},"key_form":{"type":"string","enum":["name","id"],"title":"Key Form"},"key_column":{"type":"string","title":"Key Column"}},"additionalProperties":false,"type":"object","required":["join_key","key_form","key_column"],"title":"Enrichment","description":"STR-1025: the join key of a lookup (enrichment) upload. `join_key` is a\nplain string so an unsupported key (`market`, `product`) gets a typed 422\nthat says why, rather than a schema error."},"EntityGroupReevaluateRequest":{"properties":{"agency_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Agency Id"},"client_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Client Id"},"run_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Run Id"},"failed_ad_account_ids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":10000,"title":"Failed Ad Account Ids"}},"type":"object","title":"EntityGroupReevaluateRequest","description":"STR-1054: which groups to re-evaluate. Neither id = every agency."},"EnvironmentSettingsRequest":{"properties":{"start_page":{"anyOf":[{"type":"string","enum":["brand","agency"]},{"type":"null"}],"title":"Start Page"},"start_client_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Start Client Id"}},"type":"object","title":"EnvironmentSettingsRequest"},"EventRequest":{"properties":{"agency_id":{"type":"string","format":"uuid","title":"Agency Id"},"event":{"type":"string","enum":["open","close"],"title":"Event"},"session_id":{"type":"string","format":"uuid","title":"Session Id"},"duration_ms":{"anyOf":[{"type":"integer","maximum":86400000.0,"minimum":0.0},{"type":"null"}],"title":"Duration Ms"}},"type":"object","required":["agency_id","event","session_id"],"title":"EventRequest","description":"One usage beacon. `duration_ms` is meaningful on 'close' only."},"ExistingWidget":{"properties":{"id":{"type":"string","maxLength":64,"title":"Id"},"title":{"type":"string","maxLength":200,"title":"Title","default":""},"type":{"type":"string","maxLength":64,"title":"Type","default":""},"prism_type":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Prism Type"},"metric_ids":{"items":{"type":"string","maxLength":120},"type":"array","maxItems":20,"title":"Metric Ids"},"dimension":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Dimension"},"envelope_hash":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Envelope Hash"},"visual_hash":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Visual Hash"}},"type":"object","required":["id"],"title":"ExistingWidget"},"ExperimentDeclaration":{"properties":{"key":{"type":"string","title":"Key"},"arm":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Arm"}},"type":"object","required":["key"],"title":"ExperimentDeclaration","description":"STR-1129: the experiment + arm a run declares. MIRRORS the engine's model of the\nsame name (`services/intelligence/app/api/routes/intelligence.py`).\n\nThe mirror is not optional. Neither RunForClientRequest sets `extra=\"forbid\"`, so\npydantic's default `extra=\"ignore\"` means a field this proxy does not declare is\ndropped HERE — it never reaches the engine, and the run proceeds on the fleet default\nwith no 422 and nothing in the run row to show the operator's choice was discarded.\nThat is the documented failure mode for per-run knobs, and an experiment arm is a\nbundle of exactly those.\n\nLike the engine's copy, this deliberately does NOT validate the key against the\nexperiment registry: the registry lives in the engine, and a retired experiment must\ndegrade at run start rather than 422 at trigger time."},"FeedbackRequest":{"properties":{"agency_id":{"type":"string","format":"uuid","title":"Agency Id"},"rating":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":1.0},{"type":"null"}],"title":"Rating"},"comment":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Comment"},"context":{"additionalProperties":true,"type":"object","title":"Context"}},"type":"object","required":["agency_id"],"title":"FeedbackRequest","description":"One feedback submission from the host chrome's dialog."},"FenceWrite":{"properties":{"zdr_required":{"type":"boolean","title":"Zdr Required","description":"True fences this client: no native code execution, no Covered Model, no OpenRouter backend."},"confirm_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Confirm Name"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"additionalProperties":false,"type":"object","required":["zdr_required"],"title":"FenceWrite","description":"The one field this endpoint accepts.\n\nA model rather than a loose dict so an unknown key is a 422 and never a\ncolumn name reaching the update. The service builds its own patch anyway;\nthis is the outer half of the same rule."},"FilterControlField":{"properties":{"key":{"type":"string","maxLength":80,"title":"Key"},"label":{"type":"string","maxLength":120,"title":"Label","default":""},"operators":{"items":{"type":"string","enum":["eq","neq","in","not_in","contains"]},"type":"array","maxItems":5,"minItems":1,"title":"Operators"},"values":{"items":{"type":"string","maxLength":256},"type":"array","maxItems":60,"title":"Values"},"value_labels":{"items":{"type":"string","maxLength":120},"type":"array","maxItems":60,"title":"Value Labels"},"open":{"type":"boolean","title":"Open","default":false}},"type":"object","required":["key","operators"],"title":"FilterControlField","description":"One field a `filter` control can narrow by. `values` is the known\ndomain (absent = free values). Platform is never a field: scope stays in\n`options.platformFilter`."},"FreezeRequest":{"properties":{"frozen":{"type":"boolean","title":"Frozen","description":"True pins the environment: every Demo Studio mutation on it is refused until it is unfrozen. Live product APIs are untouched, so a prospect can still click around."}},"type":"object","required":["frozen"],"title":"FreezeRequest"},"GenerateDashboardRequest":{"properties":{"semantic_catalog":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Semantic Catalog"},"semantic_catalog_hash":{"anyOf":[{"type":"string","pattern":"^[a-f0-9]{64}$"},{"type":"null"}],"title":"Semantic Catalog Hash"},"client_id":{"type":"string","title":"Client Id"},"prompt":{"type":"string","maxLength":2000,"title":"Prompt","default":""},"tags":{"items":{"type":"string","maxLength":64},"type":"array","maxItems":12,"title":"Tags"},"catalog":{"items":{"$ref":"#/components/schemas/CatalogWidget"},"type":"array","maxItems":40,"minItems":1,"title":"Catalog"},"reference_images":{"items":{"type":"string"},"type":"array","maxItems":3,"title":"Reference Images"},"layouts":{"items":{"$ref":"#/components/schemas/LayoutInfo"},"type":"array","maxItems":12,"title":"Layouts"},"bands":{"items":{"$ref":"#/components/schemas/BandInfo"},"type":"array","maxItems":20,"title":"Bands"},"layout_grammar":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Layout Grammar"},"quiet_platforms":{"items":{"type":"string"},"type":"array","maxItems":12,"title":"Quiet Platforms"},"thread_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Thread Id"},"source_ids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":5,"title":"Source Ids"},"use_dashboard_dates":{"type":"boolean","title":"Use Dashboard Dates","default":true},"board_filters":{"anyOf":[{"$ref":"#/components/schemas/BoardFilters"},{"type":"null"}]}},"type":"object","required":["client_id","catalog"],"title":"GenerateDashboardRequest"},"GlobalWrite":{"properties":{"value_text":{"type":"string","title":"Value Text"},"confirm_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Confirm Name"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"additionalProperties":false,"type":"object","required":["value_text"],"title":"GlobalWrite"},"GoogleAdsConnectAccountsRequest":{"properties":{"client_id":{"type":"string","title":"Client Id","description":"Stratis client UUID to attach customers to."},"customer_ids":{"items":{"type":"string"},"type":"array","minItems":1,"title":"Customer Ids","description":"Google Ads customer IDs (10 digits, no dashes) the user picked from accessible_customers."}},"type":"object","required":["client_id","customer_ids"],"title":"GoogleAdsConnectAccountsRequest","description":"STR-125 Phase 3: post-OAuth picker submit for Google Ads.\n\nUnlike Meta/TikTok where the OAuth callback auto-creates ad_accounts\nrows for every discovered advertiser, Google Ads's OAuth grant gives\naccess to an MCC hierarchy with potentially many child customers. The\nuser selects which customer IDs to actually attach to their client via\nthe dashboard's GoogleAdsAccountPicker modal, then this endpoint\ncreates the matching ad_accounts rows + provisions Airbyte for each."},"GroundingNode":{"properties":{"node_id":{"type":"string","maxLength":200,"title":"Node Id"},"label":{"type":"string","maxLength":300,"title":"Label"},"kind":{"type":"string","maxLength":100,"title":"Kind","default":""},"domain":{"type":"string","maxLength":100,"title":"Domain","default":""},"source":{"type":"string","maxLength":300,"title":"Source","default":""},"detail":{"type":"string","maxLength":4000,"title":"Detail","default":""}},"type":"object","required":["node_id","label"],"title":"GroundingNode","description":"One retrieved memory node, as the dashboard's projection layer emits it."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HybridPacingFact":{"properties":{"available":{"type":"boolean","title":"Available"},"reason":{"anyOf":[{"type":"string","enum":["dataset_loading","no_complete_through","no_complete_window","start_mark_needed","end_mark_needed"]},{"type":"null"}],"title":"Reason"},"start_marks_needed":{"items":{"type":"string"},"type":"array","title":"Start Marks Needed","default":[]},"end_marks_needed":{"items":{"type":"string"},"type":"array","title":"End Marks Needed","default":[]},"loading":{"items":{"type":"string"},"type":"array","title":"Loading","default":[]}},"type":"object","required":["available"],"title":"HybridPacingFact","description":"STR-1848: `hybrid_as_of.pacing_check` over the group's flight."},"InsightCheckRequest":{"properties":{"card":{"additionalProperties":true,"type":"object","title":"Card"}},"type":"object","required":["card"],"title":"InsightCheckRequest","description":"STR-1206 (QA A1206-04): a card as the salesperson has edited it."},"InsightDraftRequest":{"properties":{"client_key":{"type":"string","maxLength":64,"minLength":1,"title":"Client Key"},"market_key":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Market Key"},"campaign_key":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Campaign Key"},"prompt":{"type":"string","maxLength":4000,"minLength":1,"title":"Prompt"}},"type":"object","required":["client_key","prompt"],"title":"InsightDraftRequest","description":"STR-1206 \"Add an insight\": what the card should say, for which brand."},"InsightFeedbackRequest":{"properties":{"client_id":{"type":"string","format":"uuid","title":"Client Id"},"usefulness":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":1.0},{"type":"null"}],"title":"Usefulness"},"urgency":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":1.0},{"type":"null"}],"title":"Urgency"},"impact":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":1.0},{"type":"null"}],"title":"Impact"},"domain_language":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":1.0},{"type":"null"}],"title":"Domain Language"},"tone":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":1.0},{"type":"null"}],"title":"Tone"},"reason":{"anyOf":[{"type":"string","enum":["already_knew","not_actionable","phrasing","wrong_scope","other"]},{"type":"null"}],"title":"Reason"},"note":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Note"}},"type":"object","required":["client_id"],"title":"InsightFeedbackRequest","description":"One operator's rating of one insight card.\n\nEvery dimension is optional on purpose: five mandatory dials would collapse\nthe response rate, so the UI asks for `usefulness` and reveals the rest on a\nlow score. What the request may NOT be is empty."},"InsightImpressionsRequest":{"properties":{"client_id":{"type":"string","format":"uuid","title":"Client Id"},"insight_ids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":200,"minItems":1,"title":"Insight Ids"},"expanded":{"type":"boolean","title":"Expanded","default":false}},"type":"object","required":["client_id","insight_ids"],"title":"InsightImpressionsRequest","description":"\"These insights were seen by me\", or \"I opened this one\"."},"InsightRequest":{"properties":{"widget_type":{"type":"string","enum":["timeseries","barchart","ranking","breakdown"],"title":"Widget Type","description":"Widget type: 'timeseries', 'barchart', 'ranking', 'breakdown'","default":"timeseries"},"metric":{"type":"string","title":"Metric","description":"Metric ID (e.g., 'spend', 'cpm', 'impressions')"},"unit":{"type":"string","title":"Unit","description":"Metric unit: 'currency', 'count', 'rate'"},"client_name":{"type":"string","title":"Client Name","description":"Client display name"},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id","description":"Client UUID, required for AI consent and demo spend attribution."},"platforms":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Platforms","description":"Platforms (e.g., 'Meta, TikTok')"},"summary":{"anyOf":[{"$ref":"#/components/schemas/TimeseriesSummary"},{"type":"null"}],"description":"Compact summary for verdicts"},"anchors":{"anyOf":[{"items":{"$ref":"#/components/schemas/TimeseriesAnchor"},"type":"array"},{"type":"null"}],"title":"Anchors","description":"Compact anchor points"},"data_points":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Data Points","description":"Date-value pairs (AI calculates trends)"},"prior_data_points":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Prior Data Points","description":"Prior period date-value pairs"},"comparison_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comparison Mode","description":"Comparison mode: 'previous_period', 'yoy', etc."},"current_period":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Period","description":"Current period label (e.g., 'Oct 27 - Nov 26')"},"prior_period":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prior Period","description":"Prior period label"},"items":{"anyOf":[{"items":{"$ref":"#/components/schemas/RankingItem"},"type":"array"},{"type":"null"}],"title":"Items","description":"Ranked items with rank, label, value"},"items_prior":{"anyOf":[{"items":{"$ref":"#/components/schemas/RankingItem"},"type":"array"},{"type":"null"}],"title":"Items Prior","description":"Prior period ranked items (for comparison)"},"dimension":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dimension","description":"Dimension name (e.g., 'campaigns', 'platforms')"},"segments":{"anyOf":[{"items":{"$ref":"#/components/schemas/BreakdownSegment"},"type":"array"},{"type":"null"}],"title":"Segments","description":"Pie segments with label, value, percentage"},"prior_segments":{"anyOf":[{"items":{"$ref":"#/components/schemas/BreakdownSegment"},"type":"array"},{"type":"null"}],"title":"Prior Segments","description":"Prior period segments"}},"type":"object","required":["metric","unit","client_name"],"title":"InsightRequest","description":"Request payload for generating a widget insight.\n\nOPTIMIZED: Sends raw data points to AI, which calculates its own summaries.\nThis reduces payload size and tokens used."},"InsightResponse":{"properties":{"insight":{"type":"string","title":"Insight","description":"AI-generated insight text (1-2 sentences)"},"tokens_used":{"type":"integer","title":"Tokens Used","description":"Total tokens used for the generation"}},"type":"object","required":["insight","tokens_used"],"title":"InsightResponse","description":"Response with the generated insight."},"InsightWordingRequest":{"properties":{"title":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Title"},"headline":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Headline"},"claim":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Claim"},"summary":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Summary"},"interpretation":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Interpretation"},"caveats":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Caveats"},"claims":{"items":{"$ref":"#/components/schemas/ClaimPatchModel"},"type":"array","title":"Claims"},"recommendations":{"items":{"$ref":"#/components/schemas/RecommendationPatchModel"},"type":"array","title":"Recommendations"},"entity_name":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Entity Name"},"pinned":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Pinned"},"curated_order":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Curated Order"},"status":{"anyOf":[{"type":"string","enum":["active","discarded"]},{"type":"null"}],"title":"Status"}},"type":"object","title":"InsightWordingRequest"},"Instruction":{"properties":{"text":{"type":"string","maxLength":2000,"minLength":1,"title":"Text"}},"type":"object","required":["text"],"title":"Instruction"},"InviteAction":{"properties":{"agency_id":{"type":"string","format":"uuid","title":"Agency Id"},"idempotency_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency Key"}},"type":"object","required":["agency_id"],"title":"InviteAction"},"InviteDetails":{"properties":{"id":{"type":"string","title":"Id"},"agency_id":{"type":"string","title":"Agency Id"},"agency_name":{"type":"string","title":"Agency Name"},"agency_logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agency Logo Url"},"inviter_name":{"type":"string","title":"Inviter Name"},"inviter_email":{"type":"string","title":"Inviter Email"},"email":{"type":"string","title":"Email"},"status":{"type":"string","title":"Status"},"expires_at":{"type":"string","title":"Expires At"},"created_at":{"type":"string","title":"Created At"},"has_account":{"type":"boolean","title":"Has Account","default":false}},"type":"object","required":["id","agency_id","agency_name","agency_logo_url","inviter_name","inviter_email","email","status","expires_at","created_at"],"title":"InviteDetails","description":"Response model for invite details."},"InviteInput":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"role":{"type":"string","enum":["admin","editor","viewer"],"title":"Role","default":"viewer"},"scope":{"type":"string","enum":["new_client","agency"],"title":"Scope","default":"new_client"}},"type":"object","required":["email"],"title":"InviteInput"},"InviteRequest":{"properties":{"agency_id":{"type":"string","title":"Agency Id"},"emails":{"items":{"type":"string","format":"email"},"type":"array","title":"Emails"},"role":{"type":"string","enum":["admin","editor","viewer"],"title":"Role","default":"viewer"},"client_scope":{"items":{"type":"string"},"type":"array","title":"Client Scope"}},"type":"object","required":["agency_id","emails"],"title":"InviteRequest","description":"Request model for sending invites.\n\n`role` is the agency role the invitee will have on accept. 'owner' is\nintentionally not a valid invite role — ownership is established at\nagency creation, not via invitation.\n\n`client_scope` is the list of client_ids the invitee should be\nrestricted to once they accept. An empty list means agency-wide\nvisibility (sees every client in the agency). Only enforced for\neditor/viewer; admin always sees all clients."},"InviteResponse":{"properties":{"id":{"type":"string","title":"Id"},"email":{"type":"string","title":"Email"},"token":{"type":"string","title":"Token"},"status":{"type":"string","title":"Status"},"created_at":{"type":"string","title":"Created At"},"expires_at":{"type":"string","title":"Expires At"},"existing_account":{"type":"boolean","title":"Existing Account","default":false}},"type":"object","required":["id","email","token","status","created_at","expires_at"],"title":"InviteResponse","description":"Response model for invite creation."},"KeepRows":{"properties":{"column":{"type":"string","title":"Column"},"values":{"items":{"type":"string","maxLength":1000},"type":"array","maxItems":1000,"title":"Values"},"blank":{"type":"string","enum":["keep","leave_out"],"title":"Blank","default":"leave_out"}},"additionalProperties":false,"type":"object","required":["column"],"title":"KeepRows","description":"The rows of a file this upload keeps (STR-1401 contract §5.2.2): those\nwhose `column` cell, as a canonical name, is one of `values`. A blank cell\nis kept only with `blank = keep`. Values are stored canonical (NFKC,\nwhitespace collapsed, case kept), deduplicated and sorted; a case variant\nis another value. At most `MAX_KEEP_VALUES` values of at most\n`MAX_KEEP_VALUE_LENGTH` characters each are accepted. Never stored in a\ntemplate: it belongs to one file. The choice (Only, Every row) is\nremembered per data set and saved settings, as digests of the column\nand its names, never the names (STR-1497, `remembered.py`): the next\nfile with the same saved settings and no new name reuses it."},"LayoutInfo":{"properties":{"id":{"type":"string","maxLength":48,"title":"Id"},"when":{"type":"string","maxLength":200,"title":"When","default":""},"archetypes":{"items":{"type":"string","maxLength":32},"type":"array","maxItems":8,"title":"Archetypes"},"bands":{"items":{"type":"string","maxLength":48},"type":"array","maxItems":8,"minItems":1,"title":"Bands"},"seats":{"anyOf":[{"type":"integer","maximum":24.0,"minimum":1.0},{"type":"null"}],"title":"Seats"},"rects":{"items":{},"type":"array","maxItems":24,"title":"Rects"}},"type":"object","required":["id","bands"],"title":"LayoutInfo","description":"One pattern GUIDE: a named composition of bands (a macro — the\ndesigner may emit the id as shorthand for its band list), with the\nresolved (x,y,w,h) seat rects for the prompt's worked example."},"MarkChange":{"properties":{"day":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Day"}},"additionalProperties":false,"type":"object","required":["day"],"title":"MarkChange","description":"One side of a marks request: the boundary day seen, or null to clear."},"MemberData":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Name"},"role":{"type":"string","title":"Role"},"joined_at":{"type":"string","title":"Joined At"},"client_scope":{"items":{"type":"string"},"type":"array","title":"Client Scope"}},"type":"object","required":["user_id","email","first_name","last_name","role","joined_at"],"title":"MemberData","description":"Member information.\n\n`client_scope` is the explicit list of client_ids the member is\nrestricted to in this agency. Empty list = agency-wide visibility\n(sees every client). For owner/admin the list is always empty\neven if scope rows exist, since they bypass scope at the application\nlayer."},"MembershipRemoval":{"properties":{"agency_id":{"type":"string","format":"uuid","title":"Agency Id"},"confirm_email":{"type":"string","title":"Confirm Email"},"idempotency_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency Key"}},"type":"object","required":["agency_id","confirm_email"],"title":"MembershipRemoval"},"MembershipUpdate":{"properties":{"agency_id":{"type":"string","format":"uuid","title":"Agency Id"},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"},"client_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array"},{"type":"null"}],"title":"Client Ids"},"idempotency_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency Key"}},"type":"object","required":["agency_id"],"title":"MembershipUpdate","description":"A role change, a client-scope change, or both."},"MemoryChatRequest":{"properties":{"query":{"type":"string","maxLength":2000,"minLength":1,"title":"Query"},"grounding":{"items":{"$ref":"#/components/schemas/GroundingNode"},"type":"array","maxItems":24,"title":"Grounding"},"history":{"items":{"$ref":"#/components/schemas/ChatTurn"},"type":"array","maxItems":12,"title":"History"}},"type":"object","required":["query"],"title":"MemoryChatRequest"},"Merge":{"properties":{"write_mode":{"type":"string","enum":["restate","append"],"title":"Write Mode","default":"restate"},"missing_rows":{"anyOf":[{"type":"string","enum":["keep","supersede"]},{"type":"null"}],"title":"Missing Rows"},"cross_grain":{"type":"string","enum":["keep_both","retire_older"],"title":"Cross Grain","default":"keep_both"},"acknowledgements":{"items":{"type":"string"},"type":"array","title":"Acknowledgements"},"overrides":{"items":{"$ref":"#/components/schemas/Override"},"type":"array","title":"Overrides"},"recommended_used":{"items":{"$ref":"#/components/schemas/RecommendedUsed"},"type":"array","title":"Recommended Used"},"older_file":{"anyOf":[{"type":"string","enum":["keep_newer","use_this_file"]},{"type":"null"}],"title":"Older File"},"ask_again":{"items":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[a-z0-9_:]+$"},"type":"array","maxItems":20,"title":"Ask Again"}},"additionalProperties":false,"type":"object","title":"Merge"},"MessageRequest":{"properties":{"question":{"type":"string","maxLength":4000,"minLength":1,"title":"Question"}},"type":"object","required":["question"],"title":"MessageRequest"},"MetadataFetchResult":{"properties":{"ad_accounts_count":{"type":"integer","title":"Ad Accounts Count"},"campaigns_count":{"type":"integer","title":"Campaigns Count"},"business_users_count":{"type":"integer","title":"Business Users Count","default":0},"ad_accounts":{"items":{"$ref":"#/components/schemas/AdAccount"},"type":"array","title":"Ad Accounts"},"campaigns":{"items":{"$ref":"#/components/schemas/Campaign"},"type":"array","title":"Campaigns"}},"type":"object","required":["ad_accounts_count","campaigns_count","ad_accounts","campaigns"],"title":"MetadataFetchResult"},"MfaResetRequest":{"properties":{"agency_id":{"type":"string","format":"uuid","title":"Agency Id"},"verification_method":{"$ref":"#/components/schemas/VerificationMethod"},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"},"idempotency_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency Key"}},"type":"object","required":["agency_id","verification_method"],"title":"MfaResetRequest"},"ModelSettingsRequest":{"properties":{"default_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Model"},"feature_models":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":"object","title":"Feature Models"}},"additionalProperties":false,"type":"object","title":"ModelSettingsRequest","description":"Full replace. `default_model` null = the platform default; a feature\nabsent from `feature_models` (or mapped to null) follows the default."},"MolecularOverlayData":{"properties":{"nucleus_sublabel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nucleus Sublabel"},"nodes":{"items":{"$ref":"#/components/schemas/MolecularOverlayNode"},"type":"array","title":"Nodes"}},"type":"object","required":["nodes"],"title":"MolecularOverlayData"},"MolecularOverlayNode":{"properties":{"label":{"type":"string","title":"Label"},"sublabel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sublabel"},"active":{"type":"boolean","title":"Active","default":true},"health":{"type":"string","enum":["good","warn","hot"],"title":"Health","default":"good"},"group_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Group Id"}},"type":"object","required":["label"],"title":"MolecularOverlayNode","description":"One synthetic atom in a demo client's org compound (STR-736)."},"MyInvite":{"properties":{"token":{"type":"string","title":"Token"},"agency_id":{"type":"string","title":"Agency Id"},"agency_name":{"type":"string","title":"Agency Name"},"agency_logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agency Logo Url"},"inviter_name":{"type":"string","title":"Inviter Name"},"inviter_email":{"type":"string","title":"Inviter Email"},"intended_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Intended Role"},"expires_at":{"type":"string","title":"Expires At"}},"type":"object","required":["token","agency_id","agency_name","agency_logo_url","inviter_name","inviter_email","intended_role","expires_at"],"title":"MyInvite","description":"A pending invitation addressed to the signed-in user (STR-2346)."},"NewConversationRequest":{"properties":{"client_id":{"type":"string","title":"Client Id"},"tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tier"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"campaign_group_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"}},"type":"object","required":["client_id"],"title":"NewConversationRequest"},"NewLinkRequest":{"properties":{"password":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Password","description":"Optional. Set exactly this password instead of generating one (12+ characters). Returned once, never stored."}},"type":"object","title":"NewLinkRequest"},"OAuthStartRequest":{"properties":{"api_base_url":{"type":"string","title":"Api Base Url","description":"API base URL (e.g., PUBLIC_API_BASE_URL from frontend) for constructing redirect_uri that provider will redirect to"},"dashboard_url":{"type":"string","title":"Dashboard Url","description":"Dashboard base URL (e.g., window.location.origin) for final redirect after OAuth completes"},"return_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Return Url","description":"Specific callback URL to redirect to after OAuth completes (defaults to dashboard_url/oauth/{provider}/callback)"}},"type":"object","required":["api_base_url","dashboard_url"],"title":"OAuthStartRequest","description":"Request body for OAuth start endpoints."},"OutputPreferenceRequest":{"properties":{"axis":{"type":"string","enum":["tone","domain_language","usefulness"],"title":"Axis"},"instruction":{"type":"string","maxLength":600,"minLength":3,"title":"Instruction"},"source":{"type":"string","enum":["verbal","manual"],"title":"Source","default":"manual"},"provenance":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Provenance"},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"}},"type":"object","required":["axis","instruction"],"title":"OutputPreferenceRequest","description":"One stated preference on one rubric axis."},"Override":{"properties":{"check_id":{"type":"string","title":"Check Id"},"reason":{"type":"string","title":"Reason","default":""},"remember":{"type":"boolean","title":"Remember","default":false}},"additionalProperties":false,"type":"object","required":["check_id"],"title":"Override"},"PackEditsRequest":{"properties":{"edits":{"items":{"additionalProperties":true,"type":"object"},"type":"array","maxItems":200,"minItems":1,"title":"Edits","description":"Edit operations, applied in order. Each is an object with an 'op' naming one of the verbs in `known_ops`."},"dry_run":{"type":"boolean","title":"Dry Run","description":"Validate the edits and report what they would change and which captured insights they put in question, WITHOUT writing or re-materializing.","default":false}},"type":"object","required":["edits"],"title":"PackEditsRequest"},"PasswordResetRequest":{"properties":{"agency_id":{"type":"string","format":"uuid","title":"Agency Id"},"idempotency_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency Key"}},"type":"object","required":["agency_id"],"title":"PasswordResetRequest","description":"No `redirect_to`, deliberately.\n\nThe reset link's destination is the deployment's own configured site URL.\nLetting a request choose it would make the parameter the interesting half\nof this endpoint: a recovery link is a one-time credential, and one that\nlands on a caller-named host is a token-harvesting link wearing our\ndomain. GoTrue's allow-list would refuse most of them; \"most\" is not the\nbar for the field that decides where a credential is delivered, and a\nfield nothing here needs is one less thing to get right."},"PendingInviteData":{"properties":{"id":{"type":"string","title":"Id"},"email":{"type":"string","title":"Email"},"invited_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invited By Name"},"created_at":{"type":"string","title":"Created At"},"status":{"type":"string","title":"Status"},"intended_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Intended Role"},"intended_client_scope":{"items":{"type":"string"},"type":"array","title":"Intended Client Scope"},"has_account":{"type":"boolean","title":"Has Account","default":false}},"type":"object","required":["id","email","invited_by_name","created_at","status"],"title":"PendingInviteData","description":"Pending invite information.\n\n`intended_role` is the role the invitee will have on accept; NULL means\na legacy pre-STR-34 invite (treated as 'member' on accept).\n`intended_client_scope` is the empty list when the invite is agency-wide."},"Period":{"properties":{"kind":{"anyOf":[{"type":"string","enum":["day","week","month","quarter","window"]},{"type":"null"}],"title":"Kind"},"week_anchor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Week Anchor"},"window_basis":{"anyOf":[{"type":"string","enum":["file_name","report","person"]},{"type":"null"}],"title":"Window Basis"},"reader":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Reader"}},"additionalProperties":false,"type":"object","title":"Period"},"PeriodChange":{"properties":{"from":{"type":"string","format":"date","title":"From"},"to":{"type":"string","format":"date","title":"To"}},"additionalProperties":false,"type":"object","required":["from","to"],"title":"PeriodChange"},"PinsRequest":{"properties":{"include_add":{"items":{"type":"string"},"type":"array","title":"Include Add"},"include_remove":{"items":{"type":"string"},"type":"array","title":"Include Remove"},"exclude_add":{"items":{"type":"string"},"type":"array","title":"Exclude Add"},"exclude_remove":{"items":{"type":"string"},"type":"array","title":"Exclude Remove"}},"type":"object","title":"PinsRequest"},"Plan":{"properties":{"columns":{"items":{"$ref":"#/components/schemas/PlanColumn"},"type":"array","title":"Columns"},"locale":{"anyOf":[{"$ref":"#/components/schemas/Transform"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"period":{"anyOf":[{"$ref":"#/components/schemas/Period"},{"type":"null"}]},"source_role":{"anyOf":[{"type":"string","enum":["canonical","breakdown","detail"]},{"type":"null"}],"title":"Source Role"},"rollup_level_kept":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rollup Level Kept"},"exclusions":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Exclusions"},"keep_rows":{"anyOf":[{"$ref":"#/components/schemas/KeepRows"},{"type":"null"}]},"split":{"anyOf":[{"$ref":"#/components/schemas/Split"},{"type":"null"}]},"duplicate_policy":{"anyOf":[{"type":"string","enum":["sum","refuse","sum_all"]},{"type":"null"}],"title":"Duplicate Policy"},"keep_repeats":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Keep Repeats"},"precision":{"anyOf":[{"type":"string","enum":["round","exact"]},{"type":"null"}],"title":"Precision"},"rename_decisions":{"items":{"$ref":"#/components/schemas/Decision"},"type":"array","title":"Rename Decisions"},"alias_decisions":{"items":{"$ref":"#/components/schemas/Decision"},"type":"array","title":"Alias Decisions"},"grain_dimensions":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Grain Dimensions"},"window":{"anyOf":[{"$ref":"#/components/schemas/Window"},{"type":"null"}]},"campaign_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Name"},"propose_semantics":{"items":{"$ref":"#/components/schemas/ProposeSemantic"},"type":"array","title":"Propose Semantics"},"enrichment":{"anyOf":[{"$ref":"#/components/schemas/Enrichment"},{"type":"null"}]}},"additionalProperties":false,"type":"object","title":"Plan"},"PlanChange":{"properties":{"source_role":{"anyOf":[{"type":"string","enum":["canonical","breakdown"]},{"type":"null"}],"title":"Source Role"},"source":{"anyOf":[{"$ref":"#/components/schemas/SourceChange"},{"type":"null"}]},"campaign_group_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Campaign Group Id"},"columns":{"anyOf":[{"items":{"$ref":"#/components/schemas/ColumnChange"},"type":"array","maxItems":500},{"type":"null"}],"title":"Columns"},"period":{"anyOf":[{"$ref":"#/components/schemas/PeriodChange"},{"type":"null"}]},"campaigns":{"anyOf":[{"items":{"$ref":"#/components/schemas/CampaignChange"},"type":"array","maxItems":1000},{"type":"null"}],"title":"Campaigns"},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency"}},"additionalProperties":false,"type":"object","title":"PlanChange","description":"The body of `PATCH …/uploads/{id}/plan` (`batch.ts::PlanChange`)."},"PlanColumn":{"properties":{"upload_field":{"anyOf":[{"type":"string","enum":["campaign_group","creative_id","creative_title","creative_body","creative_url","creative_format","ad_status","creative_key","campaign_id","ad_group_id","ad_id"]},{"type":"null"}],"title":"Upload Field"},"column":{"type":"string","title":"Column"},"role":{"type":"string","enum":["measure","dimension","entity","date","timestamp","period","identifier","attribute","ignore"],"title":"Role"},"semantic":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Semantic"},"semantic_version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Semantic Version"},"type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit"},"attribution":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Attribution"},"aggregation":{"anyOf":[{"type":"string","enum":["sum","average","derived","never","none","last_value","max","weighted"]},{"type":"null"}],"title":"Aggregation"},"transform":{"anyOf":[{"$ref":"#/components/schemas/Transform"},{"type":"null"}]},"pii_handling":{"anyOf":[{"type":"string","enum":["drop","hash"]},{"type":"null"}],"title":"Pii Handling"},"bind_by":{"anyOf":[{"$ref":"#/components/schemas/BindBy"},{"type":"null"}]}},"additionalProperties":false,"type":"object","required":["column","role"],"title":"PlanColumn"},"PlatformConnectAccountsRequest":{"properties":{"client_id":{"type":"string","title":"Client Id","description":"Stratis client UUID to attach accounts to."},"ad_account_ids":{"items":{"type":"string"},"type":"array","minItems":1,"title":"Ad Account Ids","description":"Advertiser / ad-account ids picked from the login's snapshot."}},"type":"object","required":["client_id","ad_account_ids"],"title":"PlatformConnectAccountsRequest","description":"STR-847: the ADD-ONLY connect for Meta and TikTok.\n\nMirrors `GoogleAdsConnectAccountsRequest`. It exists because the only way\nthe dashboard could attach a Meta or TikTok account was\n`/oauth/assign-advertisers` — a RECONCILE that DELETES every ad account not\nin the posted list, cascading its campaigns and ads. Sending the whole\ncurrent list on every add made a lost race, a stale tab or a truncated list\na data-loss event rather than a no-op. This endpoint can only ever add."},"PlatformData":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"ingestion_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ingestion Mode"},"upload_allowed":{"type":"boolean","title":"Upload Allowed","default":false},"default_color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Color"},"icon_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Icon Key"},"slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Slug"}},"type":"object","required":["id","name"],"title":"PlatformData","description":"Platform information."},"PreviewAutoDetectRequest":{"properties":{"client_id":{"type":"string","title":"Client Id","description":"Client ID (UUID)"},"feed_type":{"type":"string","enum":["client_news","competitor_watch","trend_radar","custom"],"title":"Feed Type","description":"News feed type","default":"custom"}},"type":"object","required":["client_id"],"title":"PreviewAutoDetectRequest"},"PreviewExamplePromptRequest":{"properties":{"client_id":{"type":"string","title":"Client Id","description":"Client ID (UUID)"},"feed_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Feed Name","description":"Optional feed name for context"}},"type":"object","required":["client_id"],"title":"PreviewExamplePromptRequest"},"PromoteWidgetDefinitionRequest":{"properties":{"scope":{"type":"string","title":"Scope"},"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title"}},"additionalProperties":false,"type":"object","required":["scope","title"],"title":"PromoteWidgetDefinitionRequest"},"PromotedRef":{"properties":{"id":{"type":"string","maxLength":64,"title":"Id"},"visual_hash":{"type":"string","maxLength":64,"title":"Visual Hash"},"title":{"type":"string","maxLength":200,"title":"Title","default":""}},"type":"object","required":["id","visual_hash"],"title":"PromotedRef"},"ProposeSemantic":{"properties":{"column":{"type":"string","title":"Column"},"family":{"type":"string","enum":["measure","dimension"],"title":"Family"},"slug":{"type":"string","title":"Slug"},"label":{"type":"string","title":"Label"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"},"value_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value Type"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit"},"currency_bearing":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Currency Bearing"},"domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain"},"storage_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Storage Type"},"precision":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Precision"},"ratio_numerator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ratio Numerator"},"ratio_denominator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ratio Denominator"},"aliases":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Aliases"},"entity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity"}},"additionalProperties":false,"type":"object","required":["column","family","slug","label"],"title":"ProposeSemantic","description":"A column matching nothing proposes an agency semantic (STR-1023 rules)."},"RankingItem":{"properties":{"rank":{"type":"integer","title":"Rank"},"label":{"type":"string","title":"Label"},"value":{"type":"number","title":"Value"}},"type":"object","required":["rank","label","value"],"title":"RankingItem","description":"A single ranked item - AI calculates percentages from values."},"RateOverride":{"properties":{"input_usd_per_m":{"type":"number","minimum":0.0,"title":"Input Usd Per M"},"output_usd_per_m":{"type":"number","minimum":0.0,"title":"Output Usd Per M"}},"type":"object","required":["input_usd_per_m","output_usd_per_m"],"title":"RateOverride","description":"User-entered $/M-token rates for a model with no published rates\n(STR-181 manual backup). Validated here, applied by the engine —\nestimate-only, never used to bill actuals."},"ReassignAdAccountRequest":{"properties":{"platform_account_id":{"type":"string","title":"Platform Account Id","description":"Platform account UUID"},"ad_account_id":{"type":"string","title":"Ad Account Id","description":"Ad account ID (advertiser ID)"},"from_client_id":{"type":"string","title":"From Client Id","description":"Current client ID"},"to_client_id":{"type":"string","title":"To Client Id","description":"New client ID to assign to"}},"type":"object","required":["platform_account_id","ad_account_id","from_client_id","to_client_id"],"title":"ReassignAdAccountRequest","description":"Request body for reassigning an ad account to a different client."},"RecommendationPatchModel":{"properties":{"index":{"type":"integer","minimum":0.0,"title":"Index"},"text":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Text"},"expected_impact":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Expected Impact"}},"type":"object","required":["index"],"title":"RecommendationPatchModel"},"RecommendedUsed":{"properties":{"item":{"type":"string","maxLength":200,"title":"Item"},"value":{"type":"string","maxLength":64,"title":"Value"}},"additionalProperties":false,"type":"object","required":["item","value"],"title":"RecommendedUsed","description":"A preselected answer the page loaded untouched (STR-1493 D1, 4.8):\n`item` is the draft's mark key (`duplicate_policy`, `date_order`,\n`platform`, `pii:<header>`, `rows`, `dataset` for the data set the\noverlap card preselects, STR-1483 D32, and `older_file` for \"Keep the\nnewer numbers\", STR-1488), `value` what it chose (for `dataset`, the\ndata set id; for `older_file`, `keep_newer`). Kept only when the body\nactually carries that value; never a cell value."},"RefreshPolicyRequest":{"properties":{"gold_watermark":{"type":"string","title":"Gold Watermark","default":"bust_full"},"campaign_scope":{"type":"string","title":"Campaign Scope","default":"bust_full"},"context_identity":{"type":"string","title":"Context Identity","default":"bust_full"},"seed_identity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Seed Identity"},"ml_watermark":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ml Watermark"},"campaign_group_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"}},"type":"object","title":"RefreshPolicyRequest","description":"Full-replace of a client's per-component refresh policy (STR-278 Stage 2),\nrelayed to the engine (which re-validates each value ∈ {'bust_full','ignore'} and\nre-checks admin). EXACTLY the three policy-able components.\n\nThe two non-overridable rails (prompt always busts; model is never a component) are\nREJECTED here with a 422 — mirroring the engine, rather than letting Pydantic\nsilently drop the unknown key (which would swallow a rail-override attempt and break\nthe documented 'engine 422 relays verbatim' contract on the only path the browser\nuses)."},"RegenerateRequest":{"properties":{"client_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Client Id","description":"The demo client to run the engine against. OPTIONAL — omitted, the server resolves it from the environment's own pack."},"confirm_name":{"type":"string","minLength":1,"title":"Confirm Name","description":"The environment's name, typed back. This spends real money and takes about twenty minutes; a boolean would confirm that you meant to press something."}},"type":"object","required":["confirm_name"],"title":"RegenerateRequest"},"RejectRequest":{"properties":{"reason":{"type":"string","enum":["duplicate_rows","non_numeric_values","unparseable_dates","totals_mismatch","attribution_windows","excess_precision","other"],"title":"Reason","default":"other"}},"type":"object","title":"RejectRequest","description":"`POST /{id}/reject` (STR-1560 D6): the blocking issue the file was\nrejected for."},"ReportPermissionsResponse":{"properties":{"people":{"items":{"$ref":"#/components/schemas/ReportPersonData"},"type":"array","title":"People"},"can_manage":{"type":"boolean","title":"Can Manage","description":"Whether the CALLER may grant/revoke. The list is readable by anyone who can read the dashboard, so the UI needs this to know whether to render the controls or a read-only roster."}},"type":"object","required":["people","can_manage"],"title":"ReportPermissionsResponse"},"ReportPersonData":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Name"},"role":{"type":"string","title":"Role","description":"owner | editor | viewer"},"is_owner":{"type":"boolean","title":"Is Owner","description":"True for the dashboard's creator — not revocable."}},"type":"object","required":["user_id","email","role","is_owner"],"title":"ReportPersonData","description":"One row of the Share modal's \"people with access\" list."},"ReportTemplateData":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"goals":{"items":{"type":"string"},"type":"array","title":"Goals","default":[]}},"type":"object","required":["id","name","config"],"title":"ReportTemplateData","description":"Report template with full config."},"ReportTemplatesResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"data":{"items":{"$ref":"#/components/schemas/ReportTemplateData"},"type":"array","title":"Data"}},"type":"object","required":["success","data"],"title":"ReportTemplatesResponse","description":"Response model for report templates."},"ReprocessPreviewRequest":{"properties":{"missing_rows":{"type":"string","enum":["keep","supersede"],"title":"Missing Rows"}},"type":"object","required":["missing_rows"],"title":"ReprocessPreviewRequest"},"ReprocessRequest":{"properties":{"missing_rows":{"type":"string","enum":["keep","supersede"],"title":"Missing Rows"},"generation":{"type":"integer","title":"Generation"},"reason":{"type":"string","title":"Reason"}},"type":"object","required":["missing_rows","generation","reason"],"title":"ReprocessRequest"},"ResolveRequest":{"properties":{"term":{"type":"string","maxLength":200,"minLength":1,"title":"Term"},"level":{"type":"string","enum":["campaign","ad_group","ad","creative"],"title":"Level","default":"ad"}},"type":"object","required":["term"],"title":"ResolveRequest"},"ResolveReviewRequest":{"properties":{"group_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Group Id"}},"type":"object","title":"ResolveReviewRequest"},"RespondToInviteRequest":{"properties":{"action":{"type":"string","title":"Action"}},"type":"object","required":["action"],"title":"RespondToInviteRequest","description":"Request model for responding to an invite."},"RollbackRequest":{"properties":{"dataset_id":{"type":"string","format":"uuid","title":"Dataset Id"},"generation":{"type":"integer","title":"Generation"},"reason":{"type":"string","title":"Reason"}},"type":"object","required":["dataset_id","generation","reason"],"title":"RollbackRequest"},"RotatePasswordRequest":{"properties":{"persona_key":{"type":"string","maxLength":64,"minLength":1,"title":"Persona Key"},"password":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Password","description":"Optional. Set exactly this password instead of generating one (12+ characters). Returned once, never stored."}},"type":"object","required":["persona_key"],"title":"RotatePasswordRequest"},"RpcRequest":{"properties":{"agency_id":{"type":"string","format":"uuid","title":"Agency Id"},"method":{"type":"string","maxLength":128,"minLength":1,"title":"Method"},"params":{"additionalProperties":true,"type":"object","title":"Params"}},"type":"object","required":["agency_id","method"],"title":"RpcRequest","description":"One broker call, relayed by the host shell on the app's behalf."},"RunCostEstimateRequest":{"properties":{"client_id":{"type":"string","title":"Client Id"},"model_config":{"anyOf":[{"$ref":"#/components/schemas/TierModelSelection"},{"type":"null"}]},"tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tier"},"rate_overrides":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/RateOverride"},"type":"object"},{"type":"null"}],"title":"Rate Overrides"},"campaign_group_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"},"orchestration_v2":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Orchestration V2"},"run_knobs":{"anyOf":[{"$ref":"#/components/schemas/RunKnobs"},{"type":"null"}]}},"type":"object","required":["client_id"],"title":"RunCostEstimateRequest"},"RunForClientRequest":{"properties":{"client_id":{"type":"string","title":"Client Id"},"model_config":{"anyOf":[{"$ref":"#/components/schemas/TierModelSelection"},{"type":"null"}]},"tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tier"},"campaign_group_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"},"force":{"type":"boolean","title":"Force","default":false},"orchestration_v2":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Orchestration V2"},"engine_profile":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Engine Profile"},"run_knobs":{"anyOf":[{"$ref":"#/components/schemas/RunKnobs"},{"type":"null"}]},"experiment":{"anyOf":[{"$ref":"#/components/schemas/ExperimentDeclaration"},{"type":"null"}]}},"type":"object","required":["client_id"],"title":"RunForClientRequest"},"RunKnobs":{"properties":{"knowledge_subagent_max_rounds":{"anyOf":[{"type":"integer","maximum":100.0,"minimum":1.0},{"type":"null"}],"title":"Knowledge Subagent Max Rounds"},"finder_max_rounds":{"anyOf":[{"type":"integer","maximum":100.0,"minimum":1.0},{"type":"null"}],"title":"Finder Max Rounds"},"finder_max_subagents":{"anyOf":[{"type":"integer","maximum":100.0,"minimum":1.0},{"type":"null"}],"title":"Finder Max Subagents"},"run_sql_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Run Sql Enabled"},"run_sql_require_describe_first":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Run Sql Require Describe First"},"slim_substrate_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Slim Substrate Enabled"},"synthesizer_min_quality":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Synthesizer Min Quality"},"cost_halt_usd":{"anyOf":[{"type":"number","minimum":0.0},{"type":"null"}],"title":"Cost Halt Usd"},"prescriber_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Prescriber Enabled"},"prescriber_max_recommendations":{"anyOf":[{"type":"integer","maximum":50.0,"minimum":1.0},{"type":"null"}],"title":"Prescriber Max Recommendations"},"prescriber_steps_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Prescriber Steps Enabled"},"synthesizer_dedup_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Synthesizer Dedup Enabled"},"synthesizer_dedup_llm_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Synthesizer Dedup Llm Enabled"},"synthesizer_max_published":{"anyOf":[{"type":"integer","maximum":500.0,"minimum":1.0},{"type":"null"}],"title":"Synthesizer Max Published"},"synthesizer_llm_drop_advisory":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Synthesizer Llm Drop Advisory"},"context_insights_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Context Insights Enabled"},"chart_series_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Chart Series Enabled"},"presentation_headline_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Presentation Headline Enabled"},"presentation_compact_numbers_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Presentation Compact Numbers Enabled"},"scope_authoring_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Scope Authoring Enabled"},"ml_read_tools_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ml Read Tools Enabled"},"ml_offer_filter_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ml Offer Filter Enabled"},"ml_compute_tools_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ml Compute Tools Enabled"},"prescriber_donor_check_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Prescriber Donor Check Enabled"},"coherence_pass_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Coherence Pass Enabled"},"claim_coherence_pass_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Claim Coherence Pass Enabled"},"framer_seed_questions_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Framer Seed Questions Enabled"},"rulebook_tools_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Rulebook Tools Enabled"},"style_feedback_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Style Feedback Enabled"},"quality_scores_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Quality Scores Enabled"},"impact_estimator_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Impact Estimator Enabled"},"planner_questions_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Planner Questions Enabled"},"repair_fallback_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Repair Fallback Enabled"},"goal_anchor_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Goal Anchor Enabled"},"knowledge_subagent_keep_numbers_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Knowledge Subagent Keep Numbers Enabled"},"kb_admission_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Kb Admission Enabled"},"kb_top_k":{"anyOf":[{"type":"integer","maximum":64.0,"minimum":1.0},{"type":"null"}],"title":"Kb Top K"},"kb_generation_limit":{"anyOf":[{"type":"integer","maximum":100.0,"minimum":0.0},{"type":"null"}],"title":"Kb Generation Limit"},"kb_dead_digest_budget_ktokens":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":0.0},{"type":"null"}],"title":"Kb Dead Digest Budget Ktokens"},"kb_staleness_sample_size":{"anyOf":[{"type":"integer","maximum":100.0,"minimum":0.0},{"type":"null"}],"title":"Kb Staleness Sample Size"},"kb_shadow_full_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Kb Shadow Full Enabled"},"kb_explore_slots":{"anyOf":[{"type":"integer","maximum":8.0,"minimum":0.0},{"type":"null"}],"title":"Kb Explore Slots"},"kb_blind_slots":{"anyOf":[{"type":"integer","maximum":4.0,"minimum":0.0},{"type":"null"}],"title":"Kb Blind Slots"},"kb_fusion_scope_policy":{"anyOf":[{"type":"string","enum":["same_group","client"]},{"type":"null"}],"title":"Kb Fusion Scope Policy"},"kb_same_pattern_max_per_finding":{"anyOf":[{"type":"integer","maximum":20.0,"minimum":0.0},{"type":"null"}],"title":"Kb Same Pattern Max Per Finding"},"max_framer_questions":{"anyOf":[{"type":"integer","maximum":24.0,"minimum":0.0},{"type":"null"}],"title":"Max Framer Questions"},"openai_service_tier":{"anyOf":[{"type":"string","enum":["auto","default","fast","flex","priority"]},{"type":"null"}],"title":"Openai Service Tier"}},"type":"object","title":"RunKnobs","description":"STR-335 i5: the per-run engine knobs the Run-Magenta popover sets, validated here\n(same bounds as the engine's `RunKnobs`) before relaying so a bad value is rejected at\napps/api too (defence-in-depth — the operator can't get an out-of-range knob past the\nproxy). Each is OPTIONAL; only the knobs the operator changed are forwarded (the engine\nomits an unset knob from `config_json.run_knobs`). Mirrors `RateOverride`'s `Field(ge=…)`\nclamps. The engine re-validates + reads the bag via `orchestrator/run_knobs.py`."},"RunSurfaceTaskBody":{"properties":{"params":{"additionalProperties":true,"type":"object","title":"Params"}},"type":"object","title":"RunSurfaceTaskBody","description":"Declared params only.\n\nThere is deliberately no `prompt`, `system` or `messages` field, and adding\none here would defeat the design as surely as adding it to the engine: a\ncaller that can supply instructions can rewrite every guardrail phrased as\none. The engine validates each key against the task's own declaration."},"RunTierPresetRequest":{"properties":{"provider":{"type":"string","title":"Provider"},"tiers":{"additionalProperties":{"type":"string"},"type":"object","title":"Tiers"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"engine_profile":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Engine Profile"},"orchestration_v2":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Orchestration V2"},"run_knobs":{"anyOf":[{"$ref":"#/components/schemas/RunKnobs"},{"type":"null"}]}},"type":"object","required":["provider","tiers"],"title":"RunTierPresetRequest","description":"One tier override, relayed verbatim. The ENGINE owns validation (known\nprovider, three non-empty slugs, resolvable models) — this proxy re-checks\nonly what is free to re-check, and lets the engine's 422 through untouched."},"SaveCampaignContextRequest":{"properties":{"campaign_group_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"},"payload_json":{"additionalProperties":true,"type":"object","title":"Payload Json"},"source_documents":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Source Documents"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"human_paths":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Human Paths"}},"type":"object","title":"SaveCampaignContextRequest","description":"Persist a reviewed context_graph as a new version."},"SaveInstallRequest":{"properties":{"agency_id":{"type":"string","format":"uuid","title":"Agency Id"},"enabled":{"type":"boolean","title":"Enabled"},"scopes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Scopes"},"audience":{"anyOf":[{"type":"string","enum":["members","admins","selected"]},{"type":"null"}],"title":"Audience"}},"type":"object","required":["agency_id","enabled"],"title":"SaveInstallRequest","description":"Enable/disable an app for an agency — the consent screen's write.\n\n`scopes` omitted on an ENABLE means \"grant what the manifest declares\"\n(the consent screen shows exactly that list); omitted on a DISABLE means\n\"keep the existing snapshot\" (a disable must never silently re-consent to\na manifest that grew a scope in the meantime)."},"SaveInstallUsersRequest":{"properties":{"agency_id":{"type":"string","format":"uuid","title":"Agency Id"},"user_ids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":200,"title":"User Ids"}},"type":"object","required":["agency_id"],"title":"SaveInstallUsersRequest","description":"FULL REPLACE of the per-user grant list for one (agency, app) — the\n'Specific people' picker holds the whole list and writes it back, so a\nmerge would resurrect people the admin just removed (the\nbrand_memory_prefs PUT rationale)."},"SavePrefsRequest":{"properties":{"prefs":{"additionalProperties":true,"type":"object","title":"Prefs"}},"type":"object","title":"SavePrefsRequest","description":"Replace the whole overlay. `prefs` is free-form but must be an object —\na bare list/string would break every reader that indexes into it."},"ScheduleBody":{"properties":{"cadence":{"type":"string","title":"Cadence","default":"weekly"},"enabled":{"type":"boolean","title":"Enabled","default":false},"run_at_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run At Time"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"day_of_week":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Day Of Week"},"day_of_month":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Day Of Month"},"tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tier"},"full_every_days":{"anyOf":[{"type":"integer","maximum":365.0,"minimum":1.0},{"type":"null"}],"title":"Full Every Days"},"force_next_run":{"type":"boolean","title":"Force Next Run","default":false},"idempotency_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency Key"}},"type":"object","title":"ScheduleBody","description":"A schedule as the console submits it.\n\nNo `campaign_group_id` field: the group is the PATH, so there is no way to\nsubmit a body that targets a different group from the URL that authorized\nit. There is also no whole-client option — scheduled runs are per campaign\ngroup and STR-505 retired the alternative by decision."},"ScheduleRequest":{"properties":{"cadence":{"type":"string","title":"Cadence","default":"weekly"},"enabled":{"type":"boolean","title":"Enabled","default":false},"model_config":{"anyOf":[{"$ref":"#/components/schemas/TierModelSelection"},{"type":"null"}]},"run_at_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run At Time"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"day_of_week":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Day Of Week"},"day_of_month":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Day Of Month"},"campaign_group_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Group Id"},"force_next_run":{"type":"boolean","title":"Force Next Run","default":false},"orchestration_v2":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Orchestration V2"},"tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tier"},"full_every_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Full Every Days"}},"type":"object","title":"ScheduleRequest","description":"Upsert a client's recurring-run schedule (relayed to the engine, which\nvalidates cadence + model slugs/keys and computes next_run_at)."},"ScopedWrite":{"properties":{"value_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value Text"},"confirm_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Confirm Name"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"additionalProperties":false,"type":"object","required":["value_text"],"title":"ScopedWrite"},"SeedQuestionsRequest":{"properties":{"campaign_group_id":{"type":"string","title":"Campaign Group Id"},"questions":{"items":{"type":"string"},"type":"array","title":"Questions"}},"type":"object","required":["campaign_group_id","questions"],"title":"SeedQuestionsRequest","description":"Full-replace of a campaign group's operator seed questions (STR-485), relayed to\nthe engine verbatim. The engine validates the bounds (1-10 questions, 5-300 chars\neach, trimmed) and the group resolution (422 on either) — apps/api does not\nduplicate that validation, mirroring the refresh-policy proxy's posture of relaying\nthe engine's 422 rather than re-checking bounds here."},"SemanticCreateRequest":{"properties":{"family":{"type":"string","enum":["measure","dimension"],"title":"Family"},"agency_id":{"type":"string","format":"uuid","title":"Agency Id"},"propose":{"type":"boolean","title":"Propose","default":false},"created_from":{"type":"string","enum":["admin","upload","enrichment"],"title":"Created From","default":"admin"},"slug":{"type":"string","title":"Slug"},"label":{"type":"string","title":"Label"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"aliases":{"items":{"type":"string"},"type":"array","maxItems":200,"title":"Aliases"},"kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"},"value_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value Type"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit"},"currency_bearing":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Currency Bearing"},"domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain"},"agg":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agg"},"agg_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agg Time"},"agg_entity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agg Entity"},"agg_platform":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agg Platform"},"agg_breakdown":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agg Breakdown"},"serving_rule":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Serving Rule"},"ratio_numerator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ratio Numerator"},"ratio_denominator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ratio Denominator"},"ratio_multiplier":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ratio Multiplier"},"storage_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Storage Type"},"precision":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Precision"},"entity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity"},"hierarchy_parent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hierarchy Parent"}},"additionalProperties":false,"type":"object","required":["family","agency_id","slug","label"],"title":"SemanticCreateRequest"},"SemanticPatchRequest":{"properties":{"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"aliases":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":200},{"type":"null"}],"title":"Aliases"},"status":{"anyOf":[{"type":"string","enum":["confirmed","retired"]},{"type":"null"}],"title":"Status"},"kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"},"value_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value Type"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit"},"currency_bearing":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Currency Bearing"},"domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain"},"agg":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agg"},"agg_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agg Time"},"agg_entity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agg Entity"},"agg_platform":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agg Platform"},"agg_breakdown":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agg Breakdown"},"serving_rule":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Serving Rule"},"ratio_numerator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ratio Numerator"},"ratio_denominator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ratio Denominator"},"ratio_multiplier":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ratio Multiplier"},"storage_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Storage Type"},"precision":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Precision"},"entity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity"},"hierarchy_parent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hierarchy Parent"}},"additionalProperties":false,"type":"object","title":"SemanticPatchRequest","description":"Only the columns `services.semantics` lists as mutable; absent = untouched."},"SendInvitesResponse":{"properties":{"success":{"type":"integer","title":"Success"},"failed":{"type":"integer","title":"Failed"},"invites":{"items":{"$ref":"#/components/schemas/InviteResponse"},"type":"array","title":"Invites"},"errors":{"items":{"type":"string"},"type":"array","title":"Errors"},"already_members":{"items":{"type":"string"},"type":"array","title":"Already Members"}},"type":"object","required":["success","failed","invites","errors"],"title":"SendInvitesResponse","description":"Response model for sending multiple invites."},"SetBookmarkRequest":{"properties":{"is_bookmarked":{"type":"boolean","title":"Is Bookmarked","description":"Whether the news item is bookmarked"}},"type":"object","required":["is_bookmarked"],"title":"SetBookmarkRequest"},"SetPrimaryGroupRequest":{"properties":{"campaign_group_id":{"type":"string","title":"Campaign Group Id"}},"type":"object","required":["campaign_group_id"],"title":"SetPrimaryGroupRequest"},"SetReportPermissionRequest":{"properties":{"role":{"type":"string","pattern":"^(viewer|editor)$","title":"Role"}},"type":"object","required":["role"],"title":"SetReportPermissionRequest"},"SetRequest":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"}},"type":"object","required":["name"],"title":"SetRequest"},"SettingWrite":{"properties":{"value":{"type":"string","title":"Value"},"confirm_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Confirm Name"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"additionalProperties":false,"type":"object","required":["value"],"title":"SettingWrite"},"SetupRequest":{"properties":{"idempotency_key":{"type":"string","maxLength":64,"minLength":8,"title":"Idempotency Key"},"agency":{"$ref":"#/components/schemas/AgencyInput"},"client":{"$ref":"#/components/schemas/ClientInput"},"campaign":{"anyOf":[{"$ref":"#/components/schemas/CampaignInput"},{"type":"null"}]},"invites":{"items":{"$ref":"#/components/schemas/InviteInput"},"type":"array","maxItems":50,"title":"Invites"}},"type":"object","required":["idempotency_key","agency","client"],"title":"SetupRequest"},"SheetsRequest":{"properties":{"every":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Every"},"sheets":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":500},{"type":"null"}],"title":"Sheets"}},"type":"object","title":"SheetsRequest","description":"`POST /{id}/sheets` (STR-1490 D14): exactly one of `every: true` (every\nvisible readable sheet or table that is not uploaded yet) or `sheets`\n(the named ones)."},"Source":{"properties":{"kind":{"type":"string","pattern":"^(platform|custom|column)$","title":"Kind"},"value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value"},"column":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Column"},"as_typed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"As Typed"}},"type":"object","required":["kind"],"title":"Source"},"SourceChange":{"properties":{"kind":{"type":"string","enum":["platform","custom","column"],"title":"Kind"},"value":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Value"},"column":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Column"},"as_typed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"As Typed"}},"additionalProperties":false,"type":"object","required":["kind"],"title":"SourceChange"},"Split":{"properties":{"column":{"type":"string","title":"Column"},"slices":{"items":{"$ref":"#/components/schemas/SplitSlice"},"type":"array","title":"Slices"},"blank":{"type":"string","enum":["target","leave_out"],"title":"Blank","default":"leave_out"},"others":{"type":"string","enum":["target","leave_out"],"title":"Others","default":"leave_out"},"leave_out":{"items":{"type":"string","maxLength":1000},"type":"array","maxItems":1000,"title":"Leave Out"}},"additionalProperties":false,"type":"object","required":["column"],"title":"Split","description":"`plan.split` (STR-1429, contract §5.2.3): one upload of the file per\ncampaign. Each slice keeps the rows whose `column` value it lists; a\nblank cell goes to the review's campaign with `blank = target`, every\nvalue no slice lists and the preview did not list goes there with\n`others = target`, and `leave_out` names values the reader left out\n(never loaded, whatever `others` says). A value belongs to one slice at\nmost, and a destination to one slice. The slice count is the server's\ncheck (`split_too_many_campaigns`), not the schema's."},"SplitSlice":{"properties":{"to":{"oneOf":[{"$ref":"#/components/schemas/SplitToTarget"},{"$ref":"#/components/schemas/SplitToCampaign"},{"$ref":"#/components/schemas/SplitToCreate"}],"title":"To","discriminator":{"propertyName":"kind","mapping":{"campaign":"#/components/schemas/SplitToCampaign","create":"#/components/schemas/SplitToCreate","target":"#/components/schemas/SplitToTarget"}}},"values":{"items":{"type":"string","maxLength":1000},"type":"array","maxItems":1000,"title":"Values"}},"additionalProperties":false,"type":"object","required":["to"],"title":"SplitSlice","description":"One campaign of a split and the values of the split column it takes."},"SplitToCampaign":{"properties":{"kind":{"type":"string","const":"campaign","title":"Kind"},"campaign_group_id":{"type":"string","format":"uuid","title":"Campaign Group Id"}},"additionalProperties":false,"type":"object","required":["kind","campaign_group_id"],"title":"SplitToCampaign","description":"Another uploaded (static) campaign of the client."},"SplitToCreate":{"properties":{"kind":{"type":"string","const":"create","title":"Kind"},"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"}},"additionalProperties":false,"type":"object","required":["kind","name"],"title":"SplitToCreate","description":"A new static campaign the confirm creates, named `name` (canonical)."},"SplitToTarget":{"properties":{"kind":{"type":"string","const":"target","title":"Kind"}},"additionalProperties":false,"type":"object","required":["kind"],"title":"SplitToTarget","description":"The review's own campaign (`target.campaign_group_id`)."},"StratbotFeedbackRequest":{"properties":{"rating":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":1.0},{"type":"null"}],"title":"Rating"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"note":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Note"}},"type":"object","title":"StratbotFeedbackRequest","description":"One operator's rating of one answer."},"SuspendRequest":{"properties":{"app_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"App Id"},"reason":{"type":"string","maxLength":500,"minLength":1,"title":"Reason"},"suspended_by":{"type":"string","maxLength":200,"minLength":1,"title":"Suspended By"}},"type":"object","required":["reason","suspended_by"],"title":"SuspendRequest","description":"`app_id` omitted (or `*`) stops EVERY mini-app."},"TTDConnectAccountsRequest":{"properties":{"api_token":{"type":"string","title":"Api Token","description":"TTD API token"},"advertiser_ids":{"items":{"type":"string"},"type":"array","title":"Advertiser Ids","description":"Advertiser IDs to attach to the client"},"client_id":{"type":"string","title":"Client Id","description":"Supabase client UUID to attach these advertisers to"}},"type":"object","required":["api_token","advertiser_ids","client_id"],"title":"TTDConnectAccountsRequest","description":"Request body for POST /oauth/ttd/connect-accounts (bulk, STR-388)."},"TTDConnectRequest":{"properties":{"api_token":{"type":"string","title":"Api Token","description":"TTD API token from the TTD platform portal"},"advertiser_id":{"type":"string","title":"Advertiser Id","description":"TTD advertiser ID to connect (e.g. 'abc123')"},"client_id":{"type":"string","title":"Client Id","description":"Supabase client UUID to assign this ad account to"}},"type":"object","required":["api_token","advertiser_id","client_id"],"title":"TTDConnectRequest","description":"Request body for POST /oauth/ttd/connect.\nThe user submits their TTD API token and the advertiser ID they want\nto connect. Both are obtained from the TTD platform portal."},"TTDListAdvertisersRequest":{"properties":{"api_token":{"type":"string","title":"Api Token","description":"TTD API token from the TTD platform portal"}},"type":"object","required":["api_token"],"title":"TTDListAdvertisersRequest","description":"Request body for POST /oauth/ttd/list-advertisers."},"Target":{"properties":{"campaign_group_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Campaign Group Id"},"kind":{"type":"string","enum":["upload","enrichment"],"title":"Kind","default":"upload"},"platform_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Platform Slug"},"advertiser_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Advertiser Id"},"dataset_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Dataset Id"},"dataset_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dataset Name"},"account_choice":{"anyOf":[{"type":"string","enum":["template","file"]},{"type":"null"}],"title":"Account Choice"}},"additionalProperties":false,"type":"object","title":"Target"},"TemplatePatchRequest":{"properties":{"name":{"type":"string","title":"Name"}},"type":"object","required":["name"],"title":"TemplatePatchRequest"},"TierModelSelection":{"properties":{"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"},"tiers":{"additionalProperties":{"type":"string"},"type":"object","title":"Tiers"}},"type":"object","title":"TierModelSelection","description":"STR-181 run model selection forwarded to the engine: a provider hint +\ntier→`backend:model` slugs (high / mid / low reasoning). Validated by the\nengine (slug parse + key presence); apps/api just relays it."},"TimeseriesAnchor":{"properties":{"date":{"type":"string","title":"Date"},"current":{"type":"number","title":"Current"},"prior":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Prior"}},"type":"object","required":["date","current"],"title":"TimeseriesAnchor","description":"Compact anchor point for timeseries/barchart insights."},"TimeseriesSummary":{"properties":{"current_total":{"type":"number","title":"Current Total"},"prior_total":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Prior Total"},"pct_diff_vs_prior":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Pct Diff Vs Prior"},"start_value":{"type":"number","title":"Start Value"},"end_value":{"type":"number","title":"End Value"},"window_change_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Window Change Pct"},"days_above_prior":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Days Above Prior"},"days_below_prior":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Days Below Prior"}},"type":"object","required":["current_total","start_value","end_value"],"title":"TimeseriesSummary","description":"Authoritative summary stats to prevent wrong 'overall' conclusions."},"Transform":{"properties":{"decimal_separator":{"anyOf":[{"type":"string","enum":[".",","]},{"type":"null"}],"title":"Decimal Separator"},"date_order":{"anyOf":[{"type":"string","enum":["YMD","DMY","MDY"]},{"type":"null"}],"title":"Date Order"}},"additionalProperties":false,"type":"object","title":"Transform"},"UpdateCampaignGroupRequest":{"properties":{"reporting_currency":{"anyOf":[{"type":"string","pattern":"^[A-Z]{3}$"},{"type":"null"}],"title":"Reporting Currency"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"week_anchor":{"anyOf":[{"type":"string","enum":["monday","week_ending_saturday","week_ending_sunday","broadcast"]},{"type":"null"}],"title":"Week Anchor"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"campaign_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Campaign Ids"},"kind":{"anyOf":[{"type":"string","enum":["live","static","hybrid"]},{"type":"null"}],"title":"Kind"},"confirm_separate_accounts":{"type":"boolean","title":"Confirm Separate Accounts","default":false},"goal":{"anyOf":[{"type":"string","enum":["reach","conversion","engagement"]},{"type":"null"}],"title":"Goal"},"start_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Date"},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Date"},"budget":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Budget"}},"type":"object","title":"UpdateCampaignGroupRequest"},"UpdateMemberRequest":{"properties":{"role":{"anyOf":[{"type":"string","enum":["admin","editor","viewer","member"]},{"type":"null"}],"title":"Role"},"client_scope":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Client Scope"}},"type":"object","title":"UpdateMemberRequest","description":"Request body for updating a member's role + scope.\n\nBoth fields are optional; pass only what you want to change. To clear\na member's scope (give them agency-wide visibility), pass an empty\n`client_scope` list explicitly. Owner/admin can never be scope-restricted\n— passing `client_scope` for them is a no-op."},"UpdateNewsFeedRequest":{"properties":{"name":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Name","description":"Display name for this news feed"},"type":{"anyOf":[{"type":"string","enum":["client_news","competitor_watch","trend_radar","custom"]},{"type":"null"}],"title":"Type","description":"News feed type"},"search_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search Prompt","description":"Custom search prompt for the feed"}},"type":"object","title":"UpdateNewsFeedRequest"},"UpdateReportRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name","description":"Report name"},"config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Config","description":"Report configuration (JSON)"},"visibility":{"anyOf":[{"type":"string","pattern":"^(private|shared)$"},{"type":"null"}],"title":"Visibility","description":"Report visibility"},"version_origin":{"anyOf":[{"type":"string","enum":["save","assistant","restore"]},{"type":"null"}],"title":"Version Origin","description":"Why the config changed (default save)"},"version_label":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Version Label","description":"Version label (default by origin)"}},"type":"object","title":"UpdateReportRequest","description":"Request body for updating an existing report."},"UpdateRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name"},"rule":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Rule"},"set_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Set Id"}},"type":"object","title":"UpdateRequest"},"UpdateSearchNamesRequest":{"properties":{"search_names":{"items":{"type":"string"},"type":"array","title":"Search Names","description":"Manual search names / terms for this feed"}},"type":"object","required":["search_names"],"title":"UpdateSearchNamesRequest"},"UpdateVerdictOutcomeRequest":{"properties":{"outcome":{"type":"string","title":"Outcome"}},"additionalProperties":false,"type":"object","required":["outcome"],"title":"UpdateVerdictOutcomeRequest"},"UpdateWidgetDefinitionRequest":{"properties":{"envelope":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Envelope"},"envelope_version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Envelope Version"},"scope":{"anyOf":[{"type":"string","enum":["user_draft","dashboard"]},{"type":"null"}],"title":"Scope"},"report_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Report Id"}},"additionalProperties":false,"type":"object","title":"UpdateWidgetDefinitionRequest"},"UserCardRequest":{"properties":{"client_id":{"type":"string","format":"uuid","title":"Client Id"},"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title"},"metric":{"type":"string","maxLength":64,"minLength":1,"title":"Metric"},"observed":{"type":"string","maxLength":64,"minLength":1,"title":"Observed"},"expected":{"type":"string","maxLength":64,"minLength":1,"title":"Expected"},"gap":{"type":"string","maxLength":64,"minLength":1,"title":"Gap"},"why":{"type":"string","maxLength":2000,"title":"Why","default":""},"suggested_action":{"type":"string","maxLength":300,"title":"Suggested Action","default":""},"source":{"type":"string","maxLength":120,"minLength":1,"title":"Source"},"entity_type":{"type":"string","enum":["client","campaign_group"],"title":"Entity Type"},"entity_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Entity Id"}},"type":"object","required":["client_id","title","metric","observed","expected","gap","source","entity_type"],"title":"UserCardRequest","description":"The cross-agent seam body. Length caps are enforced HERE (422 beyond)."},"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"},"VerificationMethod":{"type":"string","enum":["video_call","known_in_person","manager_confirmed","other"],"title":"VerificationMethod","description":"How the operator established that the caller is the account holder.\n\nA CLOSED vocabulary, not free text, and it is the point of the field. A\nfree-text reason records that somebody typed something; this records which\nof a known set of checks was performed, so an access review can ask \"how\nmany MFA resets were authorised by `other` this quarter\" and get an\nanswer. The free-text note rides alongside and is required for `other`."},"WidgetControl":{"properties":{"key":{"type":"string","maxLength":80,"title":"Key"},"label":{"type":"string","maxLength":120,"title":"Label","default":""},"kind":{"type":"string","enum":["choice","boolean","number","list","text","filter"],"title":"Kind"},"values":{"items":{"type":"string","maxLength":256},"type":"array","maxItems":60,"title":"Values"},"min":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min"},"max":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max"},"fields":{"items":{"$ref":"#/components/schemas/FilterControlField"},"type":"array","maxItems":24,"title":"Fields"},"current":{"title":"Current"}},"type":"object","required":["key","kind"],"title":"WidgetControl","description":"One editable control on a widget, as declared by the frontend.\n\nServes TWO surfaces: the /widget-edit flow (the widget's own inspector\ncontrols) and — round-7 pilot review — the catalog entries' authoring\ncontrols, where the FE ships the compact shape {key, label, kind,\nchoices?, min?, max?, default?}. The aliases make both spellings land\non one model; validation happens in `_validate_patch_value` either way."},"WidgetEditRequest":{"properties":{"semantic_catalog":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Semantic Catalog"},"semantic_catalog_hash":{"anyOf":[{"type":"string","pattern":"^[a-f0-9]{64}$"},{"type":"null"}],"title":"Semantic Catalog Hash"},"client_id":{"type":"string","title":"Client Id"},"instruction":{"type":"string","maxLength":500,"minLength":1,"title":"Instruction"},"widget_type":{"type":"string","maxLength":64,"title":"Widget Type"},"widget_title":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Widget Title"},"metric":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Metric"},"source":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Source"},"dimensions":{"items":{"type":"string"},"type":"array","maxItems":8,"title":"Dimensions"},"controls":{"items":{"$ref":"#/components/schemas/WidgetControl"},"type":"array","maxItems":48,"title":"Controls"}},"type":"object","required":["client_id","instruction","widget_type"],"title":"WidgetEditRequest"},"WidgetPick":{"properties":{"id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Id"},"source":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Source"},"dimensions":{"items":{"type":"string"},"type":"array","maxItems":8,"title":"Dimensions"},"type":{"type":"string","maxLength":64,"title":"Type"},"metric":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Metric"},"size":{"type":"string","enum":["hero","large","medium","compact"],"title":"Size","default":"medium"},"title":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Title"},"options":{"additionalProperties":true,"type":"object","title":"Options"},"rationale":{"type":"string","maxLength":600,"title":"Rationale","default":""},"role":{"anyOf":[{"type":"string","maxLength":24},{"type":"null"}],"title":"Role"},"group":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Group"},"repeat":{"anyOf":[{"type":"string","maxLength":24},{"type":"null"}],"title":"Repeat"},"z":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Z"},"width":{"anyOf":[{"type":"integer","maximum":12.0,"minimum":1.0},{"type":"null"}],"title":"Width"}},"type":"object","required":["type"],"title":"WidgetPick","description":"One widget selection.\n\n`id` is the FRONTEND's widget id: inbound on assist `current_picks` so\nthe server board can preserve widget identity, echoed on outbound picks\n(null = a widget the model newly added). `role` is the archetype role\nthe model assigned (advisory packer metadata). `group` is the model's\nfree-text tag for what this widget belongs with (STR-531 step 1.3) —\nsame chart family, same platform focus or the same question. All three\nare additive (STR-531) and default to None for every pre-existing caller."},"WidgetPickRequest":{"properties":{"semantic_catalog":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Semantic Catalog"},"semantic_catalog_hash":{"anyOf":[{"type":"string","pattern":"^[a-f0-9]{64}$"},{"type":"null"}],"title":"Semantic Catalog Hash"},"client_id":{"type":"string","title":"Client Id"},"prompt":{"type":"string","maxLength":300,"minLength":1,"title":"Prompt"},"catalog":{"items":{"$ref":"#/components/schemas/CatalogWidget"},"type":"array","maxItems":40,"minItems":1,"title":"Catalog"}},"type":"object","required":["client_id","prompt","catalog"],"title":"WidgetPickRequest"},"Window":{"properties":{"start":{"type":"string","format":"date","title":"Start"},"end":{"type":"string","format":"date","title":"End"}},"additionalProperties":false,"type":"object","required":["start","end"],"title":"Window"},"WithheldVerdictRequest":{"properties":{"verdict":{"type":"string","enum":["correctly_withheld","should_have_published","unsure"],"title":"Verdict"},"note":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Note"}},"type":"object","required":["verdict"],"title":"WithheldVerdictRequest","description":"A reviewer's judgement of one refusal."},"WorkspaceResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"data":{"additionalProperties":true,"type":"object","title":"Data"}},"type":"object","required":["success","data"],"title":"WorkspaceResponse","description":"Response model for workspace data."},"_GenerateContextPreviewBody":{"properties":{"agency_id":{"type":"string","format":"uuid","title":"Agency Id"},"name":{"type":"string","title":"Name"},"website":{"type":"string","title":"Website"}},"type":"object","required":["agency_id","name","website"],"title":"_GenerateContextPreviewBody"},"_UpdateClientContextBody":{"properties":{"client_context":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"string"}],"title":"Client Context"}},"type":"object","required":["client_context"],"title":"_UpdateClientContextBody"},"app__routers__data_uploads__PreviewRequest":{"properties":{"plan":{"$ref":"#/components/schemas/Plan"},"target":{"$ref":"#/components/schemas/Target"},"merge":{"$ref":"#/components/schemas/Merge"},"save_template":{"type":"boolean","title":"Save Template","default":false},"template_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Template Name"},"fx_snapshot_hash":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Fx Snapshot Hash"},"value_query":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Value Query"},"include_sample":{"type":"boolean","title":"Include Sample","default":false}},"additionalProperties":false,"type":"object","title":"PreviewRequest","description":"The preview's body: confirm's, plus `value_query` (STR-1401 §5.2.4),\nthe text to find among the listed column's values. Confirm refuses it."},"app__routers__entity_groups__PreviewRequest":{"properties":{"level":{"type":"string","enum":["campaign","ad_group","ad","creative"],"title":"Level","default":"ad"},"rule":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Rule"},"include_keys":{"items":{"type":"string"},"type":"array","title":"Include Keys"},"exclude_keys":{"items":{"type":"string"},"type":"array","title":"Exclude Keys"}},"type":"object","title":"PreviewRequest"}}}}