{"openapi":"3.1.0","info":{"title":"Chorus API","version":"0.1.0","description":"DNS record + domain management API."},"components":{"schemas":{"WebhookWithSecret":{"allOf":[{"$ref":"#/components/schemas/Webhook"},{"type":"object","properties":{"secret":{"type":"string"}},"required":["secret"]}]},"Webhook":{"type":"object","properties":{"id":{"type":"string"},"orgId":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"active":{"type":"boolean"},"includeContent":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","url","events","active","includeContent","createdAt","updatedAt"]},"CreateWebhook":{"type":"object","properties":{"url":{"type":"string","minLength":1},"events":{"type":"array","items":{"type":"string"},"default":[]},"includeContent":{"type":"boolean","default":false},"orgId":{"type":"string"}},"required":["url"]},"UpdateWebhook":{"type":"object","properties":{"url":{"type":"string","minLength":1},"events":{"type":"array","items":{"type":"string"}},"active":{"type":"boolean"},"includeContent":{"type":"boolean"},"rotateSecret":{"type":"boolean"}}},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string"},"eventType":{"type":"string"},"status":{"type":"string"},"attemptCount":{"type":"number"},"responseStatus":{"type":"number","nullable":true},"lastAttemptedAt":{"type":"string","nullable":true},"nextRetryAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"errorMessage":{"type":"string","nullable":true}},"required":["id","eventType","status","attemptCount","responseStatus","lastAttemptedAt","nextRetryAt","createdAt","errorMessage"]}},"parameters":{}},"paths":{"/public/search":{"get":{"tags":["Public"],"parameters":[{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","enum":["A","CNAME","TXT","SRV"]},"required":false,"name":"type","in":"query"},{"schema":{"type":"string"},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Publicly viewable DNS records.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"count":{"type":"integer"},"records":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"content":{"type":"string"},"domain":{"type":"string"}},"required":["id","name","type","content","domain"]}},"nextCursor":{"type":"string","nullable":true}},"required":["status","count","records","nextCursor"]}}}}}}},"/public/domains":{"get":{"tags":["Public"],"parameters":[{"schema":{"type":"string"},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Publicly viewable domains.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"count":{"type":"integer"},"domains":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}},"nextCursor":{"type":"string","nullable":true}},"required":["status","count","domains","nextCursor"]}}}}}}},"/list":{"get":{"tags":["Records"],"parameters":[{"schema":{"type":"string"},"required":false,"name":"owner","in":"query"},{"schema":{"type":"string"},"required":false,"name":"name","in":"query"},{"schema":{"type":"string","enum":["A","CNAME","TXT","SRV"]},"required":false,"name":"type","in":"query"},{"schema":{"type":"string"},"required":false,"name":"domain","in":"query"},{"schema":{"type":"string"},"required":false,"name":"lint","in":"query"}],"responses":{"200":{"description":"Matching DNS records.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"count":{"type":"integer"},"records":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["A","CNAME","TXT","SRV"]},"content":{"type":"string"},"ttl":{"type":"integer"},"owner":{"type":"string","nullable":true},"yellowpages_id":{"type":"string","nullable":true},"domain":{"type":"string"},"policy":{"type":"string"},"operator":{"type":"string","nullable":true},"mode":{"type":"integer"},"is_public":{"type":"boolean"},"moderation_status":{"type":"string","nullable":true},"is_owner":{"type":"boolean"},"can_edit":{"type":"boolean"},"can_delete":{"type":"boolean"},"can_chmod":{"type":"boolean"},"can_publish":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"lint":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"string"},"severity":{"type":"string","enum":["error","warning"]},"message":{"type":"string"}},"required":["rule","severity","message"]}}},"required":["id","name","type","content","ttl","owner","yellowpages_id","domain","policy","operator","mode","is_public","moderation_status","is_owner","can_edit","can_delete","can_chmod","can_publish","created_at","updated_at"]}}},"required":["status","count","records"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/list-domains":{"get":{"tags":["Domains"],"responses":{"200":{"description":"Available domains.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"domains":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}}},"required":["status","domains"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/create":{"post":{"tags":["Records"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name-host":{"type":"string"},"name-root":{"type":"string"},"content":{"type":"string"},"record_type":{"type":"string","enum":["A","CNAME","TXT","SRV"]},"yellowpages_id":{"type":"string"},"ttl":{"type":"integer","minimum":0,"maximum":2147483647,"default":300},"policy":{"type":"string","enum":["simple","failover","geo_location","split-view","weighted"],"default":"simple"},"operator":{"type":"string"},"mode":{"type":"integer"}},"required":["name-host","name-root","content","record_type","yellowpages_id"]}}}},"responses":{"200":{"description":"Record created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"record":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["A","CNAME","TXT","SRV"]},"content":{"type":"string"},"ttl":{"type":"integer"},"owner":{"type":"string","nullable":true},"yellowpages_id":{"type":"string","nullable":true},"domain":{"type":"string"},"policy":{"type":"string"},"operator":{"type":"string","nullable":true},"mode":{"type":"integer"},"is_public":{"type":"boolean"},"moderation_status":{"type":"string","nullable":true},"is_owner":{"type":"boolean"},"can_edit":{"type":"boolean"},"can_delete":{"type":"boolean"},"can_chmod":{"type":"boolean"},"can_publish":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"lint":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"string"},"severity":{"type":"string","enum":["error","warning"]},"message":{"type":"string"}},"required":["rule","severity","message"]}}},"required":["id","name","type","content","ttl","owner","yellowpages_id","domain","policy","operator","mode","is_public","moderation_status","is_owner","can_edit","can_delete","can_chmod","can_publish","created_at","updated_at"]}},"required":["status"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/edit/{id}":{"post":{"tags":["Records"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string"},"type":{"type":"string","enum":["A","CNAME","TXT","SRV"]},"ttl":{"type":"integer","minimum":0,"maximum":2147483647}}}}}},"responses":{"200":{"description":"Record updated successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"record":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["A","CNAME","TXT","SRV"]},"content":{"type":"string"},"ttl":{"type":"integer"},"owner":{"type":"string","nullable":true},"yellowpages_id":{"type":"string","nullable":true},"domain":{"type":"string"},"policy":{"type":"string"},"operator":{"type":"string","nullable":true},"mode":{"type":"integer"},"is_public":{"type":"boolean"},"moderation_status":{"type":"string","nullable":true},"is_owner":{"type":"boolean"},"can_edit":{"type":"boolean"},"can_delete":{"type":"boolean"},"can_chmod":{"type":"boolean"},"can_publish":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"lint":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"string"},"severity":{"type":"string","enum":["error","warning"]},"message":{"type":"string"}},"required":["rule","severity","message"]}}},"required":["id","name","type","content","ttl","owner","yellowpages_id","domain","policy","operator","mode","is_public","moderation_status","is_owner","can_edit","can_delete","can_chmod","can_publish","created_at","updated_at"]}},"required":["status"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/remove":{"delete":{"tags":["Records"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"query"}],"responses":{"200":{"description":"Record deleted successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}},"required":["status"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/chmod/{id}":{"post":{"tags":["Records"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"integer"}},"required":["mode"]}}}},"responses":{"200":{"description":"Mode updated.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"record":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["A","CNAME","TXT","SRV"]},"content":{"type":"string"},"ttl":{"type":"integer"},"owner":{"type":"string","nullable":true},"yellowpages_id":{"type":"string","nullable":true},"domain":{"type":"string"},"policy":{"type":"string"},"operator":{"type":"string","nullable":true},"mode":{"type":"integer"},"is_public":{"type":"boolean"},"moderation_status":{"type":"string","nullable":true},"is_owner":{"type":"boolean"},"can_edit":{"type":"boolean"},"can_delete":{"type":"boolean"},"can_chmod":{"type":"boolean"},"can_publish":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"lint":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"string"},"severity":{"type":"string","enum":["error","warning"]},"message":{"type":"string"}},"required":["rule","severity","message"]}}},"required":["id","name","type","content","ttl","owner","yellowpages_id","domain","policy","operator","mode","is_public","moderation_status","is_owner","can_edit","can_delete","can_chmod","can_publish","created_at","updated_at"]}},"required":["status"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/create-domain":{"post":{"tags":["Domains"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"orgId":{"type":"string"}},"required":["name"]}}}},"responses":{"200":{"description":"Domain created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"domain":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"orgId":{"type":"string"},"mode":{"type":"integer"},"is_public":{"type":"boolean"},"created_at":{"type":"string"}},"required":["id","name","orgId","mode","is_public","created_at"]}},"required":["status"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/domains/{id}":{"patch":{"tags":["Domains"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1}}}}}},"responses":{"200":{"description":"Domain updated successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"domain":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"orgId":{"type":"string"},"mode":{"type":"integer"},"is_public":{"type":"boolean"},"created_at":{"type":"string"}},"required":["id","name","orgId","mode","is_public","created_at"]}},"required":["status"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}},"delete":{"tags":["Domains"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Domain deleted successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}},"required":["status"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/webhooks":{"post":{"tags":["Webhooks"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhook"}}}},"responses":{"201":{"description":"Webhook created (plaintext secret shown once)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookWithSecret"}}}},"400":{"description":"Ambiguous org (admin of multiple orgs must specify orgId)"},"403":{"description":"Caller is not an org:admin"},"422":{"description":"URL is not a safe public HTTPS endpoint (SSRF guard), or contains blocklisted terms (content_rejected)"}}},"get":{"tags":["Webhooks"],"responses":{"200":{"description":"Webhooks for the caller admin orgs (never includes secrets)","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}},"required":["webhooks"]}}}},"403":{"description":"Caller is not an org:admin"}}}},"/webhooks/{id}":{"get":{"tags":["Webhooks"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Webhook detail (never includes the secret)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"403":{"description":"Caller is not an org:admin"},"404":{"description":"Webhook not found (or belongs to another org)"}}},"patch":{"tags":["Webhooks"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWebhook"}}}},"responses":{"200":{"description":"Webhook updated (secret present ONLY when rotated)","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"orgId":{"type":"string"},"url":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"active":{"type":"boolean"},"includeContent":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"secret":{"type":"string"}},"required":["id","orgId","url","events","active","includeContent","createdAt","updatedAt"]}}}},"403":{"description":"Caller is not an org:admin"},"404":{"description":"Webhook not found (or belongs to another org)"},"422":{"description":"URL is not a safe public HTTPS endpoint (SSRF guard), or contains blocklisted terms (content_rejected)"}}},"delete":{"tags":["Webhooks"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Webhook deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}},"required":["deleted"]}}}},"403":{"description":"Caller is not an org:admin"},"404":{"description":"Webhook not found (or belongs to another org)"}}}},"/webhooks/{id}/test":{"post":{"tags":["Webhooks"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"202":{"description":"Synthetic test delivery enqueued","content":{"application/json":{"schema":{"type":"object","properties":{"deliveryId":{"type":"string"},"status":{"type":"string"}},"required":["deliveryId","status"]}}}},"403":{"description":"Caller is not an org:admin"},"404":{"description":"Webhook not found (or belongs to another org)"}}}},"/webhooks/{id}/deliveries":{"get":{"tags":["Webhooks"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Recent delivery attempts (metadata only; never the payload/secret/signature)","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}}},"required":["deliveries"]}}}},"403":{"description":"Caller is not an org:admin"},"404":{"description":"Webhook not found (or belongs to another org)"}}}},"/device-tokens":{"post":{"tags":["DeviceTokens"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":1},"platform":{"type":"string","enum":["ios","android"]},"orgId":{"type":"string"}},"required":["token"]}}}},"responses":{"200":{"description":"Token registered.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"}},"required":["status"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"}},"required":["status","code","error"]}}}}}},"delete":{"tags":["DeviceTokens"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"token","in":"query"}],"responses":{"200":{"description":"Token removed (or absent).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"}},"required":["status"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"}},"required":["status","code","error"]}}}}}}},"/org-members":{"get":{"tags":["OrgMembers"],"parameters":[{"schema":{"type":"string"},"required":false,"name":"orgId","in":"query"}],"responses":{"200":{"description":"Members of the resolved org, plus users not yet in any org.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"count":{"type":"integer"},"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"email":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"created_at":{"type":"string"}},"required":["id","userId","email","name","role","created_at"]}},"unaffiliated_count":{"type":"integer"},"unaffiliated":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":"string"},"created_at":{"type":"string"}},"required":["id","email","name","created_at"]}}},"required":["status","count","members","unaffiliated_count","unaffiliated"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/org-members/grant":{"post":{"tags":["OrgMembers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"role":{"type":"string","enum":["org:admin","org:contributor","org:viewer"]},"orgId":{"type":"string"}},"required":["role"]}}}},"responses":{"200":{"description":"Membership granted or updated.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"member":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"email":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"created_at":{"type":"string"}},"required":["id","userId","email","name","role","created_at"]}},"required":["status"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/org-members/revoke":{"post":{"tags":["OrgMembers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"orgId":{"type":"string"}}}}}},"responses":{"200":{"description":"Membership revoked (or already absent).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}},"required":["status"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/reports":{"post":{"tags":["Moderation"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"record_id":{"type":"string","minLength":1},"reason":{"type":"string","minLength":1,"maxLength":1000}},"required":["record_id","reason"]}}}},"responses":{"200":{"description":"Report filed (created=true) or already on file for this record (created=false).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"created":{"type":"boolean"},"report":{"type":"object","properties":{"id":{"type":"string"},"record_id":{"type":"string","nullable":true},"record_name":{"type":"string"},"record_domain":{"type":"string"},"reason":{"type":"string"},"status":{"type":"string","enum":["open","actioned","dismissed"]},"created_at":{"type":"string"},"resolved_at":{"type":"string","nullable":true}},"required":["id","record_id","record_name","record_domain","reason","status","created_at","resolved_at"]}},"required":["status","created","report"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/blocks":{"get":{"tags":["Moderation"],"responses":{"200":{"description":"Users the caller has blocked.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"blocks":{"type":"array","items":{"type":"object","properties":{"user_id":{"type":"string"},"name":{"type":"string"},"created_at":{"type":"string"}},"required":["user_id","name","created_at"]}}},"required":["status","blocks"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}},"post":{"tags":["Moderation"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"user_id":{"type":"string","minLength":1},"record_id":{"type":"string","minLength":1}}}}}},"responses":{"200":{"description":"User blocked (idempotent).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"user_id":{"type":"string"}},"required":["status","user_id"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}},"delete":{"tags":["Moderation"],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"user_id","in":"query"}],"responses":{"200":{"description":"User unblocked (or was not blocked).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"}},"required":["status"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/moderation/reports":{"get":{"tags":["Moderation"],"parameters":[{"schema":{"type":"string","enum":["open","actioned","dismissed"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string"},"required":false,"name":"overdue","in":"query"}],"responses":{"200":{"description":"Reports in the caller’s moderation scope, oldest first (max 200). org:admins see only reports about private records in their org filed by org members; platform moderators see all.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"count":{"type":"integer"},"reports":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"record_id":{"type":"string","nullable":true},"record_name":{"type":"string"},"record_domain":{"type":"string"},"reason":{"type":"string"},"status":{"type":"string","enum":["open","actioned","dismissed"]},"created_at":{"type":"string"},"resolved_at":{"type":"string","nullable":true},"reporter_id":{"type":"string","nullable":true},"resolved_by":{"type":"string","nullable":true},"platform_only":{"type":"boolean"},"overdue":{"type":"boolean"},"record":{"type":"object","nullable":true,"properties":{"id":{"type":"string"},"name":{"type":"string"},"org_id":{"type":"string"},"content":{"type":"string"},"author_id":{"type":"string","nullable":true},"is_public":{"type":"boolean"},"moderation_status":{"type":"string","nullable":true}},"required":["id","name","org_id","content","author_id","is_public","moderation_status"]}},"required":["id","record_id","record_name","record_domain","reason","status","created_at","resolved_at","reporter_id","resolved_by","platform_only","overdue","record"]}}},"required":["status","count","reports"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/moderation/reports/{id}/resolve":{"post":{"tags":["Moderation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["remove","dismiss"]},"revoke_author":{"type":"boolean","default":false}},"required":["action"]}}}},"responses":{"200":{"description":"Report resolved. author_revoke_error explains author_revoked=false when revoke_author was requested.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"report":{"type":"object","properties":{"id":{"type":"string"},"record_id":{"type":"string","nullable":true},"record_name":{"type":"string"},"record_domain":{"type":"string"},"reason":{"type":"string"},"status":{"type":"string","enum":["open","actioned","dismissed"]},"created_at":{"type":"string"},"resolved_at":{"type":"string","nullable":true}},"required":["id","record_id","record_name","record_domain","reason","status","created_at","resolved_at"]},"record_removed":{"type":"boolean"},"author_revoked":{"type":"boolean"},"author_revoke_error":{"type":"string","nullable":true,"enum":["no_author","cannot_revoke_self","last_admin","not_a_member","failed",null]}},"required":["status","report","record_removed","author_revoked","author_revoke_error"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}},"/eula/accept":{"post":{"tags":["Moderation"],"responses":{"200":{"description":"Terms accepted.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"eula_accepted_at":{"type":"string"}},"required":["status","eula_accepted_at"]}}}},"default":{"description":"Error response.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"code":{"type":"string"},"error":{"type":"string"},"details":{"type":"string"}},"required":["status","code","error","details"]}}}}}}}}}