{"openapi":"3.1.0","info":{"title":"aggre-api","description":"","license":{"name":"Apache-2.0","identifier":"Apache-2.0"},"version":"0.1.0"},"paths":{"/health":{"get":{"tags":["system"],"operationId":"health","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/ready":{"get":{"tags":["system"],"operationId":"ready","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadyResponse"}}}},"503":{"description":"A dependency the API needs in order to serve is unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadyResponse"}}}}}}},"/v1/admin/orgs":{"get":{"tags":["admin"],"operationId":"admin_list_orgs","parameters":[{"name":"q","in":"query","description":"Matches slug, name or a member's email (case-insensitive)","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Page size, 1-200 (default 50)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"offset","in":"query","description":"Page offset","required":false,"schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOrgList"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/admin/orgs/{id}":{"get":{"tags":["admin"],"operationId":"admin_get_org","parameters":[{"name":"id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOrgDetail"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["admin"],"operationId":"admin_update_org","parameters":[{"name":"id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUpdateOrgRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/admin/orgs/{id}/members":{"post":{"tags":["admin"],"operationId":"admin_add_org_member","parameters":[{"name":"id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAddMemberRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminMember"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/admin/status":{"get":{"tags":["admin"],"operationId":"admin_status","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminStatusResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/admin/users":{"get":{"tags":["admin"],"operationId":"admin_list_users","parameters":[{"name":"q","in":"query","description":"Matches email or name (case-insensitive)","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Page size, 1-200 (default 50)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"offset","in":"query","description":"Page offset","required":false,"schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUserList"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/api-keys":{"get":{"tags":["auth"],"operationId":"list_api_keys","parameters":[{"name":"org_id","in":"query","description":"Filter to one organization (staff may name any)","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["auth"],"operationId":"create_api_key","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreated"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/api-keys/{id}/revoke":{"post":{"tags":["auth"],"operationId":"revoke_api_key","parameters":[{"name":"id","in":"path","description":"API key ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKey"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/audit-logs":{"get":{"tags":["admin"],"operationId":"list_audit_logs","parameters":[{"name":"limit","in":"query","description":"Page size, 1-500","required":false,"schema":{"type":"integer","format":"int32","minimum":0}},{"name":"offset","in":"query","description":"Page offset","required":false,"schema":{"type":"integer","format":"int32","minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedAuditLog"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/billing/credits":{"post":{"tags":["billing"],"operationId":"create_credit_entry","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCreditRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditLedgerEntry"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/billing/invoices":{"post":{"tags":["billing"],"operationId":"create_invoice","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInvoiceRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceRecord"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/billing/stripe/webhook":{"post":{"tags":["billing"],"operationId":"stripe_webhook","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeWebhookRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeWebhookResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/billing/subscription":{"post":{"tags":["billing"],"operationId":"upsert_billing_subscription","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertSubscriptionRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingSubscription"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/billing/summary":{"get":{"tags":["billing"],"operationId":"billing_summary","parameters":[{"name":"org_id","in":"query","description":"Staff only: another organization's summary","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingSummary"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/catalog":{"get":{"tags":["catalog"],"operationId":"get_catalog","parameters":[{"name":"org_id","in":"query","description":"Staff only: another organization's view","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/catalog/selections":{"post":{"tags":["catalog"],"operationId":"select_catalog_dataset","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelectCatalogDatasetRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgDatasetSelection"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/catalog/selections/{dataset_id}":{"delete":{"tags":["catalog"],"operationId":"deselect_catalog_dataset","parameters":[{"name":"dataset_id","in":"path","description":"Dataset ID","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"org_id","in":"query","description":"Staff only: another organization","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Removed (or was not selected)"},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/categories":{"get":{"tags":["categories"],"operationId":"list_categories","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedCategory"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["categories"],"operationId":"create_category","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCategoryRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/categories/{id}":{"get":{"tags":["categories"],"operationId":"get_category","parameters":[{"name":"id","in":"path","description":"Category ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["categories"],"operationId":"delete_category","parameters":[{"name":"id","in":"path","description":"Category ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Deleted (along with any sub-categories)"},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["categories"],"operationId":"update_category","parameters":[{"name":"id","in":"path","description":"Category ID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCategoryRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/categories/{id}/datasets":{"get":{"tags":["categories"],"operationId":"list_category_datasets","parameters":[{"name":"id","in":"path","description":"Category ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedDataset"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["categories"],"operationId":"add_category_dataset","parameters":[{"name":"id","in":"path","description":"Category ID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddCategoryDatasetRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryDataset"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/categories/{id}/datasets/{dataset_id}":{"delete":{"tags":["categories"],"operationId":"remove_category_dataset","parameters":[{"name":"id","in":"path","description":"Category ID","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"dataset_id","in":"path","description":"Dataset ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Removed"},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/datasets":{"get":{"tags":["datasets"],"operationId":"list_datasets","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedDataset"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["datasets"],"operationId":"create_dataset","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDatasetRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dataset"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/datasets/stats":{"get":{"tags":["datasets"],"operationId":"get_customer_dataset_stats","responses":{"200":{"description":"Per-dataset record counts and corpus distribution, limited to datasets this caller can read"},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/datasets/{id}":{"get":{"tags":["datasets"],"operationId":"get_dataset","parameters":[{"name":"id","in":"path","description":"Dataset ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dataset"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["datasets"],"operationId":"update_dataset","parameters":[{"name":"id","in":"path","description":"Dataset ID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDatasetRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dataset"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/datasets/{id}/records":{"get":{"tags":["datasets"],"operationId":"list_records","parameters":[{"name":"id","in":"path","description":"Dataset ID","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","description":"Page size, 1-500 (omit both limit and offset for the full dump)","required":false,"schema":{"type":"integer","format":"int32","minimum":0}},{"name":"offset","in":"query","description":"Page offset","required":false,"schema":{"type":"integer","format":"int32","minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedRecord"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/datasets/{id}/records/count":{"get":{"tags":["datasets"],"operationId":"count_records","parameters":[{"name":"id","in":"path","description":"Dataset ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordCountResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/datasets/{id}/republish":{"post":{"tags":["datasets"],"operationId":"republish_dataset","parameters":[{"name":"id","in":"path","description":"Dataset ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RepublishResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/datasets/{id}/versions":{"get":{"tags":["datasets"],"operationId":"list_dataset_versions","parameters":[{"name":"id","in":"path","description":"Dataset ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedDatasetVersion"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/error-logs":{"get":{"tags":["jobs"],"operationId":"list_error_logs","parameters":[{"name":"job_id","in":"query","description":"Optional job filter","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"source_id","in":"query","description":"Optional source filter","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"dataset_id","in":"query","description":"Optional dataset filter","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PipelineErrorLog"}}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/export":{"post":{"tags":["search"],"operationId":"export_records","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/jobs":{"get":{"tags":["jobs"],"operationId":"list_jobs","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Job"}}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["jobs"],"operationId":"create_job","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateJobRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/jobs/{id}":{"get":{"tags":["jobs"],"operationId":"get_job","parameters":[{"name":"id","in":"path","description":"Job ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/jobs/{id}/claim":{"post":{"tags":["jobs"],"operationId":"claim_job","parameters":[{"name":"id","in":"path","description":"Job ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/jobs/{id}/run":{"post":{"tags":["jobs"],"summary":"Fetching + ingesting can take far longer than a proxy's request timeout\nonce a source has tens of thousands of records (each paginated fetch is\none round trip, and a big enough batch of records is still real work to\nvalidate and write). Doing that inline in the HTTP handler meant a slow\nrun got its connection killed by the reverse proxy mid-flight, which\nsilently dropped the in-flight future -- the job was left stuck at\n\"running\" forever, while whatever had already been written stayed in the\ndataset. So run_job only starts the job and returns immediately; the\nactual work happens in a spawned task, and callers poll GET\n/v1/jobs/{id} for the terminal status.","operationId":"run_job","parameters":[{"name":"id","in":"path","description":"Job ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Job is now running; poll GET /v1/jobs/{id} for completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/legal-api/judicial-credentials":{"get":{"tags":["admin"],"summary":"legal-api runs on an internal-only address (not reachable from the browser),\nso the admin console goes through this proxy rather than calling it directly.","operationId":"get_legal_api_judicial_credentials","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JudicialCredentialsStatus"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"tags":["admin"],"operationId":"put_legal_api_judicial_credentials","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetJudicialCredentialsRequest"}}},"required":true},"responses":{"204":{"description":"Stored"},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["admin"],"operationId":"delete_legal_api_judicial_credentials","responses":{"204":{"description":"Cleared"},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/legal-api/twelvedata-key":{"get":{"tags":["admin"],"summary":"Proxy to legal-api's Twelve Data API key setting (global-equities provider),\nmirroring the judicial-credentials proxy above -- legal-api is internal-only.","operationId":"get_legal_api_twelvedata_key","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TwelveDataKeyStatus"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"tags":["admin"],"operationId":"put_legal_api_twelvedata_key","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetTwelveDataKeyRequest"}}},"required":true},"responses":{"204":{"description":"Stored"},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["admin"],"operationId":"delete_legal_api_twelvedata_key","responses":{"204":{"description":"Cleared"},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/mcp/call":{"post":{"tags":["mcp"],"operationId":"mcp_call","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpCallRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpCallResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/mcp/tools":{"get":{"tags":["mcp"],"operationId":"list_mcp_tools","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpToolResponse"}}}}}}},"/v1/orgs":{"get":{"tags":["admin"],"operationId":"list_organizations","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Organization"}}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["admin"],"operationId":"create_organization","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrganizationRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/orgs/{id}/members":{"get":{"tags":["admin"],"operationId":"list_organization_members","parameters":[{"name":"id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OrganizationMember"}}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["admin"],"operationId":"add_organization_member","parameters":[{"name":"id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddOrganizationMemberRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationMember"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/raw-archives":{"get":{"tags":["raw-archives"],"operationId":"list_raw_archives","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedRawArchive"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/records/{id}":{"get":{"tags":["search"],"operationId":"get_record","parameters":[{"name":"id","in":"path","description":"Record ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/search":{"post":{"tags":["search"],"operationId":"search","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResponse"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/sources":{"get":{"tags":["sources"],"operationId":"list_sources","parameters":[{"name":"dataset_id","in":"query","description":"Optional dataset filter","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedSource"}}}},"500":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["sources"],"operationId":"create_source","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSourceRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Source"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/sources/{id}":{"get":{"tags":["sources"],"operationId":"get_source","parameters":[{"name":"id","in":"path","description":"Source ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Source"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["sources"],"operationId":"update_source","parameters":[{"name":"id","in":"path","description":"Source ID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSourceRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Source"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/sources/{id}/enqueue":{"post":{"tags":["sources"],"operationId":"enqueue_source","parameters":[{"name":"id","in":"path","description":"Source ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/sources/{id}/ingest":{"post":{"tags":["sources"],"operationId":"ingest_source","parameters":[{"name":"id","in":"path","description":"Source ID","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/sources/{id}/preview":{"post":{"tags":["sources"],"operationId":"preview_source","parameters":[{"name":"id","in":"path","description":"Source ID","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","description":"Preview record limit, capped at 50","required":false,"schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourcePreviewResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/sources/{id}/run":{"post":{"tags":["sources"],"summary":"Same fire-and-poll shape as run_job (see the comment there) -- a source\nwith a large enough backlog can take longer to fetch and ingest than a\nproxy's request timeout allows, so this starts the job and returns\nimmediately rather than blocking the response on the whole run.","operationId":"run_source","parameters":[{"name":"id","in":"path","description":"Source ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Job is now running; poll GET /v1/jobs/{id} for completion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/subscriptions":{"get":{"tags":["subscriptions"],"operationId":"list_subscriptions","parameters":[{"name":"org_id","in":"query","description":"Filter to one organization's subscriptions","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Subscription"}}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["subscriptions"],"operationId":"create_subscription","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSubscriptionRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/subscriptions/{org_id}/{category_id}":{"delete":{"tags":["subscriptions"],"operationId":"delete_subscription","parameters":[{"name":"org_id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"category_id","in":"path","description":"Category ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Revoked"},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/usage":{"get":{"tags":["usage"],"operationId":"list_usage_events","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UsageEvent"}}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/users":{"get":{"tags":["admin"],"operationId":"list_users","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/User"}}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["admin"],"operationId":"create_user","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUserRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/x402/quote":{"post":{"tags":["billing"],"operationId":"x402_quote","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/X402QuoteRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/X402Quote"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/x402/settle":{"post":{"tags":["billing"],"operationId":"x402_settle","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/X402SettleRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/X402SettleResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"AddCategoryDatasetRequest":{"type":"object","required":["dataset_id"],"properties":{"dataset_id":{"type":"string","format":"uuid"}}},"AddOrganizationMemberRequest":{"type":"object","required":["user_id","role"],"properties":{"role":{"$ref":"#/components/schemas/Role"},"user_id":{"type":"string","format":"uuid"}}},"AdminAddMemberRequest":{"type":"object","required":["email","role"],"properties":{"email":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"}}},"AdminGrant":{"type":"object","required":["category_id","slug","name"],"properties":{"category_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}}},"AdminMember":{"type":"object","required":["user_id","email","name","role","created_at"],"properties":{"created_at":{"type":"string","description":"When the membership (not the user) was created."},"email":{"type":"string"},"name":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"},"user_id":{"type":"string","format":"uuid"}}},"AdminOrgDetail":{"type":"object","required":["org","members","api_keys","selections","grants","billing","usage"],"properties":{"api_keys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}},"billing":{"$ref":"#/components/schemas/BillingSummary"},"grants":{"type":"array","items":{"$ref":"#/components/schemas/AdminGrant"}},"members":{"type":"array","items":{"$ref":"#/components/schemas/AdminMember"}},"org":{"$ref":"#/components/schemas/Organization"},"selections":{"type":"array","items":{"$ref":"#/components/schemas/AdminSelection"}},"usage":{"$ref":"#/components/schemas/AdminUsage"}}},"AdminOrgList":{"type":"object","required":["items","total"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AdminOrgRow"}},"total":{"type":"integer","minimum":0}}},"AdminOrgRow":{"type":"object","required":["id","slug","name","kind","tier","addon_dataset_slots","created_at","member_count","active_key_count","selection_count","grant_count","period_requests"],"properties":{"active_key_count":{"type":"integer","description":"Keys that still authenticate: not revoked, not expired.","minimum":0},"addon_dataset_slots":{"type":"integer","format":"int32","minimum":0},"created_at":{"type":"string"},"grant_count":{"type":"integer","description":"Category subscriptions (staff grants).","minimum":0},"id":{"type":"string","format":"uuid"},"kind":{"$ref":"#/components/schemas/OrganizationKind"},"member_count":{"type":"integer","minimum":0},"name":{"type":"string"},"period_requests":{"type":"integer","format":"int64","description":"Data-plane requests this period.","minimum":0},"selection_count":{"type":"integer","format":"int32","description":"Catalog selections counted against the plan right now.","minimum":0},"slug":{"type":"string"},"tier":{"$ref":"#/components/schemas/Tier"}}},"AdminSelection":{"type":"object","required":["dataset_id","slug","name","created_at","active"],"properties":{"active":{"type":"boolean","description":"Readable now: within the plan's limit and still a catalog dataset."},"created_at":{"type":"string"},"dataset_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}}},"AdminStatusResponse":{"type":"object","required":["auth_required","request_quota_per_key","database_enabled","organizations","users","organization_members","datasets","dataset_versions","sources","jobs","raw_archives","error_logs","usage_events","audit_logs","credit_ledger_entries","subscriptions","invoices","raw_archive_backend","raw_archive_location","raw_archive_root","job_queue_backend","job_queue_target","event_backend","event_target"],"properties":{"audit_logs":{"type":"integer","minimum":0},"auth_required":{"type":"boolean"},"credit_ledger_entries":{"type":"integer","minimum":0},"database_enabled":{"type":"boolean"},"dataset_versions":{"type":"integer","minimum":0},"datasets":{"type":"integer","minimum":0},"error_logs":{"type":"integer","minimum":0},"event_backend":{"type":"string"},"event_target":{"type":"string"},"invoices":{"type":"integer","minimum":0},"job_queue_backend":{"type":"string"},"job_queue_target":{"type":"string"},"jobs":{"type":"integer","minimum":0},"organization_members":{"type":"integer","minimum":0},"organizations":{"type":"integer","minimum":0},"raw_archive_backend":{"type":"string"},"raw_archive_location":{"type":"string"},"raw_archive_root":{"type":"string"},"raw_archives":{"type":"integer","minimum":0},"request_quota_per_key":{"type":"integer","format":"int64","minimum":0},"sources":{"type":"integer","minimum":0},"subscriptions":{"type":"integer","minimum":0},"usage_events":{"type":"integer","minimum":0},"users":{"type":"integer","minimum":0}}},"AdminUpdateOrgRequest":{"type":"object","properties":{"addon_dataset_slots":{"type":["integer","null"],"format":"int32","minimum":0},"name":{"type":["string","null"]},"tier":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Tier"}]}}},"AdminUsage":{"type":"object","required":["period","requests"],"properties":{"limit":{"type":["integer","null"],"format":"int64","description":"The plan's monthly_requests; null = unlimited.","minimum":0},"period":{"type":"string"},"requests":{"type":"integer","format":"int64","minimum":0}}},"AdminUserList":{"type":"object","required":["items","total"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserRow"}},"total":{"type":"integer","minimum":0}}},"AdminUserMembership":{"type":"object","required":["org_id","org_name","role"],"properties":{"org_id":{"type":"string","format":"uuid"},"org_name":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"}}},"AdminUserRow":{"type":"object","required":["id","email","name","created_at","memberships"],"properties":{"created_at":{"type":"string"},"email":{"type":"string"},"id":{"type":"string","format":"uuid"},"memberships":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserMembership"}},"name":{"type":"string"}}},"ApiKey":{"type":"object","required":["id","org_id","name","prefix","secret_hash","scopes","created_at"],"properties":{"created_at":{"type":"string"},"dataset_ids":{"type":["array","null"],"items":{"type":"string","format":"uuid"},"description":"The datasets this key may read. `None` means every dataset its org can\nread; a list narrows the key further, never widens the org's access."},"expires_at":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"org_id":{"type":"string","format":"uuid"},"prefix":{"type":"string"},"revoked_at":{"type":["string","null"]},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Permission"}},"secret_hash":{"type":"string"}}},"ApiKeyCreated":{"type":"object","required":["key","secret_once"],"properties":{"key":{"$ref":"#/components/schemas/ApiKey"},"secret_once":{"type":"string"}}},"AuditLog":{"type":"object","required":["id","action","target_type","metadata","created_at"],"properties":{"action":{"type":"string"},"actor_api_key_id":{"type":["string","null"],"format":"uuid"},"actor_user_id":{"type":["string","null"],"format":"uuid","description":"The SSO user who acted, when a person (not a key) made the call."},"created_at":{"type":"string"},"id":{"type":"string","format":"uuid"},"metadata":{},"org_id":{"type":["string","null"],"format":"uuid"},"target_id":{"type":["string","null"],"format":"uuid"},"target_type":{"type":"string"}}},"BillingSubscription":{"type":"object","required":["id","org_id","provider","tier","status","created_at","updated_at"],"properties":{"created_at":{"type":"string"},"current_period_end":{"type":["string","null"]},"current_period_start":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"provider":{"type":"string"},"provider_subscription_id":{"type":["string","null"]},"status":{"type":"string"},"tier":{"$ref":"#/components/schemas/Tier"},"updated_at":{"type":"string"}}},"BillingSummary":{"type":"object","required":["org_id","tier","entitlements","request_usage","credit_balance","invoices"],"properties":{"addon_dataset_slots":{"type":"integer","format":"int32","minimum":0},"catalog_selected":{"type":"integer","format":"int32","description":"Catalog selections currently counted against the plan's limit.","minimum":0},"credit_balance":{"type":"integer","format":"int64"},"entitlements":{"$ref":"#/components/schemas/Entitlements"},"invoices":{"type":"array","items":{"$ref":"#/components/schemas/InvoiceRecord"}},"org_id":{"type":"string","format":"uuid"},"period":{"type":"string","description":"The billing period `request_usage` covers, `YYYY-MM` (UTC)."},"request_usage":{"type":"integer","format":"int64","description":"Data-plane requests the org made in `period` (all keys and SSO\nsessions together) -- the number `entitlements.monthly_requests` caps.","minimum":0},"subscription":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/BillingSubscription"}]},"tier":{"$ref":"#/components/schemas/Tier"}}},"CatalogCategory":{"type":"object","required":["id","slug","name","datasets"],"properties":{"datasets":{"type":"array","items":{"$ref":"#/components/schemas/CatalogDataset"}},"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"parent_id":{"type":["string","null"],"format":"uuid"},"slug":{"type":"string"}}},"CatalogDataset":{"type":"object","required":["id","slug","name","access"],"properties":{"access":{"$ref":"#/components/schemas/DatasetAccess"},"category":{"type":["string","null"]},"description":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"}}},"CatalogLimit":{"type":"object","required":["addon"],"properties":{"addon":{"type":"integer","format":"int32","minimum":0},"base":{"type":["integer","null"],"format":"int32","description":"The tier's `catalog_datasets`; null = unlimited.","minimum":0},"total":{"type":["integer","null"],"format":"int32","description":"base + addon; null = unlimited.","minimum":0}}},"CatalogResponse":{"type":"object","required":["org_id","tier","limit","used","categories","other"],"properties":{"categories":{"type":"array","items":{"$ref":"#/components/schemas/CatalogCategory"},"description":"The platform's categories (a flat list; nest by `parent_id`), each\nwith the datasets filed directly under it."},"limit":{"$ref":"#/components/schemas/CatalogLimit"},"org_id":{"type":"string","format":"uuid"},"other":{"type":"array","items":{"$ref":"#/components/schemas/CatalogDataset"},"description":"Catalog datasets in no category, plus the org's own datasets."},"tier":{"$ref":"#/components/schemas/Tier"},"used":{"type":"integer","format":"int32","description":"Selections counted against `limit.total` right now.","minimum":0}}},"Category":{"type":"object","description":"A category buckets one or more datasets into a sellable \"product\npackage\" (e.g. \"Taiwan Legal Research\" bundling the MOJ law and\njudgment datasets). Categories can nest under a parent to build a\nhierarchy. Selling itself (pricing, entitlements) isn't modeled here --\nthis is just the classification/bundling layer.","required":["id","org_id","slug","name","created_at","updated_at"],"properties":{"created_at":{"type":"string"},"description":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"org_id":{"type":"string","format":"uuid"},"parent_id":{"type":["string","null"],"format":"uuid"},"slug":{"type":"string"},"updated_at":{"type":"string"}}},"CategoryDataset":{"type":"object","description":"A dataset attached to a category, along with when it was added -- the\njoin-table row shape returned by the category-datasets endpoints.","required":["category_id","dataset_id","added_at"],"properties":{"added_at":{"type":"string"},"category_id":{"type":"string","format":"uuid"},"dataset_id":{"type":"string","format":"uuid"}}},"CreateApiKeyRequest":{"type":"object","required":["name"],"properties":{"dataset_ids":{"type":["array","null"],"items":{"type":"string","format":"uuid"},"description":"Datasets the key may read. Omit for every dataset the org can read;\nan empty list is refused rather than read as \"nothing\"."},"name":{"type":"string"},"org_id":{"type":["string","null"],"format":"uuid"},"scopes":{"type":["array","null"],"items":{"$ref":"#/components/schemas/Permission"}}}},"CreateCategoryRequest":{"type":"object","required":["slug","name"],"properties":{"description":{"type":["string","null"]},"name":{"type":"string"},"org_id":{"type":["string","null"],"format":"uuid"},"parent_id":{"type":["string","null"],"format":"uuid"},"slug":{"type":"string"}}},"CreateCreditRequest":{"type":"object","required":["amount","reason"],"properties":{"amount":{"type":"integer","format":"int64"},"metadata":{},"org_id":{"type":["string","null"],"format":"uuid","description":"The org to credit (staff may name any); defaults to the caller's."},"reason":{"type":"string"}}},"CreateDatasetRequest":{"type":"object","required":["slug","name"],"properties":{"category":{"type":["string","null"]},"description":{"type":["string","null"]},"governance":{},"name":{"type":"string"},"org_id":{"type":["string","null"],"format":"uuid"},"schema":{},"slug":{"type":"string"},"tags":{"type":["array","null"],"items":{"type":"string"}}}},"CreateInvoiceRequest":{"type":"object","required":["status","amount_due","currency"],"properties":{"amount_due":{"type":"integer","format":"int64"},"currency":{"type":"string"},"hosted_invoice_url":{"type":["string","null"]},"period_end":{"type":["string","null"]},"period_start":{"type":["string","null"]},"provider":{"type":["string","null"]},"provider_invoice_id":{"type":["string","null"]},"status":{"type":"string"}}},"CreateJobRequest":{"type":"object","required":["kind"],"properties":{"dataset_id":{"type":["string","null"],"format":"uuid"},"kind":{"$ref":"#/components/schemas/JobKind"},"max_attempts":{"type":["integer","null"],"format":"int32","minimum":0},"source_id":{"type":["string","null"],"format":"uuid"}}},"CreateOrganizationRequest":{"type":"object","required":["slug","name"],"properties":{"kind":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/OrganizationKind"}]},"name":{"type":"string"},"slug":{"type":"string"},"tier":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Tier"}]}}},"CreateSourceRequest":{"type":"object","required":["dataset_id","slug","name","kind"],"properties":{"config":{},"dataset_id":{"type":"string","format":"uuid"},"kind":{"$ref":"#/components/schemas/SourceKind"},"name":{"type":"string"},"org_id":{"type":["string","null"],"format":"uuid"},"schedule_interval_minutes":{"type":["integer","null"],"format":"int32"},"slug":{"type":"string"}}},"CreateSubscriptionRequest":{"type":"object","required":["org_id","category_id"],"properties":{"category_id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"}}},"CreateUserRequest":{"type":"object","required":["email","name"],"properties":{"email":{"type":"string"},"name":{"type":"string"}}},"CreditLedgerEntry":{"type":"object","required":["id","org_id","amount","reason","metadata","created_at"],"properties":{"amount":{"type":"integer","format":"int64"},"created_at":{"type":"string"},"id":{"type":"string","format":"uuid"},"metadata":{},"org_id":{"type":"string","format":"uuid"},"reason":{"type":"string"}}},"DataFormat":{"type":"string","enum":["json","ndjson","parquet"]},"Dataset":{"type":"object","required":["id","org_id","slug","name","schema","status","tags","governance","version","created_at","updated_at"],"properties":{"category":{"type":["string","null"]},"created_at":{"type":"string"},"description":{"type":["string","null"]},"governance":{},"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"org_id":{"type":"string","format":"uuid"},"schema":{},"slug":{"type":"string"},"status":{"$ref":"#/components/schemas/DatasetStatus"},"tags":{"type":"array","items":{"type":"string"}},"updated_at":{"type":"string"},"version":{"type":"integer","format":"int64"}}},"DatasetAccess":{"type":"string","description":"How an org reaches a dataset under the plan-isolation read rule. The\ncatalog reports it per dataset; `readable()` is the rule's org half.","enum":["owned","granted","selected","over_limit","none"]},"DatasetStatus":{"type":"string","enum":["draft","active","deprecated","archived"]},"DatasetVersion":{"type":"object","required":["id","dataset_id","version","quality_report"],"properties":{"dataset_id":{"type":"string","format":"uuid"},"id":{"type":"string","format":"uuid"},"published_at":{"type":["string","null"]},"quality_report":{},"raw_archive_id":{"type":["string","null"],"format":"uuid"},"version":{"type":"integer","format":"int64"}}},"Entitlements":{"type":"object","required":["mcp_enabled","x402_enabled"],"properties":{"catalog_datasets":{"type":["integer","null"],"format":"int32","description":"How many catalog (platform-curated) datasets the org may select for\nitself, before add-on slots. `None` = unlimited.","minimum":0},"max_datasets":{"type":["integer","null"],"format":"int32","minimum":0},"mcp_enabled":{"type":"boolean"},"monthly_requests":{"type":["integer","null"],"format":"int64","minimum":0},"x402_enabled":{"type":"boolean"}}},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}},"ExportRequest":{"type":"object","required":["dataset_id"],"properties":{"dataset_id":{"type":"string","format":"uuid"},"format":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/DataFormat"}]},"limit":{"type":["integer","null"],"format":"int32","minimum":0}}},"ExportResponse":{"type":"object","required":["format","records","total"],"properties":{"content":{"type":["string","null"]},"format":{"$ref":"#/components/schemas/DataFormat"},"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"total":{"type":"integer","minimum":0}}},"HealthResponse":{"type":"object","required":["service","status"],"properties":{"service":{"type":"string"},"status":{"type":"string"}}},"IngestRequest":{"type":"object","required":["records"],"properties":{"cursor":{"type":["string","null"]},"format":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/DataFormat"}]},"job_id":{"type":["string","null"],"format":"uuid"},"records":{"type":"array","items":{}}}},"IngestResponse":{"type":"object","required":["job","raw_archive","accepted","rejected","errors","records"],"properties":{"accepted":{"type":"integer","minimum":0},"cursor":{"type":["string","null"]},"errors":{"type":"array","items":{"type":"string"}},"job":{"$ref":"#/components/schemas/Job"},"raw_archive":{"$ref":"#/components/schemas/RawArchive"},"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"rejected":{"type":"integer","minimum":0}}},"InvoiceRecord":{"type":"object","required":["id","org_id","provider","status","amount_due","currency","created_at"],"properties":{"amount_due":{"type":"integer","format":"int64"},"created_at":{"type":"string"},"currency":{"type":"string"},"hosted_invoice_url":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"},"period_end":{"type":["string","null"]},"period_start":{"type":["string","null"]},"provider":{"type":"string"},"provider_invoice_id":{"type":["string","null"]},"status":{"type":"string"}}},"Job":{"type":"object","required":["id","kind","status","attempts","max_attempts","created_at","updated_at"],"properties":{"attempts":{"type":"integer","format":"int32","minimum":0},"created_at":{"type":"string"},"dataset_id":{"type":["string","null"],"format":"uuid"},"error":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"kind":{"$ref":"#/components/schemas/JobKind"},"max_attempts":{"type":"integer","format":"int32","minimum":0},"source_id":{"type":["string","null"],"format":"uuid"},"status":{"$ref":"#/components/schemas/JobStatus"},"updated_at":{"type":"string"}}},"JobKind":{"type":"string","enum":["discover","fetch","parse","normalize","validate","publish"]},"JobStatus":{"type":"string","enum":["queued","running","succeeded","failed","cancelled"]},"JudicialCredentialsStatus":{"type":"object","required":["configured","source"],"properties":{"configured":{"type":"boolean"},"source":{"type":"string"},"username":{"type":["string","null"]}}},"McpCallRequest":{"type":"object","required":["name"],"properties":{"arguments":{},"name":{"type":"string"}}},"McpCallResponse":{"type":"object","required":["name","result"],"properties":{"name":{"type":"string"},"result":{}}},"McpToolResponse":{"type":"object","required":["tools"],"properties":{"tools":{"type":"array","items":{}}}},"OrgDatasetSelection":{"type":"object","description":"A catalog dataset an org picked for itself, counted against its plan's\n`catalog_datasets` (+ add-on slots). Unlike a `Subscription` (a staff\ngrant, not counted), only the org's oldest `limit` selections are\nreadable, so a downgrade isolates the newest ones without deleting them.","required":["org_id","dataset_id","created_at"],"properties":{"created_at":{"type":"string"},"dataset_id":{"type":"string","format":"uuid"},"org_id":{"type":"string","format":"uuid"}}},"Organization":{"type":"object","required":["id","slug","name","tier","kind","created_at"],"properties":{"addon_dataset_slots":{"type":"integer","format":"int32","description":"Catalog datasets this org may select on top of its tier's\n`catalog_datasets`. Staff-set for now; a paid add-on later.","minimum":0},"created_at":{"type":"string"},"id":{"type":"string","format":"uuid"},"kind":{"$ref":"#/components/schemas/OrganizationKind"},"name":{"type":"string"},"slug":{"type":"string"},"tier":{"$ref":"#/components/schemas/Tier"}}},"OrganizationKind":{"type":"string","description":"GitHub-style account model: every Orbbit SSO login gets a Personal org\n(auto-provisioned, sole Owner) so customers never need to be granted\nmembership anywhere just to use Aggre. Team orgs are for multi-member\norganizations -- including Orbbit's own internal staff org -- and are\ncreated explicitly. Enterprise is a billing `Tier` on a Team org, not a\nseparate kind, since org shape and billing tier are independent axes.","enum":["personal","team"]},"OrganizationMember":{"type":"object","required":["org_id","user_id","role","created_at"],"properties":{"created_at":{"type":"string"},"org_id":{"type":"string","format":"uuid"},"role":{"$ref":"#/components/schemas/Role"},"user_id":{"type":"string","format":"uuid"}}},"PaginatedAuditLog":{"type":"object","required":["items","total"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AuditLog"}},"total":{"type":"integer","minimum":0}}},"PaginatedCategory":{"type":"object","required":["items","total"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Category"}},"total":{"type":"integer","minimum":0}}},"PaginatedDataset":{"type":"object","required":["items","total"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Dataset"}},"total":{"type":"integer","minimum":0}}},"PaginatedDatasetVersion":{"type":"object","required":["items","total"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/DatasetVersion"}},"total":{"type":"integer","minimum":0}}},"PaginatedRawArchive":{"type":"object","required":["items","total"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/RawArchive"}},"total":{"type":"integer","minimum":0}}},"PaginatedRecord":{"type":"object","required":["items","total"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"total":{"type":"integer","minimum":0}}},"PaginatedSource":{"type":"object","required":["items","total"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Source"}},"total":{"type":"integer","minimum":0}}},"Permission":{"type":"string","enum":["admin_read","admin_write","api_key_read","api_key_write","billing_read","billing_write","category_read","category_write","dataset_read","dataset_write","export_write","job_read","job_write","mcp_read","search_read","source_read","source_write"]},"PipelineErrorLog":{"type":"object","required":["id","org_id","stage","message","metadata","created_at"],"properties":{"created_at":{"type":"string"},"dataset_id":{"type":["string","null"],"format":"uuid"},"id":{"type":"string","format":"uuid"},"job_id":{"type":["string","null"],"format":"uuid"},"message":{"type":"string"},"metadata":{},"org_id":{"type":"string","format":"uuid"},"source_id":{"type":["string","null"],"format":"uuid"},"stage":{"type":"string"}}},"RawArchive":{"type":"object","required":["id","job_id","source_id","dataset_id","uri","format","bytes","created_at"],"properties":{"bytes":{"type":"integer","format":"int64","minimum":0},"checksum":{"type":["string","null"]},"created_at":{"type":"string"},"dataset_id":{"type":"string","format":"uuid"},"format":{"$ref":"#/components/schemas/DataFormat"},"id":{"type":"string","format":"uuid"},"job_id":{"type":"string","format":"uuid"},"source_id":{"type":"string","format":"uuid"},"uri":{"type":"string"}}},"ReadyResponse":{"type":"object","required":["service","status","database","reranker"],"properties":{"database":{"type":"string"},"reranker":{"type":"string"},"service":{"type":"string"},"status":{"type":"string"}}},"Record":{"type":"object","required":["id","dataset_id","version","data","created_at"],"properties":{"created_at":{"type":"string"},"data":{},"data_hash":{"type":["string","null"]},"dataset_id":{"type":"string","format":"uuid"},"external_id":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"source_id":{"type":["string","null"],"format":"uuid"},"version":{"type":"integer","format":"int64"}}},"RecordCountResponse":{"type":"object","required":["count"],"properties":{"count":{"type":"integer","minimum":0}}},"RepublishResponse":{"type":"object","required":["dataset","version","job","records"],"properties":{"dataset":{"$ref":"#/components/schemas/Dataset"},"job":{"$ref":"#/components/schemas/Job"},"records":{"type":"integer","minimum":0},"version":{"$ref":"#/components/schemas/DatasetVersion"}}},"Role":{"type":"string","enum":["owner","admin","member","viewer"]},"SearchRequest":{"type":"object","required":["query"],"properties":{"dataset_id":{"type":["string","null"],"format":"uuid"},"limit":{"type":["integer","null"],"format":"int32","minimum":0},"query":{"type":"string"}}},"SearchResponse":{"type":"object","required":["results","total"],"properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"total":{"type":"integer","minimum":0}}},"SelectCatalogDatasetRequest":{"type":"object","required":["dataset_id"],"properties":{"dataset_id":{"type":"string","format":"uuid"},"org_id":{"type":["string","null"],"format":"uuid","description":"Staff only: select on behalf of another organization."}}},"SetJudicialCredentialsRequest":{"type":"object","required":["username","password"],"properties":{"password":{"type":"string"},"username":{"type":"string"}}},"SetTwelveDataKeyRequest":{"type":"object","required":["key"],"properties":{"key":{"type":"string"}}},"Source":{"type":"object","required":["id","org_id","dataset_id","slug","name","kind","config","enabled","created_at","updated_at"],"properties":{"config":{},"created_at":{"type":"string"},"dataset_id":{"type":"string","format":"uuid"},"enabled":{"type":"boolean"},"id":{"type":"string","format":"uuid"},"kind":{"$ref":"#/components/schemas/SourceKind"},"name":{"type":"string"},"org_id":{"type":"string","format":"uuid"},"schedule_interval_minutes":{"type":["integer","null"],"format":"int32","description":"How often the scheduler should automatically re-run this source, in\nminutes. `None` means manual-only (the pre-existing behavior)."},"slug":{"type":"string"},"updated_at":{"type":"string"}}},"SourceKind":{"type":"string","enum":["http","s3","r2","database","custom"]},"SourcePreviewResponse":{"type":"object","required":["source_id","dataset_id","format","total","returned","accepted","rejected","errors","records"],"properties":{"accepted":{"type":"integer","minimum":0},"dataset_id":{"type":"string","format":"uuid"},"errors":{"type":"array","items":{"type":"string"}},"format":{"type":"string"},"records":{"type":"array","items":{}},"rejected":{"type":"integer","minimum":0},"returned":{"type":"integer","minimum":0},"source_id":{"type":"string","format":"uuid"},"total":{"type":"integer","minimum":0}}},"StripeWebhookRequest":{"type":"object","required":["event_type","data"],"properties":{"data":{},"event_type":{"type":"string"},"org_id":{"type":["string","null"],"format":"uuid"}}},"StripeWebhookResponse":{"type":"object","required":["accepted","action"],"properties":{"accepted":{"type":"boolean"},"action":{"type":"string"},"invoice":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/InvoiceRecord"}]},"subscription":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/BillingSubscription"}]}}},"Subscription":{"type":"object","description":"Grants an organization read access to every dataset in a category (and\nits sub-categories) without that organization owning the data itself --\nthis is the \"customer subscribes to a product Aggre curates and sells\"\nmodel, as opposed to \"customer brings and owns their own data source\".","required":["org_id","category_id","created_at"],"properties":{"category_id":{"type":"string","format":"uuid"},"created_at":{"type":"string"},"org_id":{"type":"string","format":"uuid"}}},"Tier":{"type":"string","enum":["free","pro","team","enterprise"]},"TwelveDataKeyStatus":{"type":"object","required":["configured","source"],"properties":{"configured":{"type":"boolean"},"hint":{"type":["string","null"]},"source":{"type":"string"}}},"UpdateCategoryRequest":{"type":"object","properties":{"clear_parent":{"type":"boolean","description":"Move the category to the top level, clearing parent_id. Distinct\nfrom parent_id being absent (leave the parent unchanged) --\nordinary JSON can't tell \"omitted\" from \"explicitly null\" without\nextra deserializer plumbing, so this is a plain flag instead."},"description":{"type":["string","null"]},"name":{"type":["string","null"]},"parent_id":{"type":["string","null"],"format":"uuid"}}},"UpdateDatasetRequest":{"type":"object","properties":{"category":{"type":["string","null"]},"description":{"type":["string","null"]},"governance":{},"name":{"type":["string","null"]},"schema":{},"status":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/DatasetStatus"}]},"tags":{"type":["array","null"],"items":{"type":"string"}}}},"UpdateSourceRequest":{"type":"object","properties":{"config":{},"enabled":{"type":["boolean","null"]},"name":{"type":["string","null"]},"schedule_interval_minutes":{"type":["integer","null"],"format":"int32","description":"Set to change the schedule; `Some(0)` (or any non-positive value)\nclears it back to manual-only. `None` leaves it unchanged."}}},"UpsertSubscriptionRequest":{"type":"object","required":["tier","status"],"properties":{"current_period_end":{"type":["string","null"]},"current_period_start":{"type":["string","null"]},"org_id":{"type":["string","null"],"format":"uuid"},"provider":{"type":["string","null"]},"provider_subscription_id":{"type":["string","null"]},"status":{"type":"string"},"tier":{"$ref":"#/components/schemas/Tier"}}},"UsageEvent":{"type":"object","required":["id","org_id","event_type","quantity","metadata","created_at"],"properties":{"api_key_id":{"type":["string","null"],"format":"uuid"},"created_at":{"type":"string"},"event_type":{"type":"string"},"id":{"type":"string","format":"uuid"},"metadata":{},"org_id":{"type":"string","format":"uuid"},"quantity":{"type":"integer","format":"int64","minimum":0}}},"User":{"type":"object","required":["id","email","name","created_at"],"properties":{"created_at":{"type":"string"},"email":{"type":"string"},"id":{"type":"string","format":"uuid"},"name":{"type":"string"}}},"X402Quote":{"type":"object","required":["id","route","units","amount","currency","payment_header","expires_at"],"properties":{"amount":{"type":"integer","format":"int64"},"currency":{"type":"string"},"expires_at":{"type":"string"},"id":{"type":"string","format":"uuid"},"payment_header":{"type":"string"},"route":{"type":"string"},"units":{"type":"integer","format":"int64","minimum":0}}},"X402QuoteRequest":{"type":"object","required":["route"],"properties":{"route":{"type":"string"},"units":{"type":["integer","null"],"format":"int64","minimum":0}}},"X402SettleRequest":{"type":"object","required":["quote_id","route","amount","currency"],"properties":{"amount":{"type":"integer","format":"int64"},"currency":{"type":"string"},"proof":{"type":["string","null"]},"quote_id":{"type":"string","format":"uuid"},"route":{"type":"string"}}},"X402SettleResponse":{"type":"object","required":["accepted","ledger_entry"],"properties":{"accepted":{"type":"boolean"},"ledger_entry":{"$ref":"#/components/schemas/CreditLedgerEntry"}}}}},"tags":[{"name":"system","description":"System and service metadata"},{"name":"datasets","description":"Dataset registry APIs"},{"name":"categories","description":"Hierarchical categories that bundle datasets into sellable product packages"},{"name":"subscriptions","description":"Org-to-category access grants -- customers subscribing to data Aggre curates and sells"},{"name":"catalog","description":"The platform catalog and the databases an org selects within its plan"},{"name":"sources","description":"Source registry APIs"},{"name":"auth","description":"API key management"},{"name":"jobs","description":"Pipeline job APIs"},{"name":"raw-archives","description":"Raw archive metadata APIs"},{"name":"usage","description":"Usage metering APIs"},{"name":"billing","description":"Billing, credits, invoices, and x402 APIs"},{"name":"admin","description":"Admin and audit APIs"},{"name":"mcp","description":"MCP integration metadata"},{"name":"search","description":"Data access APIs"}]}