{"openapi":"3.1.0","info":{"title":"Tarbia Standard Backend","description":"The vehicle (SB v1.0): deterministic backend machinery around the governed engine. No model client, no learner-reformation write path (Boundary Law B-8). Generated OpenAPI is the only API documentation.","version":"1.0.0"},"paths":{"/v1/tenants":{"get":{"tags":["tenants"],"summary":"List Tenants","operationId":"list_tenants_v1_tenants_get","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["tenants"],"summary":"Create Tenant","operationId":"create_tenant_v1_tenants_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantRecord"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/tenants/{tenant_id}":{"get":{"tags":["tenants"],"summary":"Get Tenant","operationId":"get_tenant_v1_tenants__tenant_id__get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantRecord"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/accounts":{"get":{"tags":["accounts"],"summary":"List Accounts","operationId":"list_accounts_v1_accounts_get","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["accounts"],"summary":"Create Account","operationId":"create_account_v1_accounts_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountRecord"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/accounts/{account_id}":{"get":{"tags":["accounts"],"summary":"Get Account","operationId":"get_account_v1_accounts__account_id__get","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountRecord"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/signups":{"post":{"tags":["signups"],"summary":"Sign Up","operationId":"sign_up_v1_signups_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupBody"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountRecord"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/organization-signups":{"post":{"tags":["organization-signups"],"summary":"Sign Up Organization","operationId":"sign_up_organization_v1_organization_signups_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationSignupRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountRecord"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/sessions":{"get":{"tags":["sessions"],"summary":"List Sessions","operationId":"list_sessions_v1_sessions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/SessionRecord"},"type":"array","title":"Response List Sessions V1 Sessions Get"}}}}}},"post":{"tags":["sessions"],"summary":"Login","operationId":"login_v1_sessions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/sessions/refresh":{"post":{"tags":["sessions"],"summary":"Refresh","operationId":"refresh_v1_sessions_refresh_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenPair"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/sessions/{session_id}":{"delete":{"tags":["sessions"],"summary":"Revoke Session","operationId":"revoke_session_v1_sessions__session_id__delete","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/devices":{"get":{"tags":["devices"],"summary":"List Devices","operationId":"list_devices_v1_devices_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/DeviceRecord"},"type":"array","title":"Response List Devices V1 Devices Get"}}}}}}},"/v1/devices/{device_id}":{"delete":{"tags":["devices"],"summary":"Revoke Device","operationId":"revoke_device_v1_devices__device_id__delete","parameters":[{"name":"device_id","in":"path","required":true,"schema":{"type":"string","title":"Device Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/principals/me":{"get":{"tags":["principals"],"summary":"Me","operationId":"me_v1_principals_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrincipalView"}}}}}}},"/v1/principals/me/learners":{"get":{"tags":["principals"],"summary":"My Learners","operationId":"my_learners_v1_principals_me_learners_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/AccountRecord"},"type":"array","title":"Response My Learners V1 Principals Me Learners Get"}}}}}}},"/v1/mfa-enrollments":{"post":{"tags":["mfa-enrollments"],"summary":"Start Enrollment","operationId":"start_enrollment_v1_mfa_enrollments_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MfaProvision"}}}}}}},"/v1/mfa-enrollments/confirm":{"post":{"tags":["mfa-enrollments"],"summary":"Confirm Enrollment","operationId":"confirm_enrollment_v1_mfa_enrollments_confirm_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MfaConfirmRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MfaEnrollment"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/guardian-links":{"get":{"tags":["guardian-links"],"summary":"List Links","operationId":"list_links_v1_guardian_links_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/GuardianLink"},"type":"array","title":"Response List Links V1 Guardian Links Get"}}}}}},"post":{"tags":["guardian-links"],"summary":"Create Link","operationId":"create_link_v1_guardian_links_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuardianLinkRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuardianLink"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/consents":{"post":{"tags":["consents"],"summary":"Record Consent","operationId":"record_consent_v1_consents_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentEvidence"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/consents/exports/{learner_account_id}":{"get":{"tags":["consents"],"summary":"Export Consent","operationId":"export_consent_v1_consents_exports__learner_account_id__get","parameters":[{"name":"learner_account_id","in":"path","required":true,"schema":{"type":"string","title":"Learner Account Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentExport"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/age-records":{"post":{"tags":["age-consent"],"summary":"Submit Dob","operationId":"submit_dob_v1_age_records_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitDobBody"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearnerAgeRecord"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/guardian-consent-requests":{"post":{"tags":["age-consent"],"summary":"Issue Consent Link","operationId":"issue_consent_link_v1_guardian_consent_requests_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssueConsentLinkBody"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuardianConsentRequest"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/guardian-consent-requests/redeem":{"post":{"tags":["age-consent"],"summary":"Redeem Consent Link","operationId":"redeem_consent_link_v1_guardian_consent_requests_redeem_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedeemConsentBody"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentEvidence"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/learners/{learner_account_id}":{"get":{"tags":["learners"],"summary":"Read Learner","operationId":"read_learner_v1_learners__learner_account_id__get","parameters":[{"name":"learner_account_id","in":"path","required":true,"schema":{"type":"string","title":"Learner Account Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountRecord"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/tenant-admins":{"post":{"tags":["tenant-admins"],"summary":"Grant Admin","operationId":"grant_admin_v1_tenant_admins_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantAdminRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantAdminGrant"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/tenant-brandings/{tenant_id}":{"put":{"tags":["tenant-brandings"],"summary":"Set Branding","operationId":"set_branding_v1_tenant_brandings__tenant_id__put","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantBrandingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantBranding"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["tenant-brandings"],"summary":"Get Branding","operationId":"get_branding_v1_tenant_brandings__tenant_id__get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantBranding"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/tenant-policies/{tenant_id}":{"put":{"tags":["tenant-policies"],"summary":"Set Policy","operationId":"set_policy_v1_tenant_policies__tenant_id__put","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantDataPolicyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantDataPolicy"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing-webhooks":{"post":{"tags":["billing-webhooks"],"summary":"Ingest Webhook","operationId":"ingest_webhook_v1_billing_webhooks_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingEventRecord"}}}}}}},"/v1/uploads":{"post":{"tags":["uploads"],"summary":"Create Upload","operationId":"create_upload_v1_uploads_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadIntent"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignedUploadTicket"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin-actions/refunds":{"post":{"tags":["admin-actions"],"summary":"Admin Refund","operationId":"admin_refund_v1_admin_actions_refunds_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAuditEntry"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin-actions/impersonation-grants":{"post":{"tags":["admin-actions"],"summary":"Grant","operationId":"grant_v1_admin_actions_impersonation_grants_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonationGrantRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonationGrant"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin-actions/impersonation-approvals":{"post":{"tags":["admin-actions"],"summary":"Approve","operationId":"approve_v1_admin_actions_impersonation_approvals_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonationApprovalRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonationGrant"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin-actions/impersonation-accesses":{"post":{"tags":["admin-actions"],"summary":"Access","operationId":"access_v1_admin_actions_impersonation_accesses_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonationAccessRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonationActivity"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/admin-actions/audit-reviews":{"get":{"tags":["admin-actions"],"summary":"Audit Reviews","operationId":"audit_reviews_v1_admin_actions_audit_reviews_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/AuditRecord"},"type":"array","title":"Response Audit Reviews V1 Admin Actions Audit Reviews Get"}}}}}}},"/v1/admin-actions/abuse-closures":{"post":{"tags":["admin-actions"],"summary":"Close Abuse","operationId":"close_abuse_v1_admin_actions_abuse_closures_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbuseCloseRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Close Abuse V1 Admin Actions Abuse Closures Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/feedbacks":{"post":{"tags":["support"],"summary":"File Feedback","operationId":"file_feedback_v1_feedbacks_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Feedback"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Feedback"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/abuse-reports":{"post":{"tags":["support"],"summary":"File Abuse","operationId":"file_abuse_v1_abuse_reports_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbuseReport"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbuseReport"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/impersonation-activities":{"get":{"tags":["impersonation-activities"],"summary":"List Activities","operationId":"list_activities_v1_impersonation_activities_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ImpersonationActivity"},"type":"array","title":"Response List Activities V1 Impersonation Activities Get"}}}}}}},"/v1/erasure-requests":{"post":{"tags":["compliance"],"summary":"Request Erasure","operationId":"request_erasure_v1_erasure_requests_post","responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErasureReceipt"}}}}}}},"/v1/probes/liveness":{"get":{"tags":["probes"],"summary":"Live","operationId":"live_v1_probes_liveness_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LivenessReport"}}}}}}},"/v1/probes/readiness":{"get":{"tags":["probes"],"summary":"Ready","operationId":"ready_v1_probes_readiness_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadinessReport"}}}}}}}},"components":{"schemas":{"AbuseCategory":{"type":"string","enum":["harassment","spam","self_harm","csae","other"],"title":"AbuseCategory"},"AbuseCloseRequest":{"properties":{"report_id":{"type":"string","pattern":"^abr_[A-Za-z0-9\\-]{6,64}$","title":"Report Id"},"closed_by":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Closed By"}},"additionalProperties":false,"type":"object","required":["report_id"],"title":"AbuseCloseRequest","description":"Router body to close an abuse report. `closed_by` is the human-role actor\nid — REQUIRED for an escalated report (a pure-AI close is refused by the\nservice); optional for a non-escalated one."},"AbuseReport":{"properties":{"report_id":{"type":"string","pattern":"^abr_[A-Za-z0-9\\-]{6,64}$","title":"Report Id"},"reporter_actor_id":{"type":"string","maxLength":200,"minLength":1,"title":"Reporter Actor Id"},"subject_ref":{"type":"string","maxLength":200,"minLength":1,"title":"Subject Ref"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"category":{"$ref":"#/components/schemas/AbuseCategory"},"touches_minor":{"type":"boolean","title":"Touches Minor","default":false},"safeguarding":{"type":"boolean","title":"Safeguarding","default":false},"escalated":{"type":"boolean","title":"Escalated","default":false},"status":{"$ref":"#/components/schemas/ModerationStatus","default":"open"},"closed_by":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Closed By"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"additionalProperties":false,"type":"object","required":["report_id","reporter_actor_id","subject_ref","tenant_id","category"],"title":"AbuseReport","description":"Abuse-report intake with a moderation queue row (SB Part 8). Reports\ntouching minors or safeguarding auto-escalate to human review via the\n`escalated` MentorLive flag — the service NEVER closes such a report without\na human-role actor id (never a pure-AI close). `closed_by` is that human."},"AccountCreate":{"properties":{"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"email":{"type":"string","pattern":"^[^@\\s]{1,64}@[^@\\s]{1,255}\\.[^@\\s]{2,24}$","title":"Email"},"role_profiles":{"items":{"$ref":"#/components/schemas/RoleProfile"},"type":"array","minItems":1,"title":"Role Profiles"}},"additionalProperties":false,"type":"object","required":["tenant_id","email","role_profiles"],"title":"AccountCreate"},"AccountPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AccountRecord"},"type":"array","title":"Items"},"page":{"$ref":"#/components/schemas/PageInfo"}},"additionalProperties":false,"type":"object","required":["items","page"],"title":"AccountPage"},"AccountRecord":{"properties":{"account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Account Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"email":{"type":"string","pattern":"^[^@\\s]{1,64}@[^@\\s]{1,255}\\.[^@\\s]{2,24}$","title":"Email"},"role_profiles":{"items":{"$ref":"#/components/schemas/RoleProfile"},"type":"array","minItems":1,"title":"Role Profiles"},"status":{"$ref":"#/components/schemas/AccountStatus","default":"active"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"additionalProperties":false,"type":"object","required":["account_id","tenant_id","email","role_profiles"],"title":"AccountRecord"},"AccountStatus":{"type":"string","enum":["active","suspended"],"title":"AccountStatus"},"AgeBand":{"type":"string","enum":["kids_0_4","children_5_11","teens_12_19","youth_20_34","adults_35_49","seniors_50_plus"],"title":"AgeBand","description":"Frontend F-4 / R-20 — six locked bands. Pedagogical stages S1–S5 are\nDATA inside bands (Age-Wise Framework), never new enum members."},"AuditEventKind":{"type":"string","enum":["admin_action","security_event","payment_event","data_access","consent_change","config_change","flag_change"],"title":"AuditEventKind","description":"The audit event taxonomy (SB Part 8): admin actions, security events,\npayment events, data access to learner_personal+, consent + config/flag\nchanges."},"AuditRecord":{"properties":{"audit_id":{"type":"string","pattern":"^aud_[A-Za-z0-9\\-]{6,64}$","title":"Audit Id"},"kind":{"$ref":"#/components/schemas/AuditEventKind"},"actor_id":{"type":"string","maxLength":120,"minLength":1,"title":"Actor Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"target_type":{"type":"string","maxLength":120,"minLength":1,"title":"Target Type"},"target_id":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Target Id"},"previous_value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Previous Value"},"new_value":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"New Value"},"request_id":{"type":"string","pattern":"^req_[A-Za-z0-9\\-]{6,64}$","title":"Request Id"},"classification":{"type":"string","title":"Classification","default":"tenant"},"retention_class":{"type":"string","title":"Retention Class","default":"standard"},"occurred_at":{"type":"string","format":"date-time","title":"Occurred At"}},"additionalProperties":false,"type":"object","required":["audit_id","kind","actor_id","tenant_id","target_type","request_id"],"title":"AuditRecord","description":"Append-only immutable audit row (SB Part 8): who/what/when/previous\nvalue/request_id. `classification` + `retention_class` make retention\nclassification-aware (B-6). Once appended it is NEVER updated or deleted (the\nstore has no such method; the DB REVOKEs update/delete)."},"AuthMethod":{"type":"string","enum":["password","oauth","magic_link","password_reset"],"title":"AuthMethod","description":"SB Part 3 flows — one identity, several credential doors."},"BillingEventRecord":{"properties":{"event_id":{"type":"string","pattern":"^evt_[A-Za-z0-9\\-]{6,64}$","title":"Event Id"},"event_type":{"$ref":"#/components/schemas/BillingEventType"},"subscription_id":{"type":"string","pattern":"^sub_[A-Za-z0-9\\-]{6,64}$","title":"Subscription Id"},"account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Account Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"sequence":{"type":"integer","minimum":0.0,"title":"Sequence"},"applied":{"type":"boolean","title":"Applied","default":false},"request_id":{"type":"string","pattern":"^req_[A-Za-z0-9\\-]{6,64}$","title":"Request Id"},"received_at":{"type":"string","format":"date-time","title":"Received At"}},"additionalProperties":false,"type":"object","required":["event_id","event_type","subscription_id","account_id","tenant_id","sequence","request_id"],"title":"BillingEventRecord","description":"Append-only idempotency ledger row (event_id is the dedupe key)."},"BillingEventType":{"type":"string","enum":["checkout_completed","trial_started","subscription_activated","payment_failed","subscription_canceled"],"title":"BillingEventType","description":"The INTERNAL webhook vocabulary — Stripe event types map onto these in\nthe adapter; the state machine is written against THIS enum, never vendor\nstrings (adapters-not-vendors)."},"ConsentDecision":{"type":"string","enum":["granted","revoked"],"title":"ConsentDecision"},"ConsentEvidence":{"properties":{"consent_id":{"type":"string","pattern":"^cns_[A-Za-z0-9\\-]{6,64}$","title":"Consent Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"guardian_account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Guardian Account Id"},"learner_account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Learner Account Id"},"scope":{"type":"string","pattern":"^[a-z][a-z0-9_.]{2,64}$","title":"Scope"},"text_version":{"type":"string","pattern":"^[A-Za-z0-9_.\\-]{1,32}$","title":"Text Version"},"decision":{"$ref":"#/components/schemas/ConsentDecision"},"request_id":{"type":"string","pattern":"^req_[A-Za-z0-9\\-]{6,64}$","title":"Request Id"},"decided_at":{"type":"string","format":"date-time","title":"Decided At"}},"additionalProperties":false,"type":"object","required":["consent_id","tenant_id","guardian_account_id","learner_account_id","scope","text_version","decision","request_id"],"title":"ConsentEvidence","description":"Who/what/when/which-version (SB Part 3 / MAS §4.5.5); SB DATA to G-10."},"ConsentExport":{"properties":{"learner_account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Learner Account Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"evidence":{"items":{"$ref":"#/components/schemas/ConsentEvidence"},"type":"array","title":"Evidence"},"generated_at":{"type":"string","format":"date-time","title":"Generated At"}},"additionalProperties":false,"type":"object","required":["learner_account_id","tenant_id","evidence"],"title":"ConsentExport","description":"Typed per-learner consent export (regulator-ready; SB Part 3)."},"ConsentRequest":{"properties":{"learner_account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Learner Account Id"},"scope":{"type":"string","pattern":"^[a-z][a-z0-9_.]{2,64}$","title":"Scope"},"text_version":{"type":"string","pattern":"^[A-Za-z0-9_.\\-]{1,32}$","title":"Text Version"},"decision":{"$ref":"#/components/schemas/ConsentDecision","default":"granted"},"tenant_id":{"anyOf":[{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$"},{"type":"null"}],"title":"Tenant Id"}},"additionalProperties":false,"type":"object","required":["learner_account_id","scope","text_version"],"title":"ConsentRequest"},"DataClassification":{"type":"string","enum":["public","tenant","learner_personal","learner_reformation","learner_creation","crisis","financial"],"title":"DataClassification","description":"SB B-6 — drives RLS strictness, log redaction, retention, export."},"DeviceRecord":{"properties":{"device_id":{"type":"string","pattern":"^dev_[A-Za-z0-9\\-]{6,64}$","title":"Device Id"},"account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Account Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"label":{"type":"string","maxLength":120,"minLength":1,"title":"Label","default":"device"},"status":{"$ref":"#/components/schemas/DeviceStatus","default":"active"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"last_seen_at":{"type":"string","format":"date-time","title":"Last Seen At"}},"additionalProperties":false,"type":"object","required":["device_id","account_id","tenant_id"],"title":"DeviceRecord"},"DeviceStatus":{"type":"string","enum":["active","revoked"],"title":"DeviceStatus"},"ErasureKind":{"type":"string","enum":["export","delete"],"title":"ErasureKind"},"ErasureReceipt":{"properties":{"request_id":{"type":"string","pattern":"^req_[A-Za-z0-9\\-]{6,64}$","title":"Request Id"},"subject_account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Subject Account Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"kind":{"$ref":"#/components/schemas/ErasureKind"},"engine_ref":{"type":"string","pattern":"^w6_[A-Za-z0-9\\-]{6,64}$","title":"Engine Ref"},"executed_at":{"type":"string","format":"date-time","title":"Executed At"}},"additionalProperties":false,"type":"object","required":["request_id","subject_account_id","tenant_id","kind","engine_ref"],"title":"ErasureReceipt","description":"Proof the injected W6 engine executed (one engine, two doors). `engine_ref`\nis the engine's own run id — SB records it, never performs the deletion."},"Feedback":{"properties":{"feedback_id":{"type":"string","pattern":"^fbk_[A-Za-z0-9\\-]{6,64}$","title":"Feedback Id"},"account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Account Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"rating":{"type":"integer","maximum":5.0,"minimum":1.0,"title":"Rating"},"text":{"type":"string","maxLength":2000,"minLength":1,"title":"Text"},"analytics_topic":{"type":"string","pattern":"^[a-z][a-z0-9_.]{2,64}$","title":"Analytics Topic"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"additionalProperties":false,"type":"object","required":["feedback_id","account_id","tenant_id","rating","text","analytics_topic"],"title":"Feedback","description":"User feedback (SB Part 8: feedback endpoint feeding W3 analytics). The\n`analytics_topic` is the W3-analytics-bound field."},"GuardianConsentRequest":{"properties":{"consent_request_id":{"type":"string","pattern":"^gcr_[A-Za-z0-9\\-]{6,64}$","title":"Consent Request Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"learner_account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Learner Account Id"},"guardian_email":{"type":"string","pattern":"^[^@\\s]{1,64}@[^@\\s]{1,255}\\.[^@\\s]{2,24}$","title":"Guardian Email"},"scope":{"type":"string","pattern":"^[a-z][a-z0-9_.]{2,64}$","title":"Scope"},"text_version":{"type":"string","pattern":"^[A-Za-z0-9_.\\-]{1,32}$","title":"Text Version"},"token_hash":{"type":"string","pattern":"^[a-f0-9]{64}$","title":"Token Hash"},"status":{"$ref":"#/components/schemas/GuardianConsentStatus","default":"pending"},"requested_at":{"type":"string","format":"date-time","title":"Requested At"},"resolved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Resolved At"}},"additionalProperties":false,"type":"object","required":["consent_request_id","tenant_id","learner_account_id","guardian_email","scope","text_version","token_hash"],"title":"GuardianConsentRequest","description":"A single-use, expiring, signed guardian-consent link (D-037; SB Part 3),\nclassification learner_personal (migration 0014). A guardian clicks the\nlink; the click is verified SERVER-SIDE and calls the existing\nConsentDirectory.record_consent (=> an append-only consent_evidence GRANT —\nexisting type, never mutated). The RAW token is NEVER persisted or logged:\nonly `token_hash` (a sha256 hex digest) exists on this shape, so a raw token\ncannot round-trip the contract. `guardian_email` is learner_personal PII.\nSB DATA read by G-10's ConsentPort — never model-readable, no memory write\n(Boundary Law B-8)."},"GuardianConsentStatus":{"type":"string","enum":["pending","granted","expired","revoked"],"title":"GuardianConsentStatus","description":"Lifecycle of a guardian-consent verification link (D-037). The link is\nsingle-use + expiring; only a SERVER-verified click transitions to GRANTED\n(which then records an append-only consent_evidence GRANT via the existing\nConsentDirectory). Unknown/lapsed => never a grant (fail-closed)."},"GuardianLink":{"properties":{"link_id":{"type":"string","pattern":"^lnk_[A-Za-z0-9\\-]{6,64}$","title":"Link Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"guardian_account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Guardian Account Id"},"learner_account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Learner Account Id"},"relation":{"$ref":"#/components/schemas/GuardianRelation","default":"parent"},"learner_age_band":{"$ref":"#/components/schemas/AgeBand"},"parent_operated":{"type":"boolean","title":"Parent Operated","default":false},"consent_active":{"type":"boolean","title":"Consent Active","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"additionalProperties":false,"type":"object","required":["link_id","tenant_id","guardian_account_id","learner_account_id","learner_age_band"],"title":"GuardianLink","description":"Parent<->child linkage (FE F-4); Kids 0-4 are parent_operated."},"GuardianLinkRequest":{"properties":{"learner_account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Learner Account Id"},"learner_age_band":{"$ref":"#/components/schemas/AgeBand"},"relation":{"$ref":"#/components/schemas/GuardianRelation","default":"parent"},"tenant_id":{"anyOf":[{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$"},{"type":"null"}],"title":"Tenant Id"}},"additionalProperties":false,"type":"object","required":["learner_account_id","learner_age_band"],"title":"GuardianLinkRequest"},"GuardianRelation":{"type":"string","enum":["parent","guardian"],"title":"GuardianRelation"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthStatus":{"type":"string","enum":["ok","degraded","down"],"title":"HealthStatus"},"ImpersonationAccessRequest":{"properties":{"grant_id":{"type":"string","pattern":"^imp_[A-Za-z0-9\\-]{6,64}$","title":"Grant Id"},"action":{"type":"string","maxLength":120,"minLength":1,"title":"Action"}},"additionalProperties":false,"type":"object","required":["grant_id","action"],"title":"ImpersonationAccessRequest","description":"Router body for an impersonated access: the persisted grant's ID plus the\nconcrete action. The service LOADS the server-held grant and validates the\nseal, expiry, and write-approval against IT — the client passes NO grant\nfields, so a single admin cannot forge approval/expiry/class (B-7)."},"ImpersonationActivity":{"properties":{"activity_id":{"type":"string","pattern":"^ima_[A-Za-z0-9\\-]{6,64}$","title":"Activity Id"},"subject_account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Subject Account Id"},"admin_actor_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Admin Actor Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"grant_id":{"type":"string","pattern":"^imp_[A-Za-z0-9\\-]{6,64}$","title":"Grant Id"},"action":{"type":"string","maxLength":120,"minLength":1,"title":"Action"},"occurred_at":{"type":"string","format":"date-time","title":"Occurred At"}},"additionalProperties":false,"type":"object","required":["activity_id","subject_account_id","admin_actor_id","tenant_id","grant_id","action"],"title":"ImpersonationActivity","description":"The LEARNER-VISIBLE record written on EVERY impersonated access (B-7):\nthe learner can read who touched their account, when, and doing what."},"ImpersonationApprovalRequest":{"properties":{"grant_id":{"type":"string","pattern":"^imp_[A-Za-z0-9\\-]{6,64}$","title":"Grant Id"}},"additionalProperties":false,"type":"object","required":["grant_id"],"title":"ImpersonationApprovalRequest","description":"Approve a persisted grant BY ID — the approver is the authenticated actor\n(server-side), never a body field. A WRITE grant needs a DISTINCT second\nadmin; the service refuses same-admin approval."},"ImpersonationGrant":{"properties":{"grant_id":{"type":"string","pattern":"^imp_[A-Za-z0-9\\-]{6,64}$","title":"Grant Id"},"admin_actor_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Admin Actor Id"},"subject_account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Subject Account Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"mode":{"$ref":"#/components/schemas/ImpersonationMode","default":"read_only"},"subject_classification":{"type":"string","title":"Subject Classification","default":"learner_personal"},"reason":{"type":"string","maxLength":500,"minLength":3,"title":"Reason"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"approved_by":{"anyOf":[{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$"},{"type":"null"}],"title":"Approved By"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"additionalProperties":false,"type":"object","required":["grant_id","admin_actor_id","subject_account_id","tenant_id","reason","expires_at"],"title":"ImpersonationGrant","description":"A time-boxed impersonation grant (B-7). A WRITE grant is INERT until\n`approved_by` is a DIFFERENT admin than `admin_actor_id` (the service is the\nenforcer). `subject_classification` names the data class the grant would\ntouch — a sealed class (reformation/crisis/creation) is refused by the\nservice at grant AND at access."},"ImpersonationGrantRequest":{"properties":{"subject_account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Subject Account Id"},"mode":{"$ref":"#/components/schemas/ImpersonationMode","default":"read_only"},"reason":{"type":"string","maxLength":500,"minLength":3,"title":"Reason"}},"additionalProperties":false,"type":"object","required":["subject_account_id","reason"],"title":"ImpersonationGrantRequest","description":"Client-supplied portion of an impersonation grant (B-7). The client names\nWHO to impersonate, the MODE (read-only default), and WHY. The SERVER sets\ngrant_id, admin_actor_id (the authenticated actor), tenant_id, expires_at\n(a config-driven TTL), subject_classification (DERIVED from the subject\naccount), and approved_by (None) — NONE of those are read from the request\n(forge-proof; security-audit 2026-07-12)."},"ImpersonationMode":{"type":"string","enum":["read_only","write"],"title":"ImpersonationMode","description":"B-7: read-only is the DEFAULT; write requires a second-admin approval."},"IssueConsentLinkBody":{"properties":{"guardian_email":{"type":"string","pattern":"^[^@\\s]{1,64}@[^@\\s]{1,255}\\.[^@\\s]{2,24}$","title":"Guardian Email"},"scope":{"type":"string","pattern":"^[a-z][a-z0-9_.]{2,64}$","title":"Scope"},"text_version":{"type":"string","pattern":"^[A-Za-z0-9_.\\-]{1,32}$","title":"Text Version"},"tenant_id":{"anyOf":[{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$"},{"type":"null"}],"title":"Tenant Id"},"locale":{"type":"string","pattern":"^[a-z]{2}(?:-[A-Z]{2})?$","title":"Locale","default":"en"}},"additionalProperties":false,"type":"object","required":["guardian_email","scope","text_version"],"title":"IssueConsentLinkBody","description":"A minor requesting a guardian-consent link to their own account."},"LearnerAgeRecord":{"properties":{"account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Account Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"date_of_birth":{"type":"string","format":"date","title":"Date Of Birth"},"age_band":{"$ref":"#/components/schemas/AgeBand"},"is_minor":{"type":"boolean","title":"Is Minor"},"recorded_at":{"type":"string","format":"date-time","title":"Recorded At"}},"additionalProperties":false,"type":"object","required":["account_id","tenant_id","date_of_birth","age_band","is_minor"],"title":"LearnerAgeRecord","description":"DOB captured at signup (D-037; SB Part 3), classification\nlearner_personal (migration 0013 `learner_age`). `age_band` and `is_minor`\nare SERVER-DERIVED identity FACTS from `date_of_birth` — factual attributes,\nNEVER a hidden-state claim and NEVER client-asserted. `is_minor` is the\nserver's determination AT REQUEST TIME (DOB implies age < 18 => True): the\nserving edge / G-10 ConsentPort recompute it from `date_of_birth`, which is\nthe durable source of truth (0013 stores DOB + band; `is_minor` is derived,\nnot a stored column). DOB is minimisable at the DB layer — see RF-3."},"LivenessReport":{"properties":{"status":{"$ref":"#/components/schemas/HealthStatus","default":"ok"},"checked_at":{"type":"string","format":"date-time","title":"Checked At"}},"additionalProperties":false,"type":"object","title":"LivenessReport","description":"Process-only liveness (SB Part 7: dependency health is NOT here)."},"LoginRequest":{"properties":{"email":{"type":"string","pattern":"^[^@\\s]{1,64}@[^@\\s]{1,255}\\.[^@\\s]{2,24}$","title":"Email"},"password":{"type":"string","maxLength":256,"minLength":1,"title":"Password"},"tenant_id":{"anyOf":[{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$"},{"type":"null"}],"title":"Tenant Id"},"device_label":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Device Label"},"method":{"$ref":"#/components/schemas/AuthMethod","default":"password"},"mfa_code":{"anyOf":[{"type":"string","pattern":"^[0-9]{6,8}$"},{"type":"null"}],"title":"Mfa Code"}},"additionalProperties":false,"type":"object","required":["email","password"],"title":"LoginRequest"},"LoginResult":{"properties":{"account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Account Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"mfa_required":{"type":"boolean","title":"Mfa Required","default":false},"tokens":{"anyOf":[{"$ref":"#/components/schemas/TokenPair"},{"type":"null"}]}},"additionalProperties":false,"type":"object","required":["account_id","tenant_id"],"title":"LoginResult","description":"MFA still required (no tokens) OR tokens present (SB Part 3)."},"MfaConfirmRequest":{"properties":{"code":{"type":"string","pattern":"^[0-9]{6,8}$","title":"Code"}},"additionalProperties":false,"type":"object","required":["code"],"title":"MfaConfirmRequest"},"MfaEnrollment":{"properties":{"enrollment_id":{"type":"string","pattern":"^mfa_[A-Za-z0-9\\-]{6,64}$","title":"Enrollment Id"},"account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Account Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"method":{"$ref":"#/components/schemas/MfaMethod","default":"totp"},"verified":{"type":"boolean","title":"Verified","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"additionalProperties":false,"type":"object","required":["enrollment_id","account_id","tenant_id"],"title":"MfaEnrollment","description":"Persisted enrolment — NO secret field (secret lives server-side)."},"MfaMethod":{"type":"string","enum":["totp"],"title":"MfaMethod"},"MfaProvision":{"properties":{"secret":{"type":"string","minLength":16,"title":"Secret"},"otpauth_uri":{"type":"string","minLength":1,"title":"Otpauth Uri"}},"additionalProperties":false,"type":"object","required":["secret","otpauth_uri"],"title":"MfaProvision","description":"Returned ONCE at enrolment start (never persisted on the wire model)."},"ModerationStatus":{"type":"string","enum":["open","escalated","closed"],"title":"ModerationStatus"},"Money":{"properties":{"amount_minor":{"type":"integer","minimum":0.0,"title":"Amount Minor"},"currency":{"type":"string","pattern":"^[A-Z]{3}$","title":"Currency","default":"USD"}},"additionalProperties":false,"type":"object","required":["amount_minor"],"title":"Money","description":"Integer minor units ONLY (SB Part 4 money invariant). `amount_minor`\nis StrictInt, so a float amount cannot even be constructed."},"OrganizationSignupRequest":{"properties":{"organization_name":{"type":"string","maxLength":120,"minLength":1,"title":"Organization Name"},"email":{"type":"string","pattern":"^[^@\\s]{1,64}@[^@\\s]{1,255}\\.[^@\\s]{2,24}$","title":"Email"},"password":{"type":"string","maxLength":256,"minLength":1,"title":"Password"}},"additionalProperties":false,"type":"object","required":["organization_name","email","password"],"title":"OrganizationSignupRequest","description":"The public organisation-registration door's wire input (spec §①C).\n\nA caller states its organisation, its address and its credential — and\nNOTHING the server decides. `tenant_id`, `role_profiles`, `age_band`,\n`date_of_birth` and any invite/admin flag are DELIBERATELY ABSENT\n(SEC-A/1,/2): each was a real escalation path on the personal signup door,\nand an absent field cannot be honoured, silently dropped, or forgotten\nabout in a later refactor. `organization_name` reuses TenantCreate's\nconstraint because an organisation IS a tenant. `password` is the\ncredential and is never persisted on the account row — it reaches only the\nidentity provisioner. The response is the EXISTING `AccountRecord`."},"PageInfo":{"properties":{"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"},"limit":{"type":"integer","maximum":500.0,"minimum":1.0,"title":"Limit"}},"additionalProperties":false,"type":"object","required":["limit"],"title":"PageInfo","description":"Cursor pagination metadata (SB Part 2 conventions)."},"PaymentAuditEntry":{"properties":{"entry_id":{"type":"string","pattern":"^pay_[A-Za-z0-9\\-]{6,64}$","title":"Entry Id"},"account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Account Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"kind":{"$ref":"#/components/schemas/PaymentAuditKind"},"amount":{"$ref":"#/components/schemas/Money"},"reason":{"anyOf":[{"$ref":"#/components/schemas/RefundReason"},{"type":"null"}]},"event_id":{"anyOf":[{"type":"string","pattern":"^evt_[A-Za-z0-9\\-]{6,64}$"},{"type":"null"}],"title":"Event Id"},"actor":{"type":"string","maxLength":64,"minLength":1,"title":"Actor"},"request_id":{"type":"string","pattern":"^req_[A-Za-z0-9\\-]{6,64}$","title":"Request Id"},"occurred_at":{"type":"string","format":"date-time","title":"Occurred At"}},"additionalProperties":false,"type":"object","required":["entry_id","account_id","tenant_id","kind","amount","actor","request_id"],"title":"PaymentAuditEntry","description":"Append-only money audit (SB Part 4): who / what / when / amount /\nrequest_id. Never mutated — history is the audit surface."},"PaymentAuditKind":{"type":"string","enum":["charge","refund","adjustment"],"title":"PaymentAuditKind"},"PrincipalView":{"properties":{"account_id":{"type":"string","title":"Account Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"roles":{"items":{"type":"string"},"type":"array","title":"Roles","default":[]},"age_band":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Age Band"},"mfa_authenticated":{"type":"boolean","title":"Mfa Authenticated","default":false},"linked_learner_ids":{"items":{"type":"string"},"type":"array","title":"Linked Learner Ids","default":[]},"consent_scopes":{"items":{"type":"string"},"type":"array","title":"Consent Scopes","default":[]},"entitlements":{"items":{"type":"string"},"type":"array","title":"Entitlements","default":[]}},"additionalProperties":false,"type":"object","required":["account_id","tenant_id"],"title":"PrincipalView","description":"Authenticated-actor introspection (PROVISIONAL route-local wire shape).\nMirrors the resolved sb.authz.Actor — identity + coarse RBAC + ABAC context.\nCarries no secret and no reformation state (B-8)."},"ReadinessReport":{"properties":{"ready":{"type":"boolean","title":"Ready"},"dependencies":{"additionalProperties":{"$ref":"#/components/schemas/HealthStatus"},"type":"object","title":"Dependencies"},"checked_at":{"type":"string","format":"date-time","title":"Checked At"}},"additionalProperties":false,"type":"object","required":["ready"],"title":"ReadinessReport","description":"Readiness carries dependency health (SB Part 7: dependency health in\nreadiness ONLY). `ready` is False if any probed dependency is down."},"RedeemConsentBody":{"properties":{"token":{"type":"string","maxLength":512,"minLength":1,"title":"Token"}},"additionalProperties":false,"type":"object","required":["token"],"title":"RedeemConsentBody","description":"The guardian's single-use signed token (the credential for this route)."},"RefreshRequest":{"properties":{"refresh_token":{"type":"string","minLength":1,"title":"Refresh Token"}},"additionalProperties":false,"type":"object","required":["refresh_token"],"title":"RefreshRequest"},"RefundReason":{"type":"string","enum":["requested_by_customer","duplicate","fraudulent","service_issue","goodwill"],"title":"RefundReason","description":"Refunds ride the pipeline WITH a reason code (SB Part 4)."},"RefundRequest":{"properties":{"subscription_id":{"type":"string","pattern":"^sub_[A-Za-z0-9\\-]{6,64}$","title":"Subscription Id"},"account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Account Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"amount":{"$ref":"#/components/schemas/Money"},"reason":{"$ref":"#/components/schemas/RefundReason"},"request_id":{"type":"string","pattern":"^req_[A-Za-z0-9\\-]{6,64}$","title":"Request Id"}},"additionalProperties":false,"type":"object","required":["subscription_id","account_id","tenant_id","amount","reason","request_id"],"title":"RefundRequest","description":"Strict input for the refund SERVICE function (no UI, SB Part 4)."},"RoleProfile":{"type":"string","enum":["learner","guardian","mentor","admin","organization"],"title":"RoleProfile","description":"SB Part 3 — one accounts identity + typed role profiles (DATA, never\ncode forks)."},"SessionRecord":{"properties":{"session_id":{"type":"string","pattern":"^ses_[A-Za-z0-9\\-]{6,64}$","title":"Session Id"},"family_id":{"type":"string","pattern":"^ses_[A-Za-z0-9\\-]{6,64}$","title":"Family Id"},"account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Account Id"},"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"device_id":{"anyOf":[{"type":"string","pattern":"^dev_[A-Za-z0-9\\-]{6,64}$"},{"type":"null"}],"title":"Device Id"},"status":{"$ref":"#/components/schemas/SessionStatus","default":"active"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"additionalProperties":false,"type":"object","required":["session_id","family_id","account_id","tenant_id"],"title":"SessionRecord"},"SessionStatus":{"type":"string","enum":["active","revoked"],"title":"SessionStatus"},"SignedUploadTicket":{"properties":{"object_key":{"type":"string","pattern":"^[a-z0-9][a-z0-9/_.\\-]{3,200}$","title":"Object Key"},"bucket":{"type":"string","pattern":"^tarbia-[a-z_]{3,40}$","title":"Bucket"},"upload_url":{"type":"string","maxLength":2048,"minLength":1,"title":"Upload Url"},"method":{"type":"string","const":"PUT","title":"Method","default":"PUT"},"max_bytes":{"type":"integer","minimum":1.0,"title":"Max Bytes"},"trust_level":{"$ref":"#/components/schemas/TrustLevel","default":"untrusted"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"}},"additionalProperties":false,"type":"object","required":["object_key","bucket","upload_url","max_bytes","expires_at"],"title":"SignedUploadTicket","description":"The ONLY way bytes reach storage: a time-boxed signed PUT URL into the\nper-class bucket. `max_bytes` bounds the direct upload; `trust_level` is\nstamped onto the object once uploaded."},"SignupBody":{"properties":{"email":{"type":"string","pattern":"^[^@\\s]{1,64}@[^@\\s]{1,255}\\.[^@\\s]{2,24}$","title":"Email"},"password":{"type":"string","maxLength":256,"minLength":1,"title":"Password"},"tenant_id":{"anyOf":[{"type":"string","pattern":"^tnt_[A-Za-z0-9]{6,64}$"},{"type":"null"}],"title":"Tenant Id"}},"additionalProperties":false,"type":"object","required":["email","password"],"title":"SignupBody","description":"Public registration request (PROVISIONAL route-local wire shape). `password`\nis the credential and is never persisted on the account row — it reaches only\nthe identity provisioner.\n\nSEC-A (security audit 2026-08-02): the ONLY fields an unauthenticated caller\nmay state are its email, its credential, and — optionally — the default\ntenant it already belongs to. Role profiles, tenant creation and the age\nband are server truths:\n  * `age_band` was stamped into the identity provider's app_metadata and read\n    back as the session band, so a minor could self-declare an adult band and\n    the P5 minors gate never fired. The band now derives ONLY from the\n    durable learner_age record written by POST /v1/age-records.\n  * `role_profiles` let an anonymous caller mint an admin/organization account.\n  * `tenant_name` created a brand-new tenant per anonymous request.\n`extra=\"forbid\"` makes each of them a typed 422 rather than a silent drop\n(SB Part 2: unknown fields rejected on governed endpoints)."},"SubmitDobBody":{"properties":{"date_of_birth":{"type":"string","format":"date","title":"Date Of Birth"},"tenant_id":{"anyOf":[{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$"},{"type":"null"}],"title":"Tenant Id"}},"additionalProperties":false,"type":"object","required":["date_of_birth"],"title":"SubmitDobBody","description":"DOB captured at signup for the AUTHENTICATED account (the server derives\nthe AgeBand + is_minor fact — the client never self-classifies minor status)."},"TenantAdminGrant":{"properties":{"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Account Id"},"granted_at":{"type":"string","format":"date-time","title":"Granted At"}},"additionalProperties":false,"type":"object","required":["tenant_id","account_id"],"title":"TenantAdminGrant"},"TenantAdminRequest":{"properties":{"account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Account Id"}},"additionalProperties":false,"type":"object","required":["account_id"],"title":"TenantAdminRequest"},"TenantBranding":{"properties":{"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"tokens":{"additionalProperties":{"type":"string"},"type":"object","title":"Tokens"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"additionalProperties":false,"type":"object","required":["tenant_id"],"title":"TenantBranding","description":"Tenant branding tokens WITHIN the locked design system — store only\n(keys validated against sb/tenancy.py's allowlist; SB Part 3)."},"TenantBrandingRequest":{"properties":{"tokens":{"additionalProperties":{"type":"string"},"type":"object","title":"Tokens"}},"additionalProperties":false,"type":"object","title":"TenantBrandingRequest"},"TenantCreate":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"}},"additionalProperties":false,"type":"object","required":["name"],"title":"TenantCreate"},"TenantDataPolicy":{"properties":{"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"data_residency":{"type":"string","title":"Data Residency","default":"unspecified"},"retention_profile":{"type":"string","title":"Retention Profile","default":"default"},"minors_require_parental_consent":{"type":"boolean","title":"Minors Require Parental Consent","default":true},"rows":{"additionalProperties":{"type":"string"},"type":"object","title":"Rows"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"additionalProperties":false,"type":"object","required":["tenant_id"],"title":"TenantDataPolicy","description":"Tenant data-policy rows — fed to G-10 as DATA (SB Part 3)."},"TenantDataPolicyRequest":{"properties":{"data_residency":{"type":"string","title":"Data Residency","default":"unspecified"},"retention_profile":{"type":"string","title":"Retention Profile","default":"default"},"minors_require_parental_consent":{"type":"boolean","title":"Minors Require Parental Consent","default":true},"rows":{"additionalProperties":{"type":"string"},"type":"object","title":"Rows"}},"additionalProperties":false,"type":"object","title":"TenantDataPolicyRequest"},"TenantPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/TenantRecord"},"type":"array","title":"Items"},"page":{"$ref":"#/components/schemas/PageInfo"}},"additionalProperties":false,"type":"object","required":["items","page"],"title":"TenantPage"},"TenantRecord":{"properties":{"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"status":{"$ref":"#/components/schemas/TenantStatus","default":"active"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"additionalProperties":false,"type":"object","required":["tenant_id","name"],"title":"TenantRecord"},"TenantStatus":{"type":"string","enum":["active","suspended"],"title":"TenantStatus"},"TokenPair":{"properties":{"access_token":{"type":"string","minLength":1,"title":"Access Token"},"refresh_token":{"type":"string","minLength":1,"title":"Refresh Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"expires_in":{"type":"integer","minimum":1.0,"title":"Expires In"}},"additionalProperties":false,"type":"object","required":["access_token","refresh_token","expires_in"],"title":"TokenPair","description":"Short-lived access + rotating refresh (SB Part 3); opaque to clients."},"TrustLevel":{"type":"string","enum":["trusted","untrusted"],"title":"TrustLevel","description":"SB Part 5 — every stored object carries a trust level. User uploads are\nUNTRUSTED input processed sandboxed; content bound for a MAS path must clear\nthe MAS injection defenses (this flag is the seam they key on)."},"UploadIntent":{"properties":{"tenant_id":{"type":"string","pattern":"^tnt_[A-Za-z0-9\\-]{6,64}$","title":"Tenant Id"},"account_id":{"type":"string","pattern":"^acc_[A-Za-z0-9\\-]{6,64}$","title":"Account Id"},"filename":{"type":"string","maxLength":255,"minLength":1,"title":"Filename"},"content_type":{"type":"string","pattern":"^[a-z]+/[a-z0-9.+\\-]{1,80}$","title":"Content Type"},"size_bytes":{"type":"integer","minimum":1.0,"title":"Size Bytes"},"classification":{"$ref":"#/components/schemas/DataClassification","default":"learner_personal"},"subject_type":{"anyOf":[{"type":"string","pattern":"^[a-z][a-z0-9_]{2,40}$"},{"type":"null"}],"title":"Subject Type"},"subject_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subject Id"}},"additionalProperties":false,"type":"object","required":["tenant_id","account_id","filename","content_type","size_bytes"],"title":"UploadIntent","description":"The upload REQUEST — metadata ONLY. There is deliberately no bytes field:\nthe API process never receives file content; the response is a signed URL the\nclient PUTs to directly (SB Part 5, signed-URL uploads only)."},"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"}}}}