{"openapi":"3.1.0","info":{"title":"Marketing OS — Unified API","version":"v1"},"paths":{"/v1/crm/api-keys":{"get":{"operationId":"identity.keys.list","tags":["identity"],"summary":"List my API keys","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}},"required":["keys"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"post":{"operationId":"identity.keys.create","tags":["identity"],"summary":"Create an API key (the secret is returned once)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"environment":{"type":"string","enum":["live","test","dev"]},"scopes":{"type":"array","items":{"type":"string","enum":["read","write","admin"]},"minItems":1},"expiresAt":{"type":"string","format":"date-time"},"rateLimitOverride":{"type":"object","properties":{"read":{"type":"integer","exclusiveMinimum":0},"write":{"type":"integer","exclusiveMinimum":0},"admin":{"type":"integer","exclusiveMinimum":0}}},"toolAllowlist":{"type":"array","items":{"type":"string","pattern":"^(\\*|[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)*(\\.\\*)?)$"},"maxItems":100},"tenantId":{"type":"string","format":"uuid"}},"required":["name","environment","scopes"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"$ref":"#/components/schemas/ApiKey"},"secret":{"type":"string"}},"required":["key","secret"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"402":{"description":"A live key needs an active paid plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/crm/api-keys/{id}":{"delete":{"operationId":"identity.keys.revoke","tags":["identity"],"summary":"Revoke an API key","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Revoked"},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Not found or already revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/crm/api-keys/{id}/usage":{"get":{"operationId":"identity.keys.usage","tags":["identity"],"summary":"One key's usage by UTC day (owner only; foreign keys are 404)","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":365,"default":30},"required":false,"name":"days","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"keyId":{"type":"string"},"days":{"type":"number"},"usage":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"requests":{"type":"number"},"errors":{"type":"number"}},"required":["day","requests","errors"]}}},"required":["keyId","days","usage"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"404":{"description":"Key not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/crm/api-keys/verify":{"post":{"operationId":"identity.keys.verify","tags":["identity","internal"],"summary":"Verify a raw API key and return its context (gateway)","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"apiKeyId":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"environment":{"type":"string"},"plan":{"type":"string"},"entitledUntil":{"type":["string","null"]},"toolAllowlist":{"type":["array","null"],"items":{"type":"string"}},"tenantId":{"type":["string","null"]},"rateLimitOverride":{"type":["object","null"],"additionalProperties":{"type":"number"}}},"required":["userId","apiKeyId","scopes","environment","toolAllowlist","tenantId","rateLimitOverride"]}}}},"401":{"description":"Unknown, revoked or expired key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/crm/internal/entitlements":{"put":{"operationId":"identity.entitlements.put","tags":["identity","internal"],"summary":"Set an account's plan / entitlement (operators, billing)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","format":"uuid"},"plan":{"type":"string","enum":["free","starter","pro","team","enterprise"]},"entitledUntil":{"type":["string","null"],"format":"date-time"},"source":{"type":"string","minLength":1,"maxLength":40}},"required":["userId","plan"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"entitlement":{"$ref":"#/components/schemas/Entitlement"}},"required":["entitlement"]}}}},"401":{"description":"Invalid secret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Secret unset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}},"get":{"operationId":"identity.entitlements.get","tags":["identity","internal"],"summary":"Read an account's entitlement","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"userId","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"entitlement":{"allOf":[{"$ref":"#/components/schemas/Entitlement"},{"type":["object","null"]}]}},"required":["entitlement"]}}}},"401":{"description":"Invalid secret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Secret unset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/crm/internal/stripe":{"post":{"operationId":"identity.stripe.webhook","tags":["identity","internal"],"summary":"Stripe webhook: subscription events become entitlements","responses":{"200":{"description":"Handled or deliberately ignored"},"400":{"description":"Not a Stripe event","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"401":{"description":"Signature rejected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Webhook secret unset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/crm/internal/api-usage":{"post":{"operationId":"identity.usage.ingest","tags":["identity","internal"],"summary":"The gateway's usage flush","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"type":"object","properties":{"apiKeyId":{"type":"string","format":"uuid"},"hour":{"type":"string","format":"date-time"},"requests":{"type":"integer","minimum":0},"errors":{"type":"integer","minimum":0,"default":0}},"required":["apiKeyId","hour","requests"]},"maxItems":10000}},"required":["entries"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"written":{"type":"number"}},"required":["written"]}}}},"401":{"description":"Invalid gateway bearer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Secret unset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/crm/internal/api-usage/summary":{"get":{"operationId":"identity.usage.summary","tags":["identity","internal"],"summary":"Org-wide usage for the api.* metrics (gateway bearer)","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":365,"default":30},"required":false,"name":"days","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"number"},"since":{"type":"string"},"liveKeys":{"type":"number"},"requests":{"type":"number"},"errors":{"type":"number"},"activeKeys":{"type":"number"}},"required":["days","since","liveKeys","requests","errors","activeKeys"]}}}},"401":{"description":"Invalid gateway bearer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"503":{"description":"Secret unset","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/v1/crm/people":{"get":{"operationId":"crm.people.list","tags":["crm","people"],"summary":"List people","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1,"description":"Opaque server-issued pagination cursor. Pass back unchanged from the previous response."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string"},"required":false,"name":"sort","in":"query"},{"schema":{"type":"string"},"required":false,"name":"fields","in":"query"},{"schema":{"type":"object","additionalProperties":{"type":"string"}},"required":false,"name":"filter","in":"query"},{"schema":{"type":["number","null"]},"required":false,"name":"filter[score][gt]","in":"query"},{"schema":{"type":["number","null"]},"required":false,"name":"filter[score][lt]","in":"query"},{"schema":{"type":"string"},"required":false,"name":"filter[tag]","in":"query"},{"schema":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"required":false,"name":"filter[company_id]","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Person"}},"next_cursor":{"type":["string","null"],"minLength":1,"description":"Opaque server-issued pagination cursor. Pass back unchanged from the previous response."}},"required":["data","next_cursor"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/people/{id}":{"get":{"operationId":"crm.people.get","tags":["crm","people"],"summary":"Get a person","parameters":[{"schema":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"fields","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Person"}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}},"patch":{"operationId":"crm.people.update","tags":["crm","people"],"summary":"Update an existing person (name / tags / attributes)","parameters":[{"schema":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"tags":{"type":"array","items":{"type":"string"}},"attributes":{"type":"object","additionalProperties":{}}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Person"}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/people/{id}/upsert":{"post":{"operationId":"crm.people.upsert","tags":["crm","people"],"summary":"Create or update a person by id (Idempotency-Key honoured)","parameters":[{"schema":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"domain":{"type":"string"},"name":{"type":"string","minLength":1},"tags":{"type":"array","items":{"type":"string"}},"attributes":{"type":"object","additionalProperties":{}}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Person"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Person"}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"409":{"description":"Idempotency-Key reused with a different body","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/people/{id}/merge-candidates":{"post":{"operationId":"crm.people.merge_candidates","tags":["crm","people"],"summary":"Find likely duplicate people","parameters":[{"schema":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"candidateIds":{"type":"array","items":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"minItems":1,"maxItems":20}},"required":["candidateIds"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"candidates":{"type":"array","items":{"type":"object","properties":{"personId":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"confidence":{"type":"number","minimum":0,"maximum":1},"reasons":{"type":"array","items":{"type":"string"}}},"required":["personId","confidence","reasons"]}}},"required":["candidates"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"404":{"description":"Person not found","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/people/{id}/score-explain":{"get":{"operationId":"crm.people.score_explain","tags":["crm","people"],"summary":"Human-readable lead score breakdown","parameters":[{"schema":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"personId":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"score":{"type":"integer"},"components":{"allOf":[{"$ref":"#/components/schemas/ScoreComponents"},{"type":"object"}]},"reasons":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"impact":{"type":"number"},"detail":{"type":"string"}},"required":["label","impact","detail"]}}},"required":["personId","score","components","reasons"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"404":{"description":"Person not found","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/people/{id}/timeline":{"get":{"operationId":"crm.people.timeline","tags":["crm","people"],"summary":"Touchpoint timeline for a person","parameters":[{"schema":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["events"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/people/bulk":{"post":{"operationId":"crm.people.bulk","tags":["crm","people"],"summary":"Bulk upsert / tag / untag people (max 1000 ops)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"operations":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"op":{"type":"string","enum":["upsert"]},"data":{"type":"object","properties":{"email":{"type":"string","format":"email"},"domain":{"type":"string"},"name":{"type":"string","minLength":1},"tags":{"type":"array","items":{"type":"string"}},"attributes":{"type":"object","additionalProperties":{}}}}},"required":["op","data"]},{"type":"object","properties":{"op":{"type":"string","enum":["tag"]},"personId":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"tag":{"type":"string"}},"required":["op","personId","tag"]},{"type":"object","properties":{"op":{"type":"string","enum":["untag"]},"personId":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"tag":{"type":"string"}},"required":["op","personId","tag"]}]},"minItems":1,"maxItems":1000}},"required":["operations"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"op":{"type":"string"},"ok":{"type":"boolean"},"personId":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"error":{"type":"string"}},"required":["index","op","ok"]}},"succeeded":{"type":"integer"},"failed":{"type":"integer"}},"required":["results","succeeded","failed"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/health":{"get":{"operationId":"crm.health","tags":["crm","system"],"summary":"Liveness probe (database ping). No auth required.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"db":{"type":"string","enum":["up","down"]},"error":{"type":"string"}},"required":["ok","db"]}}}},"503":{"description":"Database down"}}}},"/v1/crm/stats":{"get":{"operationId":"crm.stats","tags":["crm","stats"],"summary":"Aggregate CRM stats","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"people":{"type":"integer"},"companies":{"type":"integer"}},"required":["people","companies"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/companies":{"get":{"operationId":"crm.companies.list","tags":["crm","companies"],"summary":"List companies","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":{}}},"next_cursor":{"type":["string","null"]}},"required":["data","next_cursor"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/companies/{id}":{"get":{"operationId":"crm.companies.get","tags":["crm","companies"],"summary":"Get a company","parameters":[{"schema":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/campaigns":{"get":{"operationId":"crm.campaigns.list","tags":["crm","campaigns"],"summary":"List campaigns","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":{}}},"next_cursor":{"type":["string","null"]}},"required":["data","next_cursor"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/campaigns/{id}":{"get":{"operationId":"crm.campaigns.get","tags":["crm","campaigns"],"summary":"Get a campaign","parameters":[{"schema":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/webhooks":{"get":{"operationId":"crm.webhooks.list","tags":["crm","webhooks"],"summary":"List webhooks","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["data"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}},"post":{"operationId":"crm.webhooks.create","tags":["crm","webhooks"],"summary":"Create a webhook","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["name","url","events"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/webhooks/{id}":{"get":{"operationId":"crm.webhooks.get","tags":["crm","webhooks"],"summary":"Get a webhook","parameters":[{"schema":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}},"delete":{"operationId":"crm.webhooks.delete","tags":["crm","webhooks"],"summary":"Delete a webhook","parameters":[{"schema":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/segments":{"get":{"operationId":"crm.segments.list","tags":["crm","segments"],"summary":"List saved segments","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":{}}},"next_cursor":{"type":["string","null"]}},"required":["data","next_cursor"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}},"post":{"operationId":"crm.segments.create","tags":["crm","segments"],"summary":"Create a saved segment","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"filters":{"type":"object","additionalProperties":{},"default":{}}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"name":{"type":"string"},"description":{"type":["string","null"]},"filters":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","description","filters","createdAt","updatedAt"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"409":{"description":"A saved view with that name already exists","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/segments/{id}":{"get":{"operationId":"crm.segments.get","tags":["crm","segments"],"summary":"Get a segment","parameters":[{"schema":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/segments/{id}/materialize":{"post":{"operationId":"crm.segments.materialize","tags":["crm","segments"],"summary":"Materialize a segment — paginated list of matching people","parameters":[{"schema":{"type":"string","format":"uuid","example":"0190f6c8-1d2a-7c2b-9f44-2b8d1f64a8c1"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"people":{"type":"array","items":{"type":"object","additionalProperties":{}}},"next_cursor":{"type":["string","null"]},"size":{"type":"integer"}},"required":["people","next_cursor","size"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/crm/events":{"get":{"operationId":"crm.events.list","tags":["crm","events"],"summary":"Recent CRM events","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["events"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["field","code","message"]}}},"required":["type","title","status","code"]}}}}}}},"/v1/dashboard/health":{"get":{"operationId":"dashboard.health","tags":["dashboard","system"],"summary":"Health check","security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"service":{"type":"string"},"version":{"type":"string"},"ts":{"type":"string"},"db":{"type":"string","enum":["ok","unreachable"]}},"required":["status","service","version","ts","db"]}}}}}}},"/v1/dashboard/apps":{"get":{"operationId":"dashboard.apps.list","tags":["dashboard","apps"],"summary":"List apps","security":[],"parameters":[{"schema":{"type":"string","description":"Opaque pagination cursor. Treat as an opaque token — do not parse.","example":"eyJjcmVhdGVkQXQiOiIyMDI2LTA2LTE3VDA5OjAwOjAwWiIsImlkIjoiYWJjMTIzIn0"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Comma-separated sparse-fieldset projection. Supports dot-paths (e.g. \"id,name,channel.handle\")."},"required":false,"name":"fields","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/App"}},"next_cursor":{"type":["string","null"]},"total_estimate":{"type":["integer","null"]}},"required":["data","next_cursor","total_estimate"]}}}}}},"post":{"operationId":"dashboard.apps.create","tags":["dashboard","apps"],"summary":"Create an app","security":[{"SessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/App"}},"required":["data"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}},"/v1/dashboard/apps/{id}":{"get":{"operationId":"dashboard.apps.get","tags":["dashboard","apps"],"summary":"Get an app","security":[],"parameters":[{"schema":{"type":"string","format":"uuid","example":"8b2c1d4e-4f6a-4c8b-9e0a-1b2c3d4e5f6a"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/App"}},"required":["data"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}},"patch":{"operationId":"dashboard.apps.update","tags":["dashboard","apps"],"summary":"Update an app (partial)","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"8b2c1d4e-4f6a-4c8b-9e0a-1b2c3d4e5f6a"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppUpdate"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/App"}},"required":["data"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}},"delete":{"operationId":"dashboard.apps.delete","tags":["dashboard","apps"],"summary":"Delete an app","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"8b2c1d4e-4f6a-4c8b-9e0a-1b2c3d4e5f6a"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}},"/v1/dashboard/posts":{"get":{"operationId":"dashboard.posts.list","tags":["dashboard","posts"],"summary":"List posts","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","description":"Opaque pagination cursor. Treat as an opaque token — do not parse.","example":"eyJjcmVhdGVkQXQiOiIyMDI2LTA2LTE3VDA5OjAwOjAwWiIsImlkIjoiYWJjMTIzIn0"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Comma-separated sparse-fieldset projection. Supports dot-paths (e.g. \"id,name,channel.handle\")."},"required":false,"name":"fields","in":"query"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Post"}},"next_cursor":{"type":["string","null"]},"total_estimate":{"type":["integer","null"]}},"required":["data","next_cursor","total_estimate"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}},"post":{"operationId":"dashboard.posts.create","tags":["dashboard","posts"],"summary":"Create a post","security":[{"SessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostCreate"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Post"}},"required":["data"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}},"/v1/dashboard/posts/{id}":{"get":{"operationId":"dashboard.posts.get","tags":["dashboard","posts"],"summary":"Get a post","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"8b2c1d4e-4f6a-4c8b-9e0a-1b2c3d4e5f6a"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Post"}},"required":["data"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}},"patch":{"operationId":"dashboard.posts.update","tags":["dashboard","posts"],"summary":"Update a post (partial)","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"8b2c1d4e-4f6a-4c8b-9e0a-1b2c3d4e5f6a"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostUpdate"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Post"}},"required":["data"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}},"delete":{"operationId":"dashboard.posts.delete","tags":["dashboard","posts"],"summary":"Delete a post","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"8b2c1d4e-4f6a-4c8b-9e0a-1b2c3d4e5f6a"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}},"/v1/dashboard/channels/stats":{"get":{"operationId":"dashboard.channels.stats","tags":["dashboard","channels"],"summary":"Channel snapshot stats","security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ChannelSnapshot"}}},"required":["data"]}}}}}}},"/v1/dashboard/insights/summary":{"get":{"operationId":"dashboard.insights.summary","tags":["dashboard","insights"],"summary":"Portfolio insights summary","security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/InsightSummary"}},"required":["data"]}}}}}}},"/v1/dashboard/stats":{"get":{"operationId":"dashboard.stats","tags":["dashboard","insights"],"summary":"Traffic + revenue summary (portfolio or per app)","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":365,"default":30,"description":"Window in days (1–365)"},"required":false,"name":"days","in":"query"},{"schema":{"type":"string","description":"Per-app summary instead of the portfolio"},"required":false,"name":"appId","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/StatsSummary"}},"required":["data"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"501":{"description":"The host has no stats read model","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}},"/v1/dashboard/campaigns/{id}/publish-all":{"post":{"operationId":"dashboard.campaigns.publish_all","tags":["dashboard","campaigns"],"summary":"Publish every approved post in a campaign","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","example":"8b2c1d4e-4f6a-4c8b-9e0a-1b2c3d4e5f6a"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Publish batch result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishAllResult"}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}},"/v1/dashboard/dam/assets":{"get":{"operationId":"dam.assets.list","tags":["dam","assets"],"summary":"List DAM assets","parameters":[{"schema":{"type":"string"},"required":false,"name":"query","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"bundleId","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"campaignId","in":"query"},{"schema":{"type":"string","enum":["image","video","audio","copy","template","prompt","disclaimer","ugc"]},"required":false,"name":"assetType","in":"query"},{"schema":{"type":"integer","exclusiveMinimum":0,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":["integer","null"],"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"assets":{"type":"array","items":{"type":"object","additionalProperties":{}}},"count":{"type":"number"}},"required":["assets","count"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}},"post":{"operationId":"dam.assets.create_upload","tags":["dam","assets"],"summary":"Create an asset and get a signed upload URL","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"bundleId":{"type":"string"},"assetType":{"type":"string","enum":["image","video","audio","copy","template","prompt","disclaimer","ugc"]},"filename":{"type":"string","minLength":1,"maxLength":255},"mimeType":{"type":"string","minLength":1,"maxLength":255},"sizeBytes":{"type":"integer","exclusiveMinimum":0,"maximum":524288000}},"required":["assetType","filename","mimeType"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"},"404":{"description":"Organization not found"}}}},"/v1/dashboard/dam/assets/{id}":{"get":{"operationId":"dam.assets.get","tags":["dam","assets"],"summary":"Fetch one asset","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","exclusiveMinimum":0},"required":false,"name":"version","in":"query"},{"schema":{"type":"string"},"required":false,"name":"download","in":"query"},{"schema":{"type":"string"},"required":false,"name":"thumbnail","in":"query"},{"schema":{"type":"integer","exclusiveMinimum":0},"required":false,"name":"width","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"},"404":{"description":"Not found"}}},"patch":{"operationId":"dam.assets.update","tags":["dam","assets"],"summary":"Confirm an upload or update metadata","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"action":{"type":"string","enum":["confirm_upload"]},"storageKey":{"type":"string","minLength":1},"checksum":{"type":"string"},"metadata":{"type":"object","additionalProperties":{}}},"required":["action","storageKey"]},{"type":"object","properties":{"metadata":{"type":"object","additionalProperties":{}}},"required":["metadata"]}]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"400":{"description":"Invalid storage key or action"},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"},"404":{"description":"Not found"}}},"delete":{"operationId":"dam.assets.delete","tags":["dam","assets"],"summary":"Delete an asset","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"},"404":{"description":"Not found"}}}},"/v1/dashboard/dam/campaigns":{"get":{"operationId":"dam.campaigns.list","tags":["dam","campaigns"],"summary":"List DAM campaigns","parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"brandId","in":"query"},{"schema":{"type":"string","enum":["draft","planned","running","paused","completed"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","exclusiveMinimum":0,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":["integer","null"],"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"campaigns":{"type":"array","items":{"type":"object","additionalProperties":{}}},"count":{"type":"number"}},"required":["campaigns","count"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}},"post":{"operationId":"dam.campaigns.create","tags":["dam","campaigns"],"summary":"Create a DAM campaign","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"marketingAppId":{"type":"string","format":"uuid"},"brandId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"objective":{"type":"string"},"status":{"type":"string","enum":["draft","planned","running","paused","completed"]},"budget":{"type":"number"},"startDate":{"type":"string"},"endDate":{"type":"string"},"targetPersonas":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"}},"required":["name"]}},"kpis":{"type":"object","properties":{"targetCtr":{"type":"number"},"targetRoas":{"type":"number"},"targetConversions":{"type":"number"},"targetImpressions":{"type":"number"}}},"metadata":{"type":"object","additionalProperties":{}}},"required":["brandId","name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"campaign":{"type":"object","additionalProperties":{}}},"required":["campaign"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}}},"/v1/dashboard/dam/campaigns/{id}":{"get":{"operationId":"dam.campaigns.get","tags":["dam","campaigns"],"summary":"Fetch one DAM campaign","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"campaign":{"type":"object","additionalProperties":{}}},"required":["campaign"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"},"404":{"description":"Not found"}}},"patch":{"operationId":"dam.campaigns.update","tags":["dam","campaigns"],"summary":"Update a DAM campaign","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"marketingAppId":{"type":"string","format":"uuid"},"brandId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"objective":{"type":"string"},"status":{"type":"string","enum":["draft","planned","running","paused","completed"]},"budget":{"type":"number"},"startDate":{"type":"string"},"endDate":{"type":"string"},"targetPersonas":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"}},"required":["name"]}},"kpis":{"type":"object","additionalProperties":{}},"metadata":{"type":"object","additionalProperties":{}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"campaign":{"type":"object","additionalProperties":{}}},"required":["campaign"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}},"delete":{"operationId":"dam.campaigns.delete","tags":["dam","campaigns"],"summary":"Delete a DAM campaign","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}}},"/v1/dashboard/dam/missions/templates":{"get":{"operationId":"dam.missions.templates","tags":["dam","missions"],"summary":"List mission templates","parameters":[{"schema":{"type":"string"},"required":false,"name":"type","in":"query"},{"schema":{"type":"string"},"required":false,"name":"id","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"},"404":{"description":"Template not found"}}}},"/v1/dashboard/dam/missions":{"get":{"operationId":"dam.missions.list","tags":["dam","missions"],"summary":"List missions","parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"organizationId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","exclusiveMinimum":0,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":["integer","null"],"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"missions":{"type":"array","items":{"type":"object","additionalProperties":{}}},"count":{"type":"number"}},"required":["missions","count"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}},"post":{"operationId":"dam.missions.create","tags":["dam","missions"],"summary":"Create a mission (does not launch it)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string","format":"uuid"},"missionType":{"type":"string","minLength":1},"objective":{"type":"string","minLength":1},"autonomyLevel":{"type":"string","minLength":1}},"required":["organizationId","missionType","objective","autonomyLevel"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"mission":{"type":"object","additionalProperties":{}}},"required":["mission"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}}},"/v1/dashboard/dam/missions/{id}":{"get":{"operationId":"dam.missions.get","tags":["dam","missions"],"summary":"Fetch one mission","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"withPlan","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"},"404":{"description":"Not found"}}},"patch":{"operationId":"dam.missions.act","tags":["dam","missions"],"summary":"Launch, pause, complete or cancel a mission, or update its fields","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["launch","launch_async","pause","complete","cancel"]},"webhookUrl":{"type":"string","format":"uri"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"400":{"description":"No action or updates provided"},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}}},"/v1/dashboard/dam/missions/{id}/runs":{"get":{"operationId":"dam.missions.runs","tags":["dam","missions"],"summary":"List a mission's runs","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"runs":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["runs"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}}},"/v1/dashboard/dam/documents":{"get":{"operationId":"documents.list","tags":["documents"],"summary":"List the organisation's documents","parameters":[{"schema":{"type":"string","enum":["active","superseded","archived"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["contract","policy","board","financial","correspondence","other"]},"required":false,"name":"docClass","in":"query"},{"schema":{"type":"integer","exclusiveMinimum":0,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":["integer","null"],"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"documents":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["documents"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}},"post":{"operationId":"documents.create","tags":["documents"],"summary":"Create a document record (no bytes yet)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":300},"docClass":{"type":"string","enum":["contract","policy","board","financial","correspondence","other"]},"workspaceId":{"type":["string","null"],"format":"uuid"},"counterparties":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"role":{"type":"string"},"email":{"type":"string","format":"email"}},"required":["name"]}},"metadata":{"type":"object","additionalProperties":{}},"retentionUntil":{"type":["string","null"],"pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["title"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"document":{"type":"object","additionalProperties":{}}},"required":["document"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}}},"/v1/dashboard/dam/documents/{id}":{"get":{"operationId":"documents.get","tags":["documents"],"summary":"Fetch one document with its versions","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"document":{"type":"object","additionalProperties":{}}},"required":["document"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"},"404":{"description":"Not found"}}}},"/v1/dashboard/dam/documents/{id}/versions":{"get":{"operationId":"documents.versions.list","tags":["documents"],"summary":"List a document's versions","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"versions":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["versions"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}},"post":{"operationId":"documents.versions.begin_upload","tags":["documents"],"summary":"Get a presigned PUT for a new version","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mimeType":{"type":"string","minLength":1,"maxLength":255},"byteSize":{"type":"integer","exclusiveMinimum":0,"maximum":2147483648},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"required":["mimeType","byteSize","sha256"]}}}},"responses":{"201":{"description":"Upload slot","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}}},"/v1/dashboard/dam/documents/{id}/versions/confirm":{"post":{"operationId":"documents.versions.confirm","tags":["documents"],"summary":"Confirm an upload","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"uploadId":{"type":"string","format":"uuid"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"byteSize":{"type":"integer","exclusiveMinimum":0},"mimeType":{"type":"string","minLength":1,"maxLength":255},"source":{"type":"string","enum":["upload","generated","signed_copy"]},"note":{"type":["string","null"],"maxLength":2000},"allowDuplicate":{"type":"boolean"}},"required":["uploadId","sha256","byteSize","mimeType"]}}}},"responses":{"201":{"description":"Version recorded","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"object","additionalProperties":{}}},"required":["version"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"},"409":{"description":"Hash mismatch"}}}},"/v1/dashboard/dam/documents/{id}/versions/{n}/download":{"get":{"operationId":"documents.versions.download","tags":["documents"],"summary":"A 5-minute signed download URL for one version","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","exclusiveMinimum":0},"required":true,"name":"n","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"},"404":{"description":"Not found"}}}},"/v1/dashboard/dam/documents/{id}/events":{"get":{"operationId":"documents.events","tags":["documents"],"summary":"The hash-chained access and decision log","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["events"]}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"}}}},"/v1/dashboard/dam/documents/{id}/actions":{"post":{"operationId":"documents.actions","tags":["documents"],"summary":"verify / approve / reject / hold / release_hold / extend_retention / archive","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"action":{"type":"string","enum":["verify"]}},"required":["action"]},{"type":"object","properties":{"action":{"type":"string","enum":["approve"]},"note":{"type":"string","maxLength":2000}},"required":["action"]},{"type":"object","properties":{"action":{"type":"string","enum":["reject"]},"reason":{"type":"string","minLength":1,"maxLength":2000}},"required":["action","reason"]},{"type":"object","properties":{"action":{"type":"string","enum":["hold"]},"reason":{"type":"string","minLength":1,"maxLength":2000}},"required":["action","reason"]},{"type":"object","properties":{"action":{"type":"string","enum":["release_hold"]},"reason":{"type":"string","minLength":1,"maxLength":2000}},"required":["action","reason"]},{"type":"object","properties":{"action":{"type":"string","enum":["extend_retention"]},"until":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["action","until"]},{"type":"object","properties":{"action":{"type":"string","enum":["archive"]},"reason":{"type":"string","maxLength":2000}},"required":["action"]}]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"401":{"description":"Unauthorized"},"403":{"description":"Insufficient scope"},"409":{"description":"Rule violation (self-approval, hold set by you, …)"}}}},"/v1/dashboard/cms/posts/{id}/translate":{"post":{"operationId":"cms.posts.translate","tags":["cms"],"summary":"Submit a single-locale CMS post re-translation","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["0","1"],"description":"Set to \"1\" to overwrite an existing manual override."},"required":false,"name":"force","in":"query"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"locale":{"type":"string","minLength":2}},"required":["locale"]}}}},"responses":{"202":{"description":"Translation submitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TranslateSubmission"}}}},"400":{"description":"Unsupported locale","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"401":{"description":"Unauthenticated"},"404":{"description":"Post not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"409":{"description":"Manual override in place (and force not set), or the submission was skipped","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"422":{"description":"Validation error"},"502":{"description":"Upstream translation failure","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/v1/dashboard/cms/posts/{id}/translate-content":{"post":{"operationId":"cms.posts.translate_content","tags":["cms"],"summary":"Store a manual translation override","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"locale":{"type":"string","minLength":2},"field":{"type":"string","minLength":1,"default":"body"},"content":{"type":"object","additionalProperties":{}}},"required":["locale","content"]}}}},"responses":{"200":{"description":"Manual override stored","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":{}}},"required":["data"]}}}},"401":{"description":"Unauthenticated"},"404":{"description":"Post not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}},"422":{"description":"Validation error"}}}},"/v1/dashboard/webhooks/i18n-os":{"post":{"operationId":"webhooks.i18n_os","tags":["webhooks","internal"],"summary":"i18n-os async translation completion callback","security":[{"I18nSignature":[],"I18nTimestamp":[]}],"responses":{"200":{"description":"Webhook applied (or dropped: manual / stale / schema_failed)"},"401":{"description":"Invalid signature, missing headers, or expired timestamp"},"500":{"description":"Database/mirror write failure or missing I18N_OS_WEBHOOK_SECRET"}}}},"/v1/newsletter/newsletters":{"get":{"operationId":"newsletter.newsletters.list","tags":["newsletter"],"summary":"List newsletters","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Filter by newsletter id"},"required":false,"name":"newsletter_id","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Newsletter"}}},"required":["data"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}},"/v1/newsletter/subscribers":{"get":{"operationId":"newsletter.subscribers.list","tags":["newsletter"],"summary":"List subscribers","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Filter by newsletter id"},"required":false,"name":"newsletter_id","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["active","pending","unsubscribed","bounced","complained"]},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/NewsletterSubscriber"}}},"required":["data"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}},"post":{"operationId":"newsletter.subscribers.add","tags":["newsletter"],"summary":"Add a subscriber to a newsletter","security":[{"SessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"newsletter_id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"source":{"type":"string","enum":["form","import","api"],"default":"api"},"status":{"type":"string","enum":["active","pending","unsubscribed","bounced","complained"],"default":"active"}},"required":["newsletter_id","email"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/NewsletterSubscriber"}},"required":["data"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}},"/v1/newsletter/subscribers/{id}":{"delete":{"operationId":"newsletter.subscribers.remove","tags":["newsletter"],"summary":"Remove a subscriber","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}},"/v1/newsletter/campaigns":{"get":{"operationId":"newsletter.campaigns.list","tags":["newsletter"],"summary":"List campaigns","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid","description":"Filter by newsletter id"},"required":false,"name":"newsletter_id","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["draft","scheduled","sending","sent","failed"]},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/NewsletterCampaign"}}},"required":["data"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}},"post":{"operationId":"newsletter.campaigns.create","tags":["newsletter"],"summary":"Create a campaign","security":[{"SessionCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"newsletter_id":{"type":"string","format":"uuid"},"subject":{"type":"string","minLength":1},"content":{"type":"string","default":""},"preview_text":{"type":"string","default":""},"status":{"type":"string","enum":["draft","scheduled"],"default":"draft"},"scheduled_at":{"type":"string","format":"date-time"}},"required":["newsletter_id","subject"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/NewsletterCampaign"}},"required":["data"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}},"/v1/newsletter/campaigns/{id}/send":{"post":{"operationId":"newsletter.campaigns.send","tags":["newsletter"],"summary":"Send a campaign now","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Queued","content":{"application/json":{"schema":{"type":"object","properties":{"campaign_id":{"type":"string","format":"uuid"},"subject":{"type":"string"},"recipients":{"type":"integer"},"from_email":{"type":["string","null"]},"status":{"type":"string","enum":["queued"]}},"required":["campaign_id","subject","recipients","from_email","status"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"409":{"description":"No active subscribers","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}},"/v1/newsletter/campaigns/{id}/schedule":{"post":{"operationId":"newsletter.campaigns.schedule","tags":["newsletter"],"summary":"Schedule a campaign","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"scheduled_at":{"type":"string","format":"date-time"}},"required":["scheduled_at"]}}}},"responses":{"200":{"description":"Scheduled","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/NewsletterCampaign"}},"required":["data"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}},"/v1/newsletter/campaigns/{id}/preview":{"get":{"operationId":"newsletter.issues.preview","tags":["newsletter"],"summary":"Preview a campaign issue","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"issue":{"type":"object","properties":{"subject":{"type":"string"},"content":{"type":"string"}},"required":["subject","content"]}},"required":["issue"]}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}},"/v1/newsletter/analytics":{"get":{"operationId":"newsletter.analytics.summary","tags":["newsletter"],"summary":"Newsletter analytics summary","security":[{"SessionCookie":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"newsletter_id","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewsletterAnalytics"}}}},"401":{"description":"Sign in required","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Problem"},{"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string","pattern":"^01H[A-Z2-7]{22}$","example":"01HABCDEFGHJKMNPQRSTVWX"},"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}}}]}}}}}}}}}