Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
title: Edge S2 Briefing Service Admin API
description: Serves OGT briefings and handles report ingestion.
version: 0.1.0
tags:
- name: Admin
paths:
/admin/courses:
get:
summary: Admin Courses Rollup
description: 'Engagement funnel rollup. Reads from ogt_course_events + ogt_waitlist_signups
collections. Pass ?days=30 for a wider window. Behind admin basic auth.'
operationId: admin_courses_rollup_admin_courses_get
parameters:
- name: days
in: query
required: false
schema:
type: integer
default: 7
title: Days
responses:
'200':
description: Successful Response
content:
text/html:
schema:
type: string
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Admin
/admin/courses/feedback:
get:
summary: Admin Courses Feedback
description: 'Read every feedback submission in the window. Filterable by clip slug.
Behind admin basic auth, same as /admin/courses.'
operationId: admin_courses_feedback_admin_courses_feedback_get
parameters:
- name: days
in: query
required: false
schema:
type: integer
default: 30
title: Days
- name: clip
in: query
required: false
schema:
type: string
default: ''
title: Clip
responses:
'200':
description: Successful Response
content:
text/html:
schema:
type: string
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Admin
/api/admin/send-digest:
post:
summary: Admin Send Digest
description: 'One-shot trigger for The Sunday Owl digest.
Body: {"cohort": "test|production|all", "dry_run": bool, "issue_id": int|null}
Auth: X-Cron-Secret header, a Cloud Scheduler OIDC token (scheduler_auth, as every /api/cron route
takes since 2026-10-31) OR admin Basic auth. `test_to` (cohort test only) sends to that one
test-cohort address instead of all of them.
Always test cohort first:
curl -sX POST .../api/admin/send-digest -u admin:"$(gcloud secrets versions access latest --secret=ogt-admin-pass --project lle-edgegc)" \
-H ''Content-Type: application/json'' \
-d ''{"cohort":"test","dry_run":false}'''
operationId: admin_send_digest_api_admin_send_digest_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/api/admin/send-survey:
post:
summary: Admin Send Survey
description: 'One-shot trigger to send the five-question survey email.
Body: {"cohort": "test|production|all", "dry_run": bool}
Auth: X-Cron-Secret header OR admin Basic auth.
Start with cohort=test (sends to 3 ops recipients). If happy, re-run with
cohort=production to blast the live list.'
operationId: admin_send_survey_api_admin_send_survey_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/api/admin/send-survey-followup:
post:
summary: Admin Send Survey Followup
description: 'Send the survey follow-up email (reminder + 3-question vote).
Body: {
"cohort": "test|production|all",
"dry_run": bool,
"exclude_emails": ["a@b.com", ...] # subs to skip on production send
}
Auth: X-Cron-Secret header OR admin Basic auth.'
operationId: admin_send_survey_followup_api_admin_send_survey_followup_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/api/admin/send-test:
post:
summary: Admin Send Test
description: 'Generic test-send. Sends ONE test email with arbitrary content.
Body:
to: single email address (required)
subject: subject line (required) - "[TEST] " is auto-prepended
html: HTML body (required)
plain: plaintext body (optional; falls back to a strip of the HTML)
Returns: {sent: bool, to, subject}'
operationId: admin_send_test_api_admin_send_test_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/api/admin/send-test-video:
post:
summary: Admin Send Test Video
description: 'Convenience: send a test of the video-card CTA for a given course.
Body:
to: single email address (required)
course: slug from /courses (default lions-and-wolves). Available:
lions-and-wolves, monkey-behind-the-wheel, petulant-child,
teeter-totter, trading-as-combat
subject: optional override; default uses the course title
Auto-detects whether the course''s hero GIF is published. If yes,
embeds it. If not, falls back to the SVG play-button card.'
operationId: admin_send_test_video_api_admin_send_test_video_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/api/admin/send-phantom-outreach:
post:
summary: Admin Send Phantom Outreach
description: 'Send a one-off outreach to subscribers we believe were unsubscribed
silently by mail-gateway prefetchers (multi-hit-within-seconds signature
in Cloud Logging).
Asks them to REPLY (not click) to be re-added — a deliberate human
action that prefetchers can''t fake.
Body: {"emails": ["a@b.com", ...], "dry_run": bool}'
operationId: admin_send_phantom_outreach_api_admin_send_phantom_outreach_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/api/admin/send-correction:
post:
summary: Admin Send Correction
description: 'One-off Day-31 correction send to the wrapped cohort (got the
erroneous Day-1 ''We''re back'' email this morning). Body: {"dry_run": bool}.'
operationId: admin_send_correction_api_admin_send_correction_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/admin/survey-responses:
get:
summary: Admin Survey Responses
description: 'Aggregate and return all survey responses to date.
Auth: admin Basic OR X-Cron-Secret.'
operationId: admin_survey_responses_admin_survey_responses_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/api/admin/send-feedback:
post:
summary: Admin Send Feedback
description: 'Fire the buyer-feedback rating email.
Body: {"to": "test|all", "send": bool}
to="test" → sends [TEST] copy to feedback_sender.TEST_RECIPIENT only
to="all" → every live swing-logic buyer, resolved from customers.jsonl
**A request that does not ask to send performs a DRY RUN and returns the
plan.** Sending needs an explicit `{"send": true}` (or `?send=true`);
`{"dry_run": false}` is still honoured for callers written against the old
shape. This endpoint deliberately does NOT use `_dry_run_from()`, which
defaults to a real send — right for an idempotent digest, wrong for a
one-shot campaign to a buyer list, where the cost of an accidental send is
a duplicate ask to real customers that cannot be recalled. Same default as
`tools/send_feedback.py` (`dry_run = not args.send`). PD-327.
This is the sanctioned path for running the campaign: the credential lives
in the service (`OGT_GMAIL_APP_PASSWORD` from Secret Manager), so a caller
needs only the cron secret and never handles the mail identity.
Auth: X-Cron-Secret header OR admin Basic auth.'
operationId: admin_send_feedback_api_admin_send_feedback_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/admin/login:
post:
summary: Admin Login
description: 'Login form target: the token arrives in the POST body, so it is in no
URL. Success sets the cookie and 303s to `next` (a local /admin path).'
operationId: admin_login_admin_login_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/admin/dashboard:
get:
summary: Admin Dashboard Index
description: Redirect to the default tab if authed; show the gate page otherwise.
operationId: admin_dashboard_index_admin_dashboard_get
responses:
'200':
description: Successful Response
content:
text/html:
schema:
type: string
tags:
- Admin
/admin/dashboard/{tab}:
get:
summary: Admin Dashboard Tab
description: Render one tab of the dashboard. Same auth rules as the index.
operationId: admin_dashboard_tab_admin_dashboard__tab__get
parameters:
- name: tab
in: path
required: true
schema:
type: string
title: Tab
responses:
'200':
description: Successful Response
content:
text/html:
schema:
type: string
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Admin
/admin/resend-product-email:
post:
summary: Admin Resend Product Email
description: 'Manually re-send a product fulfillment email to a buyer. Used when
the original send failed (e.g., the SKU wasn''t registered in
PRODUCT_INFO at purchase time). Token + amount are pulled from
customers.jsonl by session_id; pass the session_id in the body.
Optional ``to_email``: the buyer mistyped their address at checkout.
Delegates to ``buyer_email.correct_purchase_email`` — the same path the
buyer-facing ``/api/checkout/fix-email`` uses — which records a fresh
token under the corrected address with the SAME session_id (no revenue
double-count) and sends the fulfillment email there.'
operationId: admin_resend_product_email_admin_resend_product_email_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/admin/aggregate:
get:
summary: Admin Aggregate
description: 'Trigger the daily aggregator. Defaults to yesterday (UTC) which is
what the nightly cron passes. Pass `?date=YYYY-MM-DD` to backfill or
re-run a specific date. Admin-token-gated like the dashboard.'
operationId: admin_aggregate_admin_aggregate_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
post:
summary: Admin Aggregate
description: 'Trigger the daily aggregator. Defaults to yesterday (UTC) which is
what the nightly cron passes. Pass `?date=YYYY-MM-DD` to backfill or
re-run a specific date. Admin-token-gated like the dashboard.'
operationId: admin_aggregate_admin_aggregate_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/admin/compact:
get:
summary: Admin Compact
description: 'Compact per-batch engagement blobs for a date into a single file.
Fixes the aggregator 30s-timeout from 2026-06-12 — at ~4000 batches/day,
enumerating + reading the per-batch dir blew past Cloud Run''s request
budget. The compacted single file is one O(1) GCS read.
Defaults to yesterday (UTC). Pass `?date=YYYY-MM-DD` to target a
specific date — useful for backfilling broken days.
Idempotent — running again on an already-compacted day folds in any
late-arriving per-batch blobs and re-emits the single file. Safe to
schedule nightly via Cloud Scheduler.
Gated like /admin/aggregate: admin token, or a Cloud Scheduler OIDC
identity token (src/serve/scheduler_auth.py, PD-388).'
operationId: admin_compact_admin_compact_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
post:
summary: Admin Compact
description: 'Compact per-batch engagement blobs for a date into a single file.
Fixes the aggregator 30s-timeout from 2026-06-12 — at ~4000 batches/day,
enumerating + reading the per-batch dir blew past Cloud Run''s request
budget. The compacted single file is one O(1) GCS read.
Defaults to yesterday (UTC). Pass `?date=YYYY-MM-DD` to target a
specific date — useful for backfilling broken days.
Idempotent — running again on an already-compacted day folds in any
late-arriving per-batch blobs and re-emits the single file. Safe to
schedule nightly via Cloud Scheduler.
Gated like /admin/aggregate: admin token, or a Cloud Scheduler OIDC
identity token (src/serve/scheduler_auth.py, PD-388).'
operationId: admin_compact_admin_compact_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/admin/funnel-diagnostic.json:
get:
summary: Admin Funnel Diagnostic
description: 'JSON funnel diagnostic for the 3 video-product SKUs.
Combines:
- Engage event traffic per SKU (landed, scrolled, buy_now_click)
- Behavioral bot classification (no session_end + no interaction = bot)
- Stripe checkout sessions in window, bucketed by status (open/complete/expired)'
operationId: admin_funnel_diagnostic_admin_funnel_diagnostic_json_get
parameters:
- name: days
in: query
required: false
schema:
type: integer
default: 7
title: Days
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Admin
/admin/engagement:
get:
summary: Admin Engagement
description: Engagement dashboard — last N days.
operationId: admin_engagement_admin_engagement_get
parameters:
- name: days
in: query
required: false
schema:
type: integer
default: 7
title: Days
responses:
'200':
description: Successful Response
content:
text/html:
schema:
type: string
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Admin
/admin/email-preview:
get:
summary: Admin Email Preview
description: 'Browsable review of an email sequence — renders every email exactly as
it sends, stacked in one scrollable page. Admin basic-auth gated.
?set=month1 -> the live 30-day sequence (emails-30day.json)
?set=month2 -> the Days 31-60 draft (emails-month2.json)
?set=fillers -> the four welcome fillers (filler_emails.json)
Every card carries an anchor (#day-N, #issue-N, #filler-N) so the
dashboard''s Emails tab can link straight to one email. Accepts the
dashboard''s admin cookie as well as Basic auth.'
operationId: admin_email_preview_admin_email_preview_get
parameters:
- name: set
in: query
required: false
schema:
type: string
default: month2
title: Set
responses:
'200':
description: Successful Response
content:
text/html:
schema:
type: string
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Admin
/api/admin/preview-cohort-send:
post:
summary: Admin Preview Cohort Send
description: 'Dry-run the cohort-aware send for a given date and cohort.
Body: {"date": "YYYY-MM-DD", "cohort": "test|production|all"}
Returns the same shape as run_cohort_send but with no actual SMTP sends.'
operationId: admin_preview_cohort_send_api_admin_preview_cohort_send_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/api/admin/send-test-email:
post:
summary: Admin Send Test Email
description: 'Send a single rotation email to a specific recipient for ad-hoc testing.
Body: {"email": "...", "day": N} (day defaults to 1)
Auth: X-Cron-Secret header OR admin Basic auth.'
operationId: admin_send_test_email_api_admin_send_test_email_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
/api/admin/bounce-unsubscribe:
post:
summary: Admin Bounce Unsubscribe
description: 'Batch-unsubscribe a list of bounced addresses with a single GCS write.
Body: {"emails": ["a@b.com", ...]}
Auth: X-Cron-Secret header OR admin Basic auth.'
operationId: admin_bounce_unsubscribe_api_admin_bounce_unsubscribe_post
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Admin
components:
schemas:
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
type: object
required:
- loc
- msg
- type
title: ValidationError