{"openapi":"3.0.0","info":{"title":"Pile","version":"0.1.0","description":"Agent-native issue tracker on Cloudflare Workers."},"components":{"schemas":{"Issue":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"externalRef":{"type":"string","nullable":true},"teamId":{"type":"string"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"resolution":{"type":"string","nullable":true,"enum":["duplicate","not_planned","intended_behavior","not_reproducible","obsolete","resolved",null]},"parentId":{"type":"string","nullable":true},"subIssueSortOrder":{"type":"number","nullable":true},"estimate":{"type":"number","nullable":true},"isDraft":{"type":"boolean"},"snoozedUntil":{"type":"string","nullable":true},"assigneeId":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"cycleId":{"type":"string","nullable":true},"labelIds":{"type":"string","nullable":true},"number":{"type":"number","nullable":true},"identifier":{"type":"string","nullable":true},"repo":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"prCheckState":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","externalRef","teamId","title","description","status","priority","resolution","parentId","subIssueSortOrder","estimate","isDraft","snoozedUntil","assigneeId","projectId","cycleId","labelIds","number","identifier","repo","branch","prUrl","prState","prCheckState","createdAt","updatedAt"]},"CreatedIssue":{"allOf":[{"$ref":"#/components/schemas/Issue"},{"type":"object","properties":{"possibleDuplicates":{"type":"array","items":{"$ref":"#/components/schemas/PossibleDuplicate"}}},"required":["possibleDuplicates"]}]},"PossibleDuplicate":{"type":"object","properties":{"id":{"type":"string"},"identifier":{"type":"string","nullable":true},"title":{"type":"string"},"status":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"score":{"type":"number","description":"Share of significant title terms in common with the new title (0-1)"}},"required":["id","identifier","title","status","score"]},"DuplicateConflictError":{"type":"object","properties":{"code":{"type":"string","enum":["CONFLICT"]},"message":{"type":"string"},"hint":{"type":"string"},"details":{"type":"object","properties":{"possibleDuplicates":{"type":"array","items":{"$ref":"#/components/schemas/PossibleDuplicate"}}},"required":["possibleDuplicates"]}},"required":["code","message","hint","details"]}},"parameters":{}},"paths":{"/workspaces":{"post":{"tags":["workspaces"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"key":{"type":"string"}},"required":["name","slug"]}}}},"responses":{"201":{"description":"Workspace created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"key":{"type":"string","nullable":true},"ownerId":{"type":"string"},"defaultTeamId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","slug","key","ownerId","defaultTeamId","createdAt","updatedAt"]}}}}}},"get":{"tags":["workspaces"],"responses":{"200":{"description":"Workspaces list","content":{"application/json":{"schema":{"type":"object","properties":{"workspaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"key":{"type":"string","nullable":true},"ownerId":{"type":"string"},"defaultTeamId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","slug","key","ownerId","defaultTeamId","createdAt","updatedAt"]}}},"required":["workspaces"]}}}}}}},"/workspaces/{id}":{"get":{"tags":["workspaces"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Workspace","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"key":{"type":"string","nullable":true},"ownerId":{"type":"string"},"defaultTeamId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","slug","key","ownerId","defaultTeamId","createdAt","updatedAt"]}}}}}},"patch":{"tags":["workspaces"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ssoEnforced":{"type":"boolean"},"defaultTeamId":{"type":"string","minLength":1,"description":"Team that receives issues created without a teamId. The previous default team becomes deletable."}}}}}},"responses":{"200":{"description":"Workspace updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"key":{"type":"string","nullable":true},"ownerId":{"type":"string"},"defaultTeamId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","slug","key","ownerId","defaultTeamId","createdAt","updatedAt"]}}}},"403":{"description":"Requires owner or admin role in the workspace"},"404":{"description":"Workspace or default team not found"}}},"delete":{"tags":["workspaces"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Workspace permanently deleted — every org-scoped D1 row, all R2 attachment objects, and the workspace Durable Object's storage.","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"},"r2Objects":{"type":"number"}},"required":["deleted","r2Objects"]}}}},"403":{"description":"Requires owner or admin role in the workspace"},"404":{"description":"Workspace not found"}}}},"/workspaces/slug/{slug}":{"get":{"tags":["workspaces"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"Workspace","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"key":{"type":"string","nullable":true},"ownerId":{"type":"string"},"defaultTeamId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","slug","key","ownerId","defaultTeamId","createdAt","updatedAt"]}}}}}}},"/workspaces/onboard":{"post":{"tags":["workspaces"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"slug":{"type":"string","minLength":1},"key":{"type":"string"}},"required":["name","slug"]}}}},"responses":{"201":{"description":"Workspace onboarded with default team and admin token","content":{"application/json":{"schema":{"type":"object","properties":{"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"key":{"type":"string","nullable":true},"ownerId":{"type":"string"},"defaultTeamId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","slug","key","ownerId","defaultTeamId","createdAt","updatedAt"]},"team":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"ownerId":{"type":"string"},"isDefault":{"type":"boolean"},"isPublic":{"type":"boolean"},"parentAutoClose":{"type":"boolean"},"triageAssigneeId":{"type":"string","nullable":true},"defaultTemplateId":{"type":"string","nullable":true},"subIssueAutoClose":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","name","ownerId","isDefault","isPublic","parentAutoClose","triageAssigneeId","defaultTemplateId","subIssueAutoClose","createdAt","updatedAt"]},"token":{"type":"string"}},"required":["workspace","team","token"]}}}}}}},"/workspaces/{organizationId}/scim/connections":{"post":{"tags":["scim"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"scopes":{"type":"array","items":{"type":"string","enum":["scim.users.read","scim.users.write","scim.groups.read","scim.groups.write"]},"minItems":1},"expiresInDays":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":365}}}}}},"responses":{"201":{"description":"SCIM connection created — the bearer token is returned once and is not recoverable later.","content":{"application/json":{"schema":{"type":"object","properties":{"connectionId":{"type":"string"},"provisioningDomainId":{"type":"string"},"token":{"type":"string"},"baseUrl":{"type":"string"}},"required":["connectionId","provisioningDomainId","token","baseUrl"]}}}},"403":{"description":"Requires owner or admin role in the workspace"}}},"get":{"tags":["scim"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"SCIM connections for the workspace","content":{"application/json":{"schema":{"type":"object","properties":{"connections":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string"},"status":{"type":"string"},"createdAt":{"type":"string"}},"required":["connectionId","status","createdAt"]}}},"required":["connections"]}}}},"403":{"description":"Requires owner or admin role in the workspace"}}}},"/workspaces/{organizationId}/tokens":{"get":{"tags":["tokens"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Token list","content":{"application/json":{"schema":{"type":"object","properties":{"tokens":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"permissions":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","permissions","createdAt"]}}},"required":["tokens"]}}}}}},"post":{"tags":["tokens"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"permissions":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"actorType":{"type":"string","enum":["user","agent"]},"provider":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"Token created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"token":{"type":"string"},"permissions":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","token","permissions","createdAt"]}}}}}}},"/workspaces/{organizationId}/tokens/{id}":{"delete":{"tags":["tokens"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Token deleted"}}}},"/workspaces/{organizationId}/oauth-clients":{"get":{"tags":["oauth-clients"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"OAuth clients list","content":{"application/json":{"schema":{"type":"object","properties":{"clients":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"redirectUris":{"type":"array","items":{"type":"string"}},"scopes":{"type":"array","items":{"type":"string"}},"permissions":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","redirectUris","scopes","permissions","createdAt"]}}},"required":["clients"]}}}}}},"post":{"tags":["oauth-clients"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"redirectUris":{"type":"array","items":{"type":"string","format":"uri"},"default":[]},"scopes":{"type":"array","items":{"type":"string"},"default":[]},"permissions":{"type":"string","default":"read"}},"required":["name"]}}}},"responses":{"201":{"description":"OAuth client created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"redirectUris":{"type":"array","items":{"type":"string"}},"scopes":{"type":"array","items":{"type":"string"}},"permissions":{"type":"string"},"createdAt":{"type":"string"},"clientId":{"type":"string"},"clientSecret":{"type":"string"}},"required":["id","organizationId","name","redirectUris","scopes","permissions","createdAt","clientId","clientSecret"]}}}}}}},"/workspaces/{organizationId}/oauth-clients/{id}":{"get":{"tags":["oauth-clients"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OAuth client","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"redirectUris":{"type":"array","items":{"type":"string"}},"scopes":{"type":"array","items":{"type":"string"}},"permissions":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","redirectUris","scopes","permissions","createdAt"]}}}},"404":{"description":"OAuth client not found"}}},"patch":{"tags":["oauth-clients"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"redirectUris":{"type":"array","items":{"type":"string","format":"uri"}},"scopes":{"type":"array","items":{"type":"string"}},"permissions":{"type":"string"}}}}}},"responses":{"200":{"description":"OAuth client updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"redirectUris":{"type":"array","items":{"type":"string"}},"scopes":{"type":"array","items":{"type":"string"}},"permissions":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","redirectUris","scopes","permissions","createdAt"]}}}},"404":{"description":"OAuth client not found"}}},"delete":{"tags":["oauth-clients"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"OAuth client deleted"}}}},"/workspaces/{organizationId}/issues":{"get":{"tags":["issues"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"integer","nullable":true,"minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string"},"required":false,"name":"teamId","in":"query"},{"schema":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["low","medium","high","urgent"]},"required":false,"name":"priority","in":"query"},{"schema":{"type":"string"},"required":false,"name":"parentId","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"hasParent","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"isParent","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"isDraft","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"includeSnoozed","in":"query"},{"schema":{"type":"string"},"required":false,"name":"assigneeId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"projectId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cycleId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"labelId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"search","in":"query"},{"schema":{"type":"string"},"required":false,"name":"identifier","in":"query"},{"schema":{"type":"string"},"required":false,"name":"externalRef","in":"query"},{"schema":{"type":"string"},"required":false,"name":"view","in":"query"}],"responses":{"200":{"description":"Issues list","content":{"application/json":{"schema":{"type":"object","properties":{"issues":{"type":"array","items":{"$ref":"#/components/schemas/Issue"}},"nextCursor":{"type":"string"}},"required":["issues"]}}}}}},"post":{"tags":["issues"],"description":"The 201 response includes possibleDuplicates: open issues (in teams you can see) whose titles closely match, best first. Non-blocking — if one is the same work, comment on or update it instead of keeping the new issue. Pass dedupe=block to get 409 with the matches in details.possibleDuplicates instead of creating.","parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","enum":["warn","block"],"description":"warn (default): create and return possibleDuplicates; block: 409 when any possible duplicate exists"},"required":false,"description":"warn (default): create and return possibleDuplicates; block: 409 when any possible duplicate exists","name":"dedupe","in":"query"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"externalRef":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"teamId":{"type":"string"},"teamKey":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"resolution":{"type":"string","nullable":true,"enum":["duplicate","not_planned","intended_behavior","not_reproducible","obsolete","resolved",null]},"parentId":{"type":"string","nullable":true},"subIssueSortOrder":{"type":"number","nullable":true},"estimate":{"type":"integer","nullable":true,"minimum":0},"isDraft":{"type":"boolean"},"templateId":{"type":"string"},"snoozedUntil":{"type":"string","nullable":true},"assigneeId":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"cycleId":{"type":"string","nullable":true},"labelIds":{"type":"array","nullable":true,"items":{"type":"string"}},"repo":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true}},"required":["title"]}}}},"responses":{"200":{"description":"Existing issue with the same externalRef (idempotent create)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Issue"}}}},"201":{"description":"Issue created, with possible duplicates to review","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedIssue"}}}},"409":{"description":"dedupe=block and possible duplicates exist (details.possibleDuplicates)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DuplicateConflictError"}}}}}}},"/workspaces/{organizationId}/triage":{"get":{"tags":["issues"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"integer","nullable":true,"minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string"},"required":false,"name":"teamId","in":"query"},{"schema":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["low","medium","high","urgent"]},"required":false,"name":"priority","in":"query"},{"schema":{"type":"string"},"required":false,"name":"parentId","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"hasParent","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"isParent","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"isDraft","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"includeSnoozed","in":"query"},{"schema":{"type":"string"},"required":false,"name":"assigneeId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"projectId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cycleId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"labelId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"search","in":"query"},{"schema":{"type":"string"},"required":false,"name":"identifier","in":"query"},{"schema":{"type":"string"},"required":false,"name":"externalRef","in":"query"},{"schema":{"type":"string"},"required":false,"name":"view","in":"query"}],"responses":{"200":{"description":"Triage inbox: issues awaiting triage","content":{"application/json":{"schema":{"type":"object","properties":{"issues":{"type":"array","items":{"$ref":"#/components/schemas/Issue"}},"nextCursor":{"type":"string"}},"required":["issues"]}}}}}}},"/workspaces/{organizationId}/issues/{id}/branch-name":{"get":{"tags":["issues"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Suggested branch name","content":{"application/json":{"schema":{"type":"object","properties":{"branchName":{"type":"string"}},"required":["branchName"]}}}},"404":{"description":"Issue not found"}}}},"/workspaces/{organizationId}/issue-analytics":{"get":{"tags":["issues"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","enum":["status","priority","assigneeId","teamId","projectId","cycleId"],"default":"status"},"required":false,"name":"groupBy","in":"query"}],"responses":{"200":{"description":"Issue counts and estimate totals grouped by a field","content":{"application/json":{"schema":{"type":"object","properties":{"groups":{"type":"array","items":{"type":"object","properties":{"group":{"type":"string","nullable":true},"count":{"type":"number"},"estimateTotal":{"type":"number"}},"required":["group","count","estimateTotal"]}}},"required":["groups"]}}}}}}},"/workspaces/{organizationId}/issue-analytics/burndown":{"get":{"tags":["issues"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"cycleId","in":"query"}],"responses":{"200":{"description":"Daily scope/remaining burndown series for a cycle","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"number"},"totalEstimate":{"type":"number"},"series":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"scope":{"type":"number"},"remaining":{"type":"number"}},"required":["date","scope","remaining"]}}},"required":["total","totalEstimate","series"]}}}}}}},"/workspaces/{organizationId}/capture":{"post":{"tags":["capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"title":{"type":"string","minLength":1},"selection":{"type":"string"},"source":{"type":"string"},"teamId":{"type":"string"},"teamKey":{"type":"string"},"projectId":{"type":"string"},"labelIds":{"type":"array","items":{"type":"string"}},"pageText":{"type":"string"},"includeFullText":{"type":"boolean"},"summarize":{"type":"boolean"},"screenshot":{"type":"object","properties":{"contentBase64":{"type":"string","minLength":1},"contentType":{"type":"string","pattern":"^image\\/(png|jpeg|webp)$","default":"image/png"}},"required":["contentBase64"]}},"required":["url"]}}}},"responses":{"201":{"description":"Captured issue created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Issue"}}}}}}},"/workspaces/{organizationId}/issues/{id}":{"get":{"tags":["issues"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Issue","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Issue"}}}}}},"patch":{"tags":["issues"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"externalRef":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"teamId":{"type":"string"},"teamKey":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"resolution":{"type":"string","nullable":true,"enum":["duplicate","not_planned","intended_behavior","not_reproducible","obsolete","resolved",null]},"parentId":{"type":"string","nullable":true},"subIssueSortOrder":{"type":"number","nullable":true},"estimate":{"type":"integer","nullable":true,"minimum":0},"isDraft":{"type":"boolean"},"templateId":{"type":"string"},"snoozedUntil":{"type":"string","nullable":true},"assigneeId":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"cycleId":{"type":"string","nullable":true},"labelIds":{"type":"array","nullable":true,"items":{"type":"string"}},"repo":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true,"format":"uri"},"prState":{"type":"string","nullable":true,"enum":["draft","open","merged","closed",null]}}}}}},"responses":{"200":{"description":"Issue updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Issue"}}}}}},"delete":{"tags":["issues"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Issue deleted"}}}},"/workspaces/{organizationId}/issues/{id}/permissions":{"get":{"tags":["issues"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Access grants for this issue","content":{"application/json":{"schema":{"type":"object","properties":{"permissions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","issueId","actorId","actorType","createdAt"]}}},"required":["permissions"]}}}},"404":{"description":"Issue not found"}}},"put":{"tags":["issues"],"description":"Grant an actor access to this issue. The first grant restricts the issue to listed actors + workspace admins; revoking the last grant reopens it.","parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"actorId":{"type":"string","minLength":1},"actorType":{"type":"string","enum":["user","agent","team"]}},"required":["actorId"]}}}},"responses":{"200":{"description":"Permission set","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","issueId","actorId","actorType","createdAt"]}}}},"404":{"description":"Issue not found"}}}},"/workspaces/{organizationId}/issues/{id}/permissions/{actorId}":{"delete":{"tags":["issues"],"description":"Revoke an actor's access grant. When the last grant is removed the issue is open to the workspace again.","parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"actorId","in":"path"}],"responses":{"204":{"description":"Permission revoked"},"404":{"description":"Issue not found"}}}},"/workspaces/{organizationId}/issues/{id}/children":{"get":{"tags":["issues"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Issue children","content":{"application/json":{"schema":{"type":"object","properties":{"issues":{"type":"array","items":{"$ref":"#/components/schemas/Issue"}}},"required":["issues"]}}}}}}},"/workspaces/{organizationId}/issues/{id}/similar":{"get":{"tags":["issues"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":50},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Issues whose title/description best match this issue (BM25 over the workspace search index), best first","content":{"application/json":{"schema":{"type":"object","properties":{"similar":{"type":"array","items":{"type":"object","properties":{"issue":{"$ref":"#/components/schemas/Issue"},"score":{"type":"number"}},"required":["issue","score"]}}},"required":["similar"]}}}}}}},"/workspaces/{organizationId}/issues/batch":{"post":{"tags":["issues"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"maxItems":100},"patch":{"type":"object","properties":{"title":{"type":"string","minLength":1},"externalRef":{"type":"string","nullable":true,"minLength":1,"maxLength":255},"teamId":{"type":"string"},"teamKey":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"resolution":{"type":"string","nullable":true,"enum":["duplicate","not_planned","intended_behavior","not_reproducible","obsolete","resolved",null]},"parentId":{"type":"string","nullable":true},"subIssueSortOrder":{"type":"number","nullable":true},"estimate":{"type":"integer","nullable":true,"minimum":0},"isDraft":{"type":"boolean"},"templateId":{"type":"string"},"snoozedUntil":{"type":"string","nullable":true},"assigneeId":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"cycleId":{"type":"string","nullable":true},"labelIds":{"type":"array","nullable":true,"items":{"type":"string"}},"repo":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true,"format":"uri"},"prState":{"type":"string","nullable":true,"enum":["draft","open","merged","closed",null]}}}},"required":["ids","patch"]}}}},"responses":{"200":{"description":"Issues updated","content":{"application/json":{"schema":{"type":"object","properties":{"issues":{"type":"array","items":{"$ref":"#/components/schemas/Issue"}}},"required":["issues"]}}}}}}},"/workspaces/{organizationId}/issues/{id}/dispatch":{"post":{"tags":["agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"type":"string"},"provider":{"type":"string"},"model":{"type":"string"},"repo":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"instructions":{"type":"string"},"preflight":{"type":"boolean"},"secondaryRepos":{"type":"array","items":{"type":"object","properties":{"repo":{"type":"string","pattern":"^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$"},"access":{"type":"string","enum":["read","write"],"default":"read"}},"required":["repo"],"additionalProperties":false},"maxItems":5},"mode":{"type":"string","enum":["build","plan","implement_plan"]},"effort":{"type":"string","enum":["low","medium","high","max"]},"maxDuration":{"type":"integer","minimum":1,"maximum":1440,"description":"Wall-clock run budget in minutes; past it the lane is canceled and escalated on the issue"},"resultSchema":{"anyOf":[{"type":"string","enum":["lane"]},{"type":"object","additionalProperties":{"nullable":true}}],"description":"JSON Schema (draft-07) the lane's final output must validate against, or \"lane\" for the built-in {verdict, summary, filesChanged} shape. The validated value lands on session.structuredResult."}},"additionalProperties":false}}}},"responses":{"201":{"description":"Session created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}},"preflight":{"type":"object","properties":{"ready":{"type":"boolean"},"missing":{"type":"array","items":{"type":"string"}}},"required":["ready","missing"]}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt","preflight"]}}}}}}},"/workspaces/{organizationId}/issues/{id}/assign":{"post":{"tags":["issues"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"assigneeId":{"type":"string","nullable":true}},"required":["assigneeId"]}}}},"responses":{"200":{"description":"Issue assigned","content":{"application/json":{"schema":{"type":"object","properties":{"issue":{"$ref":"#/components/schemas/Issue"},"session":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt"]}},"required":["issue"]}}}}}}},"/workspaces/{organizationId}/agent/sessions/register":{"post":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"issueId":{"type":"string"},"provider":{"type":"string","minLength":1},"providerSessionId":{"type":"string"},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"url":{"type":"string"},"branch":{"type":"string"},"prUrl":{"type":"string"}},"required":["issueId","provider"],"additionalProperties":false}}}},"responses":{"200":{"description":"Session already registered (providerSessionId dedupe)","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt"]},"laneToken":{"type":"string","nullable":true},"logUrl":{"type":"string","nullable":true},"reportUrl":{"type":"string","nullable":true},"mcpUrl":{"type":"string","nullable":true}},"required":["session","laneToken","logUrl","reportUrl","mcpUrl"]}}}},"201":{"description":"Session registered","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt"]},"laneToken":{"type":"string","nullable":true},"logUrl":{"type":"string","nullable":true},"reportUrl":{"type":"string","nullable":true},"mcpUrl":{"type":"string","nullable":true}},"required":["session","laneToken","logUrl","reportUrl","mcpUrl"]}}}},"404":{"description":"Issue not found"}}}},"/workspaces/{organizationId}/agent/dispatch-batch":{"post":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"issueId":{"type":"string","minLength":1},"agentId":{"type":"string"},"branch":{"type":"string","nullable":true},"instructions":{"type":"string"},"queuedAfter":{"type":"string"},"secondaryRepos":{"type":"array","items":{"type":"object","properties":{"repo":{"type":"string","pattern":"^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$"},"access":{"type":"string","enum":["read","write"],"default":"read"}},"required":["repo"],"additionalProperties":false},"maxItems":5},"effort":{"type":"string","enum":["low","medium","high","max"]},"maxDuration":{"type":"integer","minimum":1,"maximum":1440,"description":"Wall-clock run budget in minutes; past it the lane is canceled and escalated on the issue"},"resultSchema":{"anyOf":[{"type":"string","enum":["lane"]},{"type":"object","additionalProperties":{"nullable":true}}],"description":"JSON Schema (draft-07) the lane's final output must validate against, or \"lane\" for the built-in {verdict, summary, filesChanged} shape. The validated value lands on session.structuredResult."}},"required":["issueId"],"additionalProperties":false},"minItems":1,"maxItems":50}},"required":["items"],"additionalProperties":false}}}},"responses":{"200":{"description":"Per-item dispatch results — each entry carries a sessionId or an error, independent of sibling failures","content":{"application/json":{"schema":{"type":"object","properties":{"batchId":{"type":"string"},"results":{"type":"array","items":{"type":"object","properties":{"issueId":{"type":"string"},"sessionId":{"type":"string","nullable":true},"status":{"type":"string","nullable":true,"enum":["created","running","waiting","completed","failed","canceled",null]},"error":{"type":"string","nullable":true}},"required":["issueId","sessionId","status","error"]}}},"required":["batchId","results"]}}}}}}},"/workspaces/{organizationId}/agent/sessions":{"get":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"issueId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"summary","in":"query"}],"responses":{"200":{"description":"Agent sessions list. Pass `?summary=1` for lane-row scalars only (no result/activity blobs) — the shape `pile fleet` polls.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"sessions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt"]}}},"required":["sessions"]},{"type":"object","properties":{"sessions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"label":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true}},"required":["id","issueId","agentId","provider","status","prUrl","prState","createdAt","updatedAt","startedAt","endedAt"]}}},"required":["sessions"]}]}}}}}}},"/workspaces/{organizationId}/agent/stats":{"get":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Aggregate agent session stats for the workspace: totals, per-provider breakdown, success rate, durations, and infra failures","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"number"},"byStatus":{"type":"object","additionalProperties":{"type":"number"}},"infraFailures":{"type":"number"},"avgDurationSeconds":{"type":"number","nullable":true},"providers":{"type":"array","items":{"type":"object","properties":{"agentId":{"type":"string"},"total":{"type":"number"},"completed":{"type":"number"},"failed":{"type":"number"},"successRate":{"type":"number","nullable":true},"avgDurationSeconds":{"type":"number","nullable":true}},"required":["agentId","total","completed","failed","successRate","avgDurationSeconds"]}}},"required":["total","byStatus","infraFailures","avgDurationSeconds","providers"]}}}}}}},"/workspaces/{organizationId}/agent/fleet-health":{"get":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Fleet health: live lanes, kept sandboxes per provider, endedAt gaps, infra failure streaks","content":{"application/json":{"schema":{"type":"object","properties":{"live":{"type":"number"},"missingEndedAt":{"type":"number"},"providers":{"type":"array","items":{"type":"object","properties":{"agentId":{"type":"string"},"live":{"type":"number"},"keptSandboxes":{"type":"number"},"infraStreak":{"type":"number"},"unhealthy":{"type":"boolean"}},"required":["agentId","live","keptSandboxes","infraStreak","unhealthy"]}}},"required":["live","missingEndedAt","providers"]}}}}}}},"/workspaces/{organizationId}/issues/{issueId}/live":{"get":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"responses":{"200":{"description":"Live agent state for issue","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"type":"object","nullable":true,"properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt"]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["session","activities"]}}}}}}},"/workspaces/{organizationId}/agent/sessions/{sessionId}":{"get":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"summary","in":"query"}],"responses":{"200":{"description":"Agent session with activities. Pass `?summary=1` for lane-row scalars only.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt"]},{"type":"object","properties":{"id":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"label":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true}},"required":["id","issueId","agentId","provider","status","prUrl","prState","createdAt","updatedAt","startedAt","endedAt"]}]}}}},"404":{"description":"Session not found"}}},"patch":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string"},"url":{"type":"string"},"prUrl":{"type":"string"},"prState":{"type":"string"},"branch":{"type":"string"}}}}}},"responses":{"200":{"description":"Session updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt"]}}}},"404":{"description":"Session not found"}}}},"/workspaces/{organizationId}/agent/sessions/{sessionId}/events":{"get":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Agent session events","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"},"kind":{"type":"string","enum":["activity"]}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt","kind"]},{"type":"object","properties":{"kind":{"type":"string","enum":["event"]},"id":{"type":"number"},"sessionId":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"payload":{"nullable":true},"createdAt":{"type":"string"}},"required":["kind","id","sessionId","type","message","createdAt"]}]}}},"required":["events"]}}}},"404":{"description":"Session not found"}}}},"/workspaces/{organizationId}/agent/sessions/{sessionId}/checks":{"get":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"}],"responses":{"200":{"description":"CI check-runs for the session's pull request","content":{"application/json":{"schema":{"type":"object","properties":{"checks":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"status":{"type":"string"},"conclusion":{"type":"string","nullable":true},"detailsUrl":{"type":"string","nullable":true},"htmlUrl":{"type":"string","nullable":true}},"required":["name","status","conclusion","detailsUrl","htmlUrl"]}},"prCheckState":{"type":"string","nullable":true}},"required":["checks","prCheckState"]}}}},"400":{"description":"Session prUrl is not a GitHub PR"},"404":{"description":"Session not found"},"502":{"description":"GitHub lookup failed"}}}},"/workspaces/{organizationId}/agent/sessions/{sessionId}/activities":{"post":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string","minLength":1},"payload":{"type":"object","additionalProperties":{"nullable":true}},"parentId":{"type":"string"},"startedAt":{"type":"string"},"endedAt":{"type":"string"},"durationMs":{"type":"number"}},"required":["type","message"]}}}},"responses":{"201":{"description":"Activity added","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}}},"404":{"description":"Session not found"}}}},"/workspaces/{organizationId}/agent/sessions/{sessionId}/artifacts":{"post":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"type":{"type":"string","enum":["diff","log","screenshot","trace","output","other"]},"content":{"type":"string"},"data":{"type":"string"},"mimeType":{"type":"string"},"url":{"type":"string"}},"required":["name","type"]}}}},"responses":{"201":{"description":"Artifact captured","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}}},"404":{"description":"Session not found"}}}},"/workspaces/{organizationId}/agent/sessions/{sessionId}/cancel":{"post":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"}],"responses":{"200":{"description":"Session canceled","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt"]}}}},"404":{"description":"Session not found"}}}},"/workspaces/{organizationId}/agent/sessions/{sessionId}/poll":{"post":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"}],"responses":{"200":{"description":"Session polled and updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt"]}}}},"404":{"description":"Session not found"}}}},"/workspaces/{organizationId}/agent/sessions/{sessionId}/state":{"get":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"}],"responses":{"200":{"description":"Live agent session state from provider and compute","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt"]},"provider":{"nullable":true},"compute":{"nullable":true}},"required":["session"]}}}},"400":{"description":"Not supported for this agent or not configured"},"404":{"description":"Session not found"}}}},"/workspaces/{organizationId}/agent/sessions/{sessionId}/children":{"post":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"description":{"type":"string"},"agentId":{"type":"string"},"model":{"type":"string"},"repo":{"type":"string"},"effort":{"type":"string","enum":["low","medium","high","max"]},"maxDuration":{"type":"integer","minimum":1,"maximum":1440,"description":"Wall-clock run budget in minutes; past it the lane is canceled and escalated on the issue"}},"required":["title"]}}}},"responses":{"201":{"description":"Child session created and dispatched","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt"]},"issue":{"type":"object","properties":{"id":{"type":"string"},"identifier":{"type":"string","nullable":true},"title":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"priority":{"type":"string"},"repo":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"parentId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","identifier","title","description","status","priority","repo","branch","parentId","createdAt","updatedAt"]}},"required":["session","issue"]}}}},"400":{"description":"Bad request"},"404":{"description":"Session or parent issue not found"},"429":{"description":"Too many active child sessions"}}}},"/workspaces/{organizationId}/agent/sessions/{sessionId}/prompt":{"post":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"prompt":{"type":"string","minLength":1}},"required":["prompt"],"additionalProperties":false}}}},"responses":{"200":{"description":"Follow-up delivered to the live sandbox","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt"]}}}},"404":{"description":"Session not found"},"409":{"description":"Sandbox gone or busy — use the retry route for a cold dispatch"}}}},"/workspaces/{organizationId}/agent/sessions/{sessionId}/retry":{"post":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"context":{"type":"string"},"agentId":{"type":"string"},"model":{"type":"string"},"effort":{"type":"string","enum":["low","medium","high","max"]},"maxDuration":{"type":"integer","minimum":1,"maximum":1440,"description":"Wall-clock run budget in minutes; past it the lane is canceled and escalated on the issue"}},"additionalProperties":false}}}},"responses":{"201":{"description":"New session dispatched with retry context","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"agentId":{"type":"string"},"provider":{"type":"string"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent"]},"status":{"type":"string","enum":["created","running","waiting","completed","failed","canceled"]},"result":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"providerSessionId":{"type":"string","nullable":true},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"branch":{"type":"string","nullable":true},"purpose":{"type":"string","nullable":true},"secondaryRepos":{"type":"string","nullable":true},"maxDurationMinutes":{"type":"integer","nullable":true},"effort":{"type":"string","nullable":true,"enum":["low","medium","high","max",null]},"label":{"type":"string","nullable":true},"resultSchema":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"structuredResult":{"nullable":true},"resultSchemaErrors":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastProgressAt":{"type":"string","nullable":true},"lastStateHash":{"type":"string","nullable":true},"derivedStatus":{"type":"string","nullable":true,"enum":["stalled","needs_input",null]},"activities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"actorId":{"type":"string","nullable":true},"type":{"type":"string","enum":["thought","response","error","elicitation","action","status","artifact"]},"message":{"type":"string"},"payload":{"nullable":true},"parentId":{"type":"string","nullable":true},"startedAt":{"type":"string","nullable":true},"endedAt":{"type":"string","nullable":true},"durationMs":{"type":"number","nullable":true},"createdAt":{"type":"string"}},"required":["id","sessionId","actorId","type","message","parentId","startedAt","endedAt","durationMs","createdAt"]}}},"required":["id","organizationId","issueId","agentId","provider","actorId","actorType","status","result","url","providerSessionId","prUrl","prState","branch","createdAt","updatedAt"]}}}},"404":{"description":"Session or issue not found"},"409":{"description":"An active session already exists for this issue"}}}},"/workspaces/{organizationId}/agent/automations":{"get":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Automations for the workspace","content":{"application/json":{"schema":{"type":"object","properties":{"automations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"prompt":{"type":"string"},"agentId":{"type":"string"},"teamId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"triggerKind":{"type":"string","enum":["cron","event"]},"triggerValue":{"type":"string"},"enabled":{"type":"number"},"lastFiredAt":{"type":"string","nullable":true},"createdBy":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","name","prompt","agentId","teamId","issueId","triggerKind","triggerValue","enabled","lastFiredAt","createdBy","createdAt"]}}},"required":["automations"]}}}}}},"post":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"prompt":{"type":"string","minLength":1},"agentId":{"type":"string"},"teamId":{"type":"string"},"issueId":{"type":"string"},"triggerKind":{"type":"string","enum":["cron","event"]},"triggerValue":{"type":"string","minLength":1}},"required":["name","prompt","agentId","triggerKind","triggerValue"],"additionalProperties":false}}}},"responses":{"201":{"description":"Automation created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"prompt":{"type":"string"},"agentId":{"type":"string"},"teamId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"triggerKind":{"type":"string","enum":["cron","event"]},"triggerValue":{"type":"string"},"enabled":{"type":"number"},"lastFiredAt":{"type":"string","nullable":true},"createdBy":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","name","prompt","agentId","teamId","issueId","triggerKind","triggerValue","enabled","lastFiredAt","createdBy","createdAt"]}}}}}}},"/workspaces/{organizationId}/agent/automations/{automationId}":{"delete":{"tags":["agent-sessions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"automationId","in":"path"}],"responses":{"200":{"description":"Automation deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}},"404":{"description":"Automation not found"}}}},"/workspaces/{organizationId}/agent/providers/catalog":{"get":{"tags":["agent-providers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Agents a workspace can add, with hosted vs BYO modes and required fields","content":{"application/json":{"schema":{"type":"object","properties":{"providers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"modes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["hosted","byo"]},"label":{"type":"string"},"help":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"required":{"type":"boolean"},"type":{"type":"string","enum":["text","secret","select"]},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}},"help":{"type":"string"}},"required":["key","label","required","type"]}}},"required":["id","label","fields"]}}},"required":["id","name","modes"]}}},"required":["providers"]}}}}}}},"/workspaces/{organizationId}/agent/providers":{"get":{"tags":["agent-providers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Agent provider configs (secrets redacted)","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"agentId":{"type":"string"},"hasToken":{"type":"boolean"},"providerOrgId":{"type":"string","nullable":true},"hasComputeApiKey":{"type":"boolean"},"computeApiUrl":{"type":"string","nullable":true},"computeSnapshot":{"type":"string","nullable":true},"computeVolumeId":{"type":"string","nullable":true},"config":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"teamIds":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["agentId","hasToken","providerOrgId","hasComputeApiKey","computeApiUrl","computeSnapshot","computeVolumeId","config","teamIds","createdAt","updatedAt"]}}}}}}}},"/workspaces/{organizationId}/agent/setup-status":{"get":{"tags":["agent-providers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Per-provider onboarding readiness: credentials source, compute backend, and what's still missing before first dispatch","content":{"application/json":{"schema":{"type":"object","properties":{"githubConnected":{"type":"boolean"},"providers":{"type":"array","items":{"type":"object","properties":{"agentId":{"type":"string"},"credentials":{"type":"string","enum":["workspace","deployment","none"]},"computeProvider":{"type":"string"},"computeCredentials":{"type":"string","enum":["workspace","deployment","none"]},"missing":{"type":"array","items":{"type":"string"}},"ready":{"type":"boolean"}},"required":["agentId","credentials","computeProvider","computeCredentials","missing","ready"]}}},"required":["githubConnected","providers"]}}}}}}},"/workspaces/{organizationId}/agent/providers/{agentId}":{"put":{"tags":["agent-providers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agentId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["hosted","byo"]},"token":{"type":"string","nullable":true},"providerOrgId":{"type":"string","nullable":true},"computeApiKey":{"type":"string","nullable":true},"computeApiUrl":{"type":"string","nullable":true},"computeSnapshot":{"type":"string","nullable":true},"computeVolumeId":{"type":"string","nullable":true},"config":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"teamIds":{"type":"array","nullable":true,"items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Provider config saved (secrets redacted)","content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"type":"string"},"hasToken":{"type":"boolean"},"providerOrgId":{"type":"string","nullable":true},"hasComputeApiKey":{"type":"boolean"},"computeApiUrl":{"type":"string","nullable":true},"computeSnapshot":{"type":"string","nullable":true},"computeVolumeId":{"type":"string","nullable":true},"config":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"teamIds":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["agentId","hasToken","providerOrgId","hasComputeApiKey","computeApiUrl","computeSnapshot","computeVolumeId","config","teamIds","createdAt","updatedAt"]}}}}}},"delete":{"tags":["agent-providers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agentId","in":"path"}],"responses":{"204":{"description":"Provider config deleted"}}}},"/workspaces/{organizationId}/agent/providers/{agentId}/health":{"post":{"tags":["agent-providers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agentId","in":"path"}],"responses":{"200":{"description":"Provider credential/config probe","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]}}}}}}},"/workspaces/{organizationId}/agent/providers/{agentId}/hooks":{"post":{"tags":["agent-providers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agentId","in":"path"}],"responses":{"200":{"description":"Webhook accepted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"sessionId":{"type":"string"}},"required":["ok"]}}}},"404":{"description":"Session not found"}}}},"/webhooks/agent/{organizationId}/{agentId}":{"post":{"tags":["agent-providers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agentId","in":"path"}],"responses":{"200":{"description":"Webhook accepted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"sessionId":{"type":"string"}},"required":["ok"]}}}},"401":{"description":"Missing or invalid webhook secret"},"404":{"description":"Session not found"}}}},"/workspaces/{organizationId}/agent/environment":{"get":{"tags":["agent-environment"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Workspace agent environment files","content":{"application/json":{"schema":{"type":"object","properties":{"files":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"content":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["path","content","createdAt","updatedAt"]}}},"required":["files"]}}}}}},"put":{"tags":["agent-environment"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"path":{"type":"string","minLength":1},"content":{"type":"string"}},"required":["path","content"]}}}},"responses":{"200":{"description":"File saved","content":{"application/json":{"schema":{"type":"object","properties":{"path":{"type":"string"},"content":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["path","content","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/agent/environment/file":{"get":{"tags":["agent-environment"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"path","in":"query"}],"responses":{"200":{"description":"One environment file","content":{"application/json":{"schema":{"type":"object","properties":{"path":{"type":"string"},"content":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["path","content","createdAt","updatedAt"]}}}},"404":{"description":"File not found"}}},"delete":{"tags":["agent-environment"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"path","in":"query"}],"responses":{"204":{"description":"File deleted"},"404":{"description":"File not found"}}}},"/workspaces/{organizationId}/issues/{issueId}/approvals":{"post":{"tags":["approvals"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"approverId":{"type":"string"},"comment":{"type":"string"}},"required":["approverId"]}}}},"responses":{"201":{"description":"Approval requested","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"requestedById":{"type":"string"},"approverId":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"comment":{"type":"string","nullable":true},"createdAt":{"type":"string"},"resolvedAt":{"type":"string","nullable":true}},"required":["id","organizationId","issueId","requestedById","approverId","status","comment","createdAt","resolvedAt"]}}}}}},"get":{"tags":["approvals"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"responses":{"200":{"description":"Approvals for issue","content":{"application/json":{"schema":{"type":"object","properties":{"approvals":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"requestedById":{"type":"string"},"approverId":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"comment":{"type":"string","nullable":true},"createdAt":{"type":"string"},"resolvedAt":{"type":"string","nullable":true}},"required":["id","organizationId","issueId","requestedById","approverId","status","comment","createdAt","resolvedAt"]}}},"required":["approvals"]}}}}}}},"/workspaces/{organizationId}/approvals/{id}/respond":{"post":{"tags":["approvals"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["approved","rejected"]}},"required":["status"]}}}},"responses":{"200":{"description":"Approval resolved","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"requestedById":{"type":"string"},"approverId":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"comment":{"type":"string","nullable":true},"createdAt":{"type":"string"},"resolvedAt":{"type":"string","nullable":true}},"required":["id","organizationId","issueId","requestedById","approverId","status","comment","createdAt","resolvedAt"]}}}}}}},"/workspaces/{organizationId}/issues/{issueId}/activity":{"get":{"tags":["activities"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"responses":{"200":{"description":"Unified issue activity feed","content":{"application/json":{"schema":{"type":"object","properties":{"activity":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["history"]},"id":{"type":"string"},"issueId":{"type":"string"},"field":{"type":"string"},"fromValue":{"type":"string","nullable":true},"toValue":{"type":"string","nullable":true},"actorId":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["kind","id","issueId","field","fromValue","toValue","actorId","createdAt"]},{"type":"object","properties":{"kind":{"type":"string","enum":["comment"]},"id":{"type":"string"},"issueId":{"type":"string","nullable":true},"body":{"type":"string"},"authorId":{"type":"string","nullable":true},"externalAuthor":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["kind","id","issueId","body","authorId","externalAuthor","createdAt"]},{"type":"object","properties":{"kind":{"type":"string","enum":["agent"]},"id":{"type":"string"},"issueId":{"type":"string"},"sessionId":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"actorId":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["kind","id","issueId","sessionId","type","message","actorId","createdAt"]}]}}},"required":["activity"]}}}}}}},"/workspaces/{organizationId}/projects":{"get":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Projects list","content":{"application/json":{"schema":{"type":"object","properties":{"projects":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"]},"leadId":{"type":"string","nullable":true},"archivedAt":{"type":"string","nullable":true},"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","status","health","leadId","archivedAt","startDate","endDate","createdAt","updatedAt"]}}},"required":["projects"]}}}}}},"post":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"status":{"type":"string"},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"]},"leadId":{"type":"string"},"archivedAt":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"Project created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"]},"leadId":{"type":"string","nullable":true},"archivedAt":{"type":"string","nullable":true},"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","status","health","leadId","archivedAt","startDate","endDate","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/projects/{id}":{"get":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Project","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"]},"leadId":{"type":"string","nullable":true},"archivedAt":{"type":"string","nullable":true},"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","status","health","leadId","archivedAt","startDate","endDate","createdAt","updatedAt"]}}}}}},"patch":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"status":{"type":"string"},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"]},"leadId":{"type":"string"},"archivedAt":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":"string"}}}}}},"responses":{"200":{"description":"Project updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"]},"leadId":{"type":"string","nullable":true},"archivedAt":{"type":"string","nullable":true},"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","status","health","leadId","archivedAt","startDate","endDate","createdAt","updatedAt"]}}}}}},"delete":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Project deleted"}}}},"/workspaces/{organizationId}/projects/{id}/archive":{"post":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Project archived","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"]},"leadId":{"type":"string","nullable":true},"archivedAt":{"type":"string","nullable":true},"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","status","health","leadId","archivedAt","startDate","endDate","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/projects/{id}/unarchive":{"post":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Project unarchived","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"]},"leadId":{"type":"string","nullable":true},"archivedAt":{"type":"string","nullable":true},"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","status","health","leadId","archivedAt","startDate","endDate","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/cycles":{"get":{"tags":["cycles"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Cycles list","content":{"application/json":{"schema":{"type":"object","properties":{"cycles":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string","nullable":true},"name":{"type":"string"},"number":{"type":"number","nullable":true},"status":{"type":"string","enum":["upcoming","active","completed"]},"autoRollover":{"type":"boolean"},"archivedAt":{"type":"string","nullable":true},"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","name","number","status","autoRollover","archivedAt","startDate","endDate","createdAt","updatedAt"]}}},"required":["cycles"]}}}}}},"post":{"tags":["cycles"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"type":"string"},"name":{"type":"string","minLength":1},"number":{"type":"integer"},"status":{"type":"string","enum":["upcoming","active","completed"]},"autoRollover":{"type":"boolean"},"archivedAt":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"Cycle created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string","nullable":true},"name":{"type":"string"},"number":{"type":"number","nullable":true},"status":{"type":"string","enum":["upcoming","active","completed"]},"autoRollover":{"type":"boolean"},"archivedAt":{"type":"string","nullable":true},"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","name","number","status","autoRollover","archivedAt","startDate","endDate","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/cycles/{id}":{"get":{"tags":["cycles"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Cycle","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string","nullable":true},"name":{"type":"string"},"number":{"type":"number","nullable":true},"status":{"type":"string","enum":["upcoming","active","completed"]},"autoRollover":{"type":"boolean"},"archivedAt":{"type":"string","nullable":true},"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","name","number","status","autoRollover","archivedAt","startDate","endDate","createdAt","updatedAt"]}}}}}},"patch":{"tags":["cycles"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"type":"string"},"name":{"type":"string","minLength":1},"number":{"type":"integer"},"status":{"type":"string","enum":["upcoming","active","completed"]},"autoRollover":{"type":"boolean"},"archivedAt":{"type":"string"},"startDate":{"type":"string"},"endDate":{"type":"string"}}}}}},"responses":{"200":{"description":"Cycle updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string","nullable":true},"name":{"type":"string"},"number":{"type":"number","nullable":true},"status":{"type":"string","enum":["upcoming","active","completed"]},"autoRollover":{"type":"boolean"},"archivedAt":{"type":"string","nullable":true},"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","name","number","status","autoRollover","archivedAt","startDate","endDate","createdAt","updatedAt"]}}}}}},"delete":{"tags":["cycles"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Cycle deleted"}}}},"/workspaces/{organizationId}/cycles/{id}/archive":{"post":{"tags":["cycles"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Cycle archived","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string","nullable":true},"name":{"type":"string"},"number":{"type":"number","nullable":true},"status":{"type":"string","enum":["upcoming","active","completed"]},"autoRollover":{"type":"boolean"},"archivedAt":{"type":"string","nullable":true},"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","name","number","status","autoRollover","archivedAt","startDate","endDate","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/cycles/{id}/unarchive":{"post":{"tags":["cycles"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Cycle unarchived","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string","nullable":true},"name":{"type":"string"},"number":{"type":"number","nullable":true},"status":{"type":"string","enum":["upcoming","active","completed"]},"autoRollover":{"type":"boolean"},"archivedAt":{"type":"string","nullable":true},"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","name","number","status","autoRollover","archivedAt","startDate","endDate","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/cycles/{id}/capacity":{"get":{"tags":["cycles"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Cycle capacity: issue counts and estimate totals by status","content":{"application/json":{"schema":{"type":"object","properties":{"issueCount":{"type":"number"},"estimateTotal":{"type":"number"},"byStatus":{"type":"object","additionalProperties":{"type":"object","properties":{"count":{"type":"number"},"estimateTotal":{"type":"number"}},"required":["count","estimateTotal"]}}},"required":["issueCount","estimateTotal","byStatus"]}}}},"404":{"description":"Cycle not found"}}}},"/workspaces/{organizationId}/cycles/rollover":{"post":{"tags":["cycles"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Close ended cycles and roll unfinished issues into the next cycle","content":{"application/json":{"schema":{"type":"object","properties":{"completedCycles":{"type":"array","items":{"type":"string"}},"activatedCycles":{"type":"array","items":{"type":"string"}},"rolledOver":{"type":"number"}},"required":["completedCycles","activatedCycles","rolledOver"]}}}}}}},"/workspaces/{organizationId}/cycles/{id}/shift-all":{"post":{"tags":["cycles"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"targetCycleId":{"type":"string"}}}}}},"responses":{"200":{"description":"Shifted all issues to target cycle","content":{"application/json":{"schema":{"type":"object","properties":{"moved":{"type":"number"},"fromCycleId":{"type":"string"},"targetCycleId":{"type":"string"}},"required":["moved","fromCycleId","targetCycleId"]}}}}}}},"/workspaces/{organizationId}/cycles/{id}/start-today":{"post":{"tags":["cycles"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Cycle started today","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string","nullable":true},"name":{"type":"string"},"number":{"type":"number","nullable":true},"status":{"type":"string","enum":["upcoming","active","completed"]},"autoRollover":{"type":"boolean"},"archivedAt":{"type":"string","nullable":true},"startDate":{"type":"string","nullable":true},"endDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","name","number","status","autoRollover","archivedAt","startDate","endDate","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/labels":{"get":{"tags":["labels"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Labels list","content":{"application/json":{"schema":{"type":"object","properties":{"labels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","name","color","createdAt"]}}},"required":["labels"]}}}}}},"post":{"tags":["labels"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"color":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"Label created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","name","color","createdAt"]}}}}}}},"/workspaces/{organizationId}/labels/{id}":{"get":{"tags":["labels"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Label","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","name","color","createdAt"]}}}}}},"patch":{"tags":["labels"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"color":{"type":"string"}}}}}},"responses":{"200":{"description":"Label updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","name","color","createdAt"]}}}}}},"delete":{"tags":["labels"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Label deleted"}}}},"/workspaces/{organizationId}/memberships":{"get":{"tags":["memberships"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Memberships list","content":{"application/json":{"schema":{"type":"object","properties":{"memberships":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member"]},"createdAt":{"type":"string"}},"required":["id","organizationId","userId","role","createdAt"]}}},"required":["memberships"]}}}}}},"post":{"tags":["memberships"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","minLength":1},"role":{"type":"string","enum":["owner","admin","member"]}},"required":["userId"]}}}},"responses":{"201":{"description":"Membership created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member"]},"createdAt":{"type":"string"}},"required":["id","organizationId","userId","role","createdAt"]}}}}}}},"/workspaces/{organizationId}/roadmaps":{"get":{"tags":["roadmaps"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Roadmaps list","content":{"application/json":{"schema":{"type":"object","properties":{"roadmaps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","createdAt","updatedAt"]}}},"required":["roadmaps"]}}}}}},"post":{"tags":["roadmaps"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"Roadmap created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/roadmaps/{id}":{"get":{"tags":["roadmaps"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Roadmap","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","createdAt","updatedAt"]}}}}}},"patch":{"tags":["roadmaps"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"}}}}}},"responses":{"200":{"description":"Roadmap updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","createdAt","updatedAt"]}}}}}},"delete":{"tags":["roadmaps"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Roadmap deleted"}}}},"/workspaces/{organizationId}/initiatives":{"get":{"tags":["initiatives"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"roadmapId","in":"query"}],"responses":{"200":{"description":"Initiatives list","content":{"application/json":{"schema":{"type":"object","properties":{"initiatives":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"roadmapId":{"type":"string","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"startDate":{"type":"string","nullable":true},"targetDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","roadmapId","name","description","status","startDate","targetDate","createdAt","updatedAt"]}}},"required":["initiatives"]}}}}}},"post":{"tags":["initiatives"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"roadmapId":{"type":"string"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"status":{"type":"string"},"startDate":{"type":"string"},"targetDate":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"Initiative created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"roadmapId":{"type":"string","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"startDate":{"type":"string","nullable":true},"targetDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","roadmapId","name","description","status","startDate","targetDate","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/roadmaps/{id}/initiatives":{"get":{"tags":["roadmaps"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Initiatives in roadmap","content":{"application/json":{"schema":{"type":"object","properties":{"initiatives":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"roadmapId":{"type":"string","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"startDate":{"type":"string","nullable":true},"targetDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","roadmapId","name","description","status","startDate","targetDate","createdAt","updatedAt"]}}},"required":["initiatives"]}}}}}}},"/workspaces/{organizationId}/initiatives/{id}":{"get":{"tags":["initiatives"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Initiative","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"roadmapId":{"type":"string","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"startDate":{"type":"string","nullable":true},"targetDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","roadmapId","name","description","status","startDate","targetDate","createdAt","updatedAt"]}}}}}},"patch":{"tags":["initiatives"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"roadmapId":{"type":"string"},"name":{"type":"string","minLength":1},"description":{"type":"string"},"status":{"type":"string"},"startDate":{"type":"string"},"targetDate":{"type":"string"}}}}}},"responses":{"200":{"description":"Initiative updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"roadmapId":{"type":"string","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"startDate":{"type":"string","nullable":true},"targetDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","roadmapId","name","description","status","startDate","targetDate","createdAt","updatedAt"]}}}}}},"delete":{"tags":["initiatives"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Initiative deleted"}}}},"/workspaces/{organizationId}/external-links":{"get":{"tags":["external-links"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","enum":["issue","project","customer","document"]},"required":false,"name":"entityType","in":"query"},{"schema":{"type":"string"},"required":false,"name":"entityId","in":"query"}],"responses":{"200":{"description":"External links","content":{"application/json":{"schema":{"type":"object","properties":{"links":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"entityType":{"type":"string"},"entityId":{"type":"string"},"url":{"type":"string"},"label":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","entityType","entityId","url","label","createdAt"]}}},"required":["links"]}}}}}},"post":{"tags":["external-links"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"entityType":{"type":"string","enum":["issue","project","customer","document"]},"entityId":{"type":"string"},"url":{"type":"string","format":"uri"},"label":{"type":"string"}},"required":["entityType","entityId","url"]}}}},"responses":{"201":{"description":"External link created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"entityType":{"type":"string"},"entityId":{"type":"string"},"url":{"type":"string"},"label":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","entityType","entityId","url","label","createdAt"]}}}},"404":{"description":"Entity not found"}}}},"/workspaces/{organizationId}/external-links/{id}":{"get":{"tags":["external-links"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"External link","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"entityType":{"type":"string"},"entityId":{"type":"string"},"url":{"type":"string"},"label":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","entityType","entityId","url","label","createdAt"]}}}},"404":{"description":"External link not found"}}},"patch":{"tags":["external-links"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"entityType":{"type":"string","enum":["issue","project","customer","document"]},"entityId":{"type":"string"},"url":{"type":"string","format":"uri"},"label":{"type":"string"}}}}}},"responses":{"200":{"description":"External link updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"entityType":{"type":"string"},"entityId":{"type":"string"},"url":{"type":"string"},"label":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","entityType","entityId","url","label","createdAt"]}}}},"404":{"description":"External link not found"}}},"delete":{"tags":["external-links"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"External link deleted"},"404":{"description":"External link not found"}}}},"/workspaces/{organizationId}/projects/{projectId}/updates":{"get":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"}],"responses":{"200":{"description":"Project updates","content":{"application/json":{"schema":{"type":"object","properties":{"updates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"content":{"type":"string"},"contentFormat":{"type":"string","enum":["text","markdown","blocks"]},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"]},"createdById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","content","contentFormat","health","createdById","createdAt","updatedAt"]}}},"required":["updates"]}}}}}},"post":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","minLength":1},"contentFormat":{"type":"string","enum":["text","markdown","blocks"],"default":"text"},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"],"default":"on_track"}},"required":["content"]}}}},"responses":{"201":{"description":"Project update created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"content":{"type":"string"},"contentFormat":{"type":"string","enum":["text","markdown","blocks"]},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"]},"createdById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","content","contentFormat","health","createdById","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/projects/{projectId}/updates/{id}":{"get":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Project update","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"content":{"type":"string"},"contentFormat":{"type":"string","enum":["text","markdown","blocks"]},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"]},"createdById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","content","contentFormat","health","createdById","createdAt","updatedAt"]}}}}}},"patch":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","minLength":1},"contentFormat":{"type":"string","enum":["text","markdown","blocks"],"default":"text"},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"],"default":"on_track"}}}}}},"responses":{"200":{"description":"Project update updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"content":{"type":"string"},"contentFormat":{"type":"string","enum":["text","markdown","blocks"]},"health":{"type":"string","enum":["on_track","at_risk","off_track","paused"]},"createdById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","content","contentFormat","health","createdById","createdAt","updatedAt"]}}}}}},"delete":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Project update deleted"}}}},"/workspaces/{organizationId}/projects/{projectId}/milestones":{"get":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"}],"responses":{"200":{"description":"Project milestones","content":{"application/json":{"schema":{"type":"object","properties":{"milestones":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"targetDate":{"type":"string","nullable":true},"completedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","name","description","targetDate","completedAt","createdAt","updatedAt"]}}},"required":["milestones"]}}}}}},"post":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"targetDate":{"type":"string"},"completedAt":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"Project milestone created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"targetDate":{"type":"string","nullable":true},"completedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","name","description","targetDate","completedAt","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/projects/{projectId}/milestones/{id}":{"get":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Project milestone","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"targetDate":{"type":"string","nullable":true},"completedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","name","description","targetDate","completedAt","createdAt","updatedAt"]}}}}}},"patch":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"targetDate":{"type":"string"},"completedAt":{"type":"string"}}}}}},"responses":{"200":{"description":"Project milestone updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"targetDate":{"type":"string","nullable":true},"completedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","name","description","targetDate","completedAt","createdAt","updatedAt"]}}}}}},"delete":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Project milestone deleted"}}}},"/workspaces/{organizationId}/projects/{projectId}/reminder":{"get":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"}],"responses":{"200":{"description":"Project update reminder","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"cadence":{"type":"string","enum":["daily","weekly","biweekly","monthly"]},"nextDueAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","cadence","nextDueAt","createdAt","updatedAt"]}}}}}},"put":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"cadence":{"type":"string","enum":["daily","weekly","biweekly","monthly"]},"nextDueAt":{"type":"string"}}}}}},"responses":{"200":{"description":"Project update reminder set","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"cadence":{"type":"string","enum":["daily","weekly","biweekly","monthly"]},"nextDueAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","cadence","nextDueAt","createdAt","updatedAt"]}}}}}},"delete":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"}],"responses":{"204":{"description":"Project update reminder deleted"}}}},"/workspaces/{organizationId}/project-update-reminders":{"post":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"cadence":{"type":"string","enum":["daily","weekly","biweekly","monthly"]},"nextDueAt":{"type":"string"},"projectId":{"type":"string"}},"required":["projectId"]}}}},"responses":{"201":{"description":"Project update reminder created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"cadence":{"type":"string","enum":["daily","weekly","biweekly","monthly"]},"nextDueAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","cadence","nextDueAt","createdAt","updatedAt"]}}}},"404":{"description":"Project not found"}}}},"/workspaces/{organizationId}/project-update-reminders/fire-due":{"post":{"tags":["projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Due reminders fired","content":{"application/json":{"schema":{"type":"object","properties":{"fired":{"type":"integer"}},"required":["fired"]}}}}}}},"/workspaces/{organizationId}/issues/{id}/reconcile":{"post":{"tags":["pr"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"PR state reconciled","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"prCheckState":{"type":"string","nullable":true},"status":{"type":"string"}},"required":["id","prUrl","prState","prCheckState","status"]}}}},"400":{"description":"Bad request"},"404":{"description":"Issue not found"},"502":{"description":"GitHub API failure"}}}},"/workspaces/{organizationId}/issues/{id}/pr":{"get":{"tags":["pr"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"PR status","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"prUrl":{"type":"string","nullable":true},"prState":{"type":"string","nullable":true},"prCheckState":{"type":"string","nullable":true},"status":{"type":"string"}},"required":["id","prUrl","prState","prCheckState","status"]}}}},"404":{"description":"Issue not found"}}}},"/workspaces/{organizationId}/projects/{projectId}/members":{"get":{"tags":["project-members"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"}],"responses":{"200":{"description":"Project members list","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"userId":{"type":"string"},"role":{"type":"string","enum":["lead","member"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","userId","role","createdAt","updatedAt"]}}},"required":["members"]}}}},"404":{"description":"Project not found"}}},"post":{"tags":["project-members"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"role":{"type":"string","enum":["lead","member"],"default":"member"}},"required":["userId"]}}}},"responses":{"201":{"description":"Project member added","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"userId":{"type":"string"},"role":{"type":"string","enum":["lead","member"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","userId","role","createdAt","updatedAt"]}}}},"404":{"description":"Project not found"}}}},"/workspaces/{organizationId}/projects/{projectId}/members/{id}":{"patch":{"tags":["project-members"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["lead","member"]}},"required":["role"]}}}},"responses":{"200":{"description":"Project member updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string"},"userId":{"type":"string"},"role":{"type":"string","enum":["lead","member"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","userId","role","createdAt","updatedAt"]}}}},"404":{"description":"Project member not found"}}},"delete":{"tags":["project-members"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Project member removed"}}}},"/workspaces/{organizationId}/email-inboxes":{"get":{"tags":["email-inboxes"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Email inboxes list","content":{"application/json":{"schema":{"type":"object","properties":{"inboxes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"address":{"type":"string"},"teamId":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"customerId":{"type":"string","nullable":true},"enabled":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","address","teamId","projectId","customerId","enabled","createdAt","updatedAt"]}}},"required":["inboxes"]}}}}}},"post":{"tags":["email-inboxes"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string","format":"email"},"teamId":{"type":"string"},"projectId":{"type":"string"},"customerId":{"type":"string"},"enabled":{"type":"boolean","default":true}},"required":["address"]}}}},"responses":{"201":{"description":"Email inbox created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"address":{"type":"string"},"teamId":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"customerId":{"type":"string","nullable":true},"enabled":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","address","teamId","projectId","customerId","enabled","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/email-inboxes/{id}":{"delete":{"tags":["email-inboxes"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Email inbox deleted"}}}},"/workspaces/{organizationId}/agent-context":{"get":{"tags":["agent-context"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Workspace agent context: AGENTS.md content, always-on rules, and the skill catalog. Served to agents and harnesses as the workspace's source of truth.","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"agentsMd":{"type":"string"},"rules":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"content":{"type":"string"}},"required":["name","content"]}},"skills":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","default":""},"content":{"type":"string"}},"required":["name","content"]}},"updatedBy":{"type":"string","nullable":true},"updatedAt":{"type":"string"}},"required":["organizationId","agentsMd","rules","skills","updatedBy","updatedAt"]}}}}}},"put":{"tags":["agent-context"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"agentsMd":{"type":"string"},"rules":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"content":{"type":"string"}},"required":["name","content"]}},"skills":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","default":""},"content":{"type":"string"}},"required":["name","content"]}}}}}}},"responses":{"200":{"description":"Agent context updated","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"agentsMd":{"type":"string"},"rules":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"content":{"type":"string"}},"required":["name","content"]}},"skills":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","default":""},"content":{"type":"string"}},"required":["name","content"]}},"updatedBy":{"type":"string","nullable":true},"updatedAt":{"type":"string"}},"required":["organizationId","agentsMd","rules","skills","updatedBy","updatedAt"]}}}}}}},"/workspaces/{organizationId}/agent-context/rules":{"get":{"tags":["agent-context"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Workspace always-on agent rules","content":{"application/json":{"schema":{"type":"object","properties":{"rules":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"content":{"type":"string"}},"required":["name","content"]}}},"required":["rules"]}}}}}}},"/workspaces/{organizationId}/agent-context/skills":{"get":{"tags":["agent-context"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Workspace agent skill catalog","content":{"application/json":{"schema":{"type":"object","properties":{"skills":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","default":""},"content":{"type":"string"}},"required":["name","content"]}}},"required":["skills"]}}}}}}},"/workspaces/{organizationId}/support/capture/public-keys":{"post":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"allowedOrigins":{"type":"array","items":{"type":"string"},"default":[]}},"required":["name"]}}}},"responses":{"201":{"description":"Public key created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"key":{"type":"string"},"allowedOrigins":{"type":"array","items":{"type":"string"}},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","key","allowedOrigins","isActive","createdAt","updatedAt"]}}}}}},"get":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Public keys","content":{"application/json":{"schema":{"type":"object","properties":{"publicKeys":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"key":{"type":"string"},"allowedOrigins":{"type":"array","items":{"type":"string"}},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","key","allowedOrigins","isActive","createdAt","updatedAt"]}}},"required":["publicKeys"]}}}}}}},"/workspaces/{organizationId}/support/capture/public-keys/{keyId}":{"delete":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"keyId","in":"path"}],"responses":{"200":{"description":"Public key revoked","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"key":{"type":"string"},"allowedOrigins":{"type":"array","items":{"type":"string"}},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","key","allowedOrigins","isActive","createdAt","updatedAt"]}}}},"404":{"description":"Not found"}}}},"/workspaces/{organizationId}/support/capture-links":{"post":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"publicKeyId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1,"default":"Capture link"},"expiresAt":{"type":"string","nullable":true},"maxSessions":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true},"requireChallenge":{"type":"boolean"}},"required":["publicKeyId"]}}}},"responses":{"201":{"description":"Capture link created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"publicKeyId":{"type":"string"},"token":{"type":"string"},"name":{"type":"string"},"url":{"type":"string"},"expiresAt":{"type":"string","nullable":true},"maxSessions":{"type":"number","nullable":true},"requireChallenge":{"type":"boolean"},"isActive":{"type":"boolean"},"createdBy":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","publicKeyId","token","name","url","expiresAt","maxSessions","requireChallenge","isActive","createdBy","createdAt","updatedAt"]}}}}}},"get":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Capture links","content":{"application/json":{"schema":{"type":"object","properties":{"links":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"publicKeyId":{"type":"string"},"token":{"type":"string"},"name":{"type":"string"},"url":{"type":"string"},"expiresAt":{"type":"string","nullable":true},"maxSessions":{"type":"number","nullable":true},"requireChallenge":{"type":"boolean"},"isActive":{"type":"boolean"},"createdBy":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","publicKeyId","token","name","url","expiresAt","maxSessions","requireChallenge","isActive","createdBy","createdAt","updatedAt"]}}},"required":["links"]}}}}}}},"/workspaces/{organizationId}/support/capture-links/{linkId}":{"delete":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"linkId","in":"path"}],"responses":{"200":{"description":"Capture link revoked","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"publicKeyId":{"type":"string"},"token":{"type":"string"},"name":{"type":"string"},"url":{"type":"string"},"expiresAt":{"type":"string","nullable":true},"maxSessions":{"type":"number","nullable":true},"requireChallenge":{"type":"boolean"},"isActive":{"type":"boolean"},"createdBy":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","publicKeyId","token","name","url","expiresAt","maxSessions","requireChallenge","isActive","createdBy","createdAt","updatedAt"]}}}},"404":{"description":"Not found"}}}},"/support/capture/token":{"post":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":false,"name":"x-pile-capture-public-key","in":"header"},{"schema":{"type":"string"},"required":false,"name":"x-pile-capture-link","in":"header"},{"schema":{"type":"string"},"required":false,"name":"x-pile-capture-reference","in":"header"},{"schema":{"type":"string"},"required":false,"name":"origin","in":"header"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"turnstileToken":{"type":"string"}}}}}},"responses":{"200":{"description":"Capture token","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"recordingUrl":{"type":"string"}},"required":["token","recordingUrl"]}}}},"401":{"description":"Invalid public key or origin"},"403":{"description":"CAPTURE_CHALLENGE_REQUIRED — a Turnstile token is needed"}}}},"/support/capture/upload-session":{"post":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-pile-capture-token","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"description":{"type":"string"},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"tags":{"type":"array","items":{"type":"string"}},"url":{"type":"string"},"attachmentType":{"type":"string","enum":["screenshot","video","debugger_json","log","network","replay"],"default":"screenshot"},"contentType":{"type":"string"},"fileName":{"type":"string"},"artifacts":{"type":"array","items":{"type":"object","properties":{"attachmentType":{"type":"string","enum":["screenshot","video","debugger_json","log","network","replay"]},"fileName":{"type":"string"},"contentType":{"type":"string"}},"required":["attachmentType"]}},"visibility":{"type":"string","enum":["public","private"]},"metadata":{"type":"object","additionalProperties":{"nullable":true},"default":{}},"deviceInfo":{"type":"object","additionalProperties":{"nullable":true}}},"required":["title"]}}}},"responses":{"200":{"description":"Upload session","content":{"application/json":{"schema":{"type":"object","properties":{"uploadUrl":{"type":"string"},"r2Key":{"type":"string"},"sessionId":{"type":"string"},"uploads":{"type":"array","items":{"type":"object","properties":{"uploadUrl":{"type":"string"},"r2Key":{"type":"string"},"attachmentType":{"type":"string","enum":["screenshot","video","debugger_json","log","network","replay"]},"fileName":{"type":"string"}},"required":["uploadUrl","r2Key","attachmentType","fileName"]}}},"required":["uploadUrl","r2Key","sessionId"]}}}},"401":{"description":"Invalid or expired token"}}}},"/support/capture/upload/{sessionId}/{attachmentType}/{fileName}":{"post":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"},{"schema":{"type":"string","enum":["screenshot","video","debugger_json","log","network","replay"]},"required":true,"name":"attachmentType","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fileName","in":"path"},{"schema":{"type":"string"},"required":true,"name":"x-pile-capture-token","in":"header"}],"responses":{"200":{"description":"Upload complete","content":{"application/json":{"schema":{"type":"object","properties":{"r2Key":{"type":"string"}},"required":["r2Key"]}}}},"401":{"description":"Invalid or expired session"}}}},"/support/capture/finalize":{"post":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-pile-capture-token","in":"header"}],"responses":{"200":{"description":"Capture finalized","content":{"application/json":{"schema":{"type":"object","properties":{"ticketId":{"type":"string"},"shareUrl":{"type":"string"}},"required":["ticketId"]}}}},"401":{"description":"Invalid or expired token"}}}},"/support/capture/metadata":{"post":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"x-pile-capture-token","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"metadata":{"type":"object","additionalProperties":{"nullable":true}}},"required":["metadata"]}}}},"responses":{"200":{"description":"Metadata updated"},"401":{"description":"Invalid or expired token"}}}},"/support/capture/artifacts/{attachmentId}":{"get":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"attachmentId","in":"path"}],"responses":{"200":{"description":"Artifact binary"},"404":{"description":"Artifact not found"}}}},"/support/capture/sessions/{sessionId}":{"get":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"sessionId","in":"path"}],"responses":{"200":{"description":"Capture recording session","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string"},"status":{"type":"string"},"expiresAt":{"type":"string"},"ticketId":{"type":"string","nullable":true},"reference":{"type":"string","nullable":true},"uploads":{"type":"array","items":{"type":"object","properties":{"attachmentType":{"type":"string"},"contentType":{"type":"string","nullable":true},"r2Key":{"type":"string"},"uploaded":{"type":"boolean"}},"required":["attachmentType","r2Key","uploaded"]}}},"required":["sessionId","status","expiresAt","ticketId","reference","uploads"]}}}},"404":{"description":"Session not found"}}}},"/support/capture/public/{ticketId}":{"get":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"responses":{"200":{"description":"Public capture share","content":{"application/json":{"schema":{"type":"object","properties":{"ticketId":{"type":"string"},"title":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["screenshot","video","debugger_json","log","network","replay"]},"contentType":{"type":"string"},"url":{"type":"string"},"size":{"type":"number"}},"required":["type"]}}},"required":["ticketId","title","attachments"]}}}},"404":{"description":"Ticket not found"}}}},"/support/webhooks/jam/{publicKeyId}":{"post":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"publicKeyId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"svix-id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"svix-timestamp","in":"header"},{"schema":{"type":"string"},"required":true,"name":"svix-signature","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"jamId":{"type":"string"},"jamUrl":{"type":"string"},"teamId":{"type":"string"},"type":{"type":"string","enum":["video","screenshot","sessionReplay"]},"createdAt":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"originalUrl":{"type":"string"},"origin":{"type":"string"},"isIncognito":{"type":"boolean"},"author":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}},"default":{},"additionalProperties":{"nullable":true}},"media":{"type":"object","properties":{"videoUrl":{"type":"string"},"screenshotUrl":{"type":"string"},"thumbnailUrl":{"type":"string"}},"default":{},"additionalProperties":{"nullable":true}},"systemInfo":{"type":"object","properties":{"browser":{"type":"object","properties":{"name":{"type":"string"},"version":{"type":"string"}},"additionalProperties":{"nullable":true}},"os":{"type":"object","properties":{"name":{"type":"string"},"version":{"type":"string"}},"additionalProperties":{"nullable":true}},"screen":{"type":"object","properties":{"width":{"type":"number"},"height":{"type":"number"}},"additionalProperties":{"nullable":true}},"battery":{"type":"object","properties":{"charging":{"type":"boolean"},"level":{"type":"number"}},"additionalProperties":{"nullable":true}},"connection":{"type":"object","properties":{"effectiveType":{"type":"string"},"downlinkMbps":{"type":"number"},"rttMs":{"type":"number"}},"additionalProperties":{"nullable":true}}},"additionalProperties":{"nullable":true}},"consoleLogs":{"type":"array","items":{"type":"object","properties":{"level":{"type":"string"},"message":{"type":"string"},"timestamp":{"type":"string"}},"additionalProperties":{"nullable":true}}},"networkRequests":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"method":{"type":"string"},"status":{"type":"number"},"duration":{"type":"number"},"requestHeaders":{"type":"object","additionalProperties":{"type":"string"}},"responseHeaders":{"type":"object","additionalProperties":{"type":"string"}}},"additionalProperties":{"nullable":true}}},"userEvents":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"timestamp":{"type":"string"},"selector":{"type":"string"},"target":{"type":"string"},"value":{"type":"string"}},"additionalProperties":{"nullable":true}}},"recordingLink":{"type":"object","properties":{"publicId":{"type":"string"},"type":{"type":"string","enum":["one_time","reusable"]},"recordingUrl":{"type":"string"},"description":{"type":"string"},"reference":{"type":"string"},"submitterComment":{"type":"string"}},"additionalProperties":{"nullable":true}},"intercom":{"type":"object","properties":{"conversationId":{"type":"string"},"issueId":{"type":"string"}},"additionalProperties":{"nullable":true}},"linear":{"type":"object","properties":{"conversationId":{"type":"string"},"issueId":{"type":"string"}},"additionalProperties":{"nullable":true}}},"required":["jamId","jamUrl","teamId","type","createdAt"],"additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Jam captured","content":{"application/json":{"schema":{"type":"object","properties":{"ticketId":{"type":"string","nullable":true},"deliveryId":{"type":"string"}},"required":["ticketId"]}}}},"401":{"description":"Invalid webhook"},"404":{"description":"Public key or ticket not found"}}}},"/support/webhooks/jam/{publicKeyId}/intercom/recorded":{"post":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"publicKeyId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"svix-id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"svix-timestamp","in":"header"},{"schema":{"type":"string"},"required":true,"name":"svix-signature","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"conversationId":{"type":"string"},"jamId":{"type":"string"},"jamUrl":{"type":"string"}},"required":["conversationId","jamId","jamUrl"],"additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Intercom recorder recorded","content":{"application/json":{"schema":{"type":"object","properties":{"ticketId":{"type":"string","nullable":true},"deliveryId":{"type":"string"}},"required":["ticketId"]}}}},"401":{"description":"Invalid webhook"},"404":{"description":"Public key or ticket not found"}}}},"/support/webhooks/jam/{publicKeyId}/intercom/opted-out":{"post":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"publicKeyId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"svix-id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"svix-timestamp","in":"header"},{"schema":{"type":"string"},"required":true,"name":"svix-signature","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"conversationId":{"type":"string"}},"required":["conversationId"],"additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Intercom recorder opted out","content":{"application/json":{"schema":{"type":"object","properties":{"ticketId":{"type":"string","nullable":true},"deliveryId":{"type":"string"}},"required":["ticketId"]}}}},"401":{"description":"Invalid webhook"},"404":{"description":"Public key or ticket not found"}}}},"/support/webhooks/jam/{publicKeyId}/recording-links":{"post":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"publicKeyId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"svix-id","in":"header"},{"schema":{"type":"string"},"required":true,"name":"svix-timestamp","in":"header"},{"schema":{"type":"string"},"required":true,"name":"svix-signature","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"recordingLinkId":{"type":"string"},"publicId":{"type":"string"},"url":{"type":"string"},"teamId":{"type":"string"},"type":{"type":"string","enum":["one_time","reusable"]},"createdAt":{"type":"string"},"origin":{"type":"string"},"description":{"type":"string"},"reference":{"type":"string"},"recordingUrl":{"type":"string"},"createdBy":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"}},"additionalProperties":{"nullable":true}}},"required":["recordingLinkId","publicId","url","teamId","type","createdAt"],"additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Recording link created","content":{"application/json":{"schema":{"type":"object","properties":{"ticketId":{"type":"string","nullable":true},"deliveryId":{"type":"string"}},"required":["ticketId"]}}}},"401":{"description":"Invalid webhook"},"404":{"description":"Public key or ticket not found"}}}},"/workspaces/{organizationId}/support/captures/{ticketId}/console":{"get":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"level","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"isError","in":"query"}],"responses":{"200":{"description":"Console logs","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"nullable":true}}},"required":["events"]}}}},"404":{"description":"Console logs not found"}}}},"/workspaces/{organizationId}/support/captures/{ticketId}/network":{"get":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"isError","in":"query"},{"schema":{"type":"string"},"required":false,"name":"url","in":"query"}],"responses":{"200":{"description":"Network requests","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"nullable":true}}},"required":["events"]}}}},"404":{"description":"Network requests not found"}}}},"/workspaces/{organizationId}/support/captures/{ticketId}/events":{"get":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"type","in":"query"},{"schema":{"type":"string"},"required":false,"name":"action","in":"query"}],"responses":{"200":{"description":"User events","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"nullable":true}}},"required":["events"]}}}},"404":{"description":"User events not found"}}}},"/workspaces/{organizationId}/support/captures/{ticketId}/frames":{"get":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"responses":{"200":{"description":"Visual frames","content":{"application/json":{"schema":{"type":"object","properties":{"frames":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","nullable":true},"type":{"type":"string"},"fileName":{"type":"string","nullable":true}},"required":["url","type","fileName"]}}},"required":["frames"]}}}},"404":{"description":"Frames not found"}}}},"/workspaces/{organizationId}/support/captures/{ticketId}/metadata":{"get":{"tags":["support-capture"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"responses":{"200":{"description":"Capture metadata","content":{"application/json":{"schema":{"type":"object","properties":{"deviceInfo":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"metadata":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"eventsSummary":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"postprocessing":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}}},"required":["deviceInfo","metadata","eventsSummary","postprocessing"]}}}},"404":{"description":"Capture not found"}}}},"/workspaces/{organizationId}/support/widget-keys":{"post":{"tags":["support-widget"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"default":"Chat widget"},"allowedOrigins":{"type":"array","items":{"type":"string"},"default":[]},"greeting":{"type":"string","nullable":true},"brandColor":{"type":"string","nullable":true},"requireEmail":{"type":"boolean","default":false},"requireChallenge":{"type":"boolean","default":false}}}}}},"responses":{"201":{"description":"Widget key created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"key":{"type":"string"},"hmacSecret":{"type":"string"},"name":{"type":"string"},"allowedOrigins":{"type":"array","items":{"type":"string"}},"greeting":{"type":"string","nullable":true},"brandColor":{"type":"string","nullable":true},"requireEmail":{"type":"boolean"},"requireChallenge":{"type":"boolean"},"isActive":{"type":"boolean"},"createdBy":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","hmacSecret","name","allowedOrigins","greeting","brandColor","requireEmail","requireChallenge","isActive","createdBy","createdAt","updatedAt"]}}}}}},"get":{"tags":["support-widget"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Widget keys","content":{"application/json":{"schema":{"type":"object","properties":{"widgetKeys":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"key":{"type":"string"},"hmacSecret":{"type":"string"},"name":{"type":"string"},"allowedOrigins":{"type":"array","items":{"type":"string"}},"greeting":{"type":"string","nullable":true},"brandColor":{"type":"string","nullable":true},"requireEmail":{"type":"boolean"},"requireChallenge":{"type":"boolean"},"isActive":{"type":"boolean"},"createdBy":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","hmacSecret","name","allowedOrigins","greeting","brandColor","requireEmail","requireChallenge","isActive","createdBy","createdAt","updatedAt"]}}},"required":["widgetKeys"]}}}}}}},"/workspaces/{organizationId}/support/widget-keys/{keyId}":{"delete":{"tags":["support-widget"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"keyId","in":"path"}],"responses":{"200":{"description":"Widget key revoked","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"key":{"type":"string"},"hmacSecret":{"type":"string"},"name":{"type":"string"},"allowedOrigins":{"type":"array","items":{"type":"string"}},"greeting":{"type":"string","nullable":true},"brandColor":{"type":"string","nullable":true},"requireEmail":{"type":"boolean"},"requireChallenge":{"type":"boolean"},"isActive":{"type":"boolean"},"createdBy":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","hmacSecret","name","allowedOrigins","greeting","brandColor","requireEmail","requireChallenge","isActive","createdBy","createdAt","updatedAt"]}}}},"404":{"description":"Not found"}}}},"/support/widget/{key}/session":{"post":{"tags":["support-widget"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sessionToken":{"type":"string"},"externalId":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string"},"identifierHash":{"type":"string"},"turnstileToken":{"type":"string"}}}}}},"responses":{"200":{"description":"Widget session created or resumed","content":{"application/json":{"schema":{"type":"object","properties":{"sessionToken":{"type":"string"},"ticketId":{"type":"string","nullable":true},"identityVerified":{"type":"boolean"},"config":{"type":"object","properties":{"greeting":{"type":"string","nullable":true},"brandColor":{"type":"string","nullable":true},"requireEmail":{"type":"boolean"}},"required":["greeting","brandColor","requireEmail"]},"customer":{"type":"object","nullable":true,"properties":{"email":{"type":"string","nullable":true},"fullName":{"type":"string","nullable":true}},"required":["email","fullName"]}},"required":["sessionToken","ticketId","identityVerified","config","customer"]}}}}}}},"/support/widget/{key}/messages":{"post":{"tags":["support-widget"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"},{"schema":{"type":"string"},"required":true,"name":"x-pile-widget-session","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1},"externalId":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string"}},"required":["text"]}}}},"responses":{"200":{"description":"Message appended","content":{"application/json":{"schema":{"type":"object","properties":{"messageId":{"type":"string"},"ticketId":{"type":"string"},"createdAt":{"type":"string"}},"required":["messageId","ticketId","createdAt"]}}}}}},"get":{"tags":["support-widget"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"},{"schema":{"type":"string"},"required":false,"name":"after","in":"query"},{"schema":{"type":"string"},"required":true,"name":"x-pile-widget-session","in":"header"}],"responses":{"200":{"description":"Messages for the session's conversation","content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"text":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","direction","text","createdAt"]}}},"required":["messages"]}}}}}}},"/support/widget/{key}/votes":{"post":{"tags":["support-widget"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"},{"schema":{"type":"string"},"required":true,"name":"x-pile-widget-session","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ticketId":{"type":"string","minLength":1},"priority":{"type":"string","enum":["nice_to_have","important","must_have"]}},"required":["ticketId"]}}}},"responses":{"200":{"description":"Vote recorded (idempotent per ticket + session customer)","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"boolean"},"voteCount":{"type":"number"}},"required":["created","voteCount"]}}}}}}},"/support/widget/{key}/votes/{ticketId}":{"delete":{"tags":["support-widget"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"x-pile-widget-session","in":"header"}],"responses":{"200":{"description":"Vote removed","content":{"application/json":{"schema":{"type":"object","properties":{"removed":{"type":"boolean"},"voteCount":{"type":"number"}},"required":["removed","voteCount"]}}}}}}},"/support/widget/{key}/board":{"get":{"tags":["support-widget"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"},{"schema":{"type":"string"},"required":true,"name":"x-pile-widget-session","in":"header"}],"responses":{"200":{"description":"Public board items with the session customer's vote flags","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"number"},"title":{"type":"string"},"status":{"type":"string"},"priority":{"type":"string"},"voteCount":{"type":"number"},"voted":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","number","title","status","priority","voteCount","voted","createdAt"]}},"nextCursor":{"type":"string","nullable":true}},"required":["items","nextCursor"]}}}}}}},"/support/widget/{key}/changelog":{"get":{"tags":["support-widget"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"}],"responses":{"200":{"description":"Published changelog entries for the workspace","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"labels":{"type":"array","items":{"type":"string"}},"publishedAt":{"type":"string","nullable":true}},"required":["id","title","body","labels","publishedAt"]}}},"required":["entries"]}}}}}}},"/support/widget/{key}/ideas":{"post":{"tags":["support-widget"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"},{"schema":{"type":"string"},"required":true,"name":"x-pile-widget-session","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":3,"maxLength":200},"text":{"type":"string","maxLength":5000}},"required":["title"]}}}},"responses":{"201":{"description":"Public idea ticket created and auto-voted by the author","content":{"application/json":{"schema":{"type":"object","properties":{"ticketId":{"type":"string"},"voteCount":{"type":"number"}},"required":["ticketId","voteCount"]}}}}}}},"/workspaces/{organizationId}/support-channels":{"get":{"tags":["support-channels"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Support channels list","content":{"application/json":{"schema":{"type":"object","properties":{"channels":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["email"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"emailAddress":{"type":"string"},"color":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["slack"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"channelId":{"type":"string"},"webhookUrl":{"type":"string"},"color":{"type":"string"},"botToken":{"type":"string"},"ingestionMode":{"type":"string","enum":["manual","one_to_one","time_based","ai"]}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["msteams"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"channelId":{"type":"string"},"webhookUrl":{"type":"string"},"color":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["discord"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"channelId":{"type":"string"},"webhookUrl":{"type":"string"},"color":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["chat"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"widgetId":{"type":"string"},"color":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["capture"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"formId":{"type":"string"},"color":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["api"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"endpoint":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["intercom"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"appId":{"type":"string"},"accessToken":{"type":"string"},"adminId":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["zendesk"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"subdomain":{"type":"string"},"accessToken":{"type":"string"},"email":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["plain"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"workspaceId":{"type":"string"},"accessToken":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]}]}}},"required":["channels"]}}}}}},"post":{"tags":["support-channels"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain"]},"name":{"type":"string","minLength":1,"maxLength":200},"config":{"type":"object","additionalProperties":{"type":"string"}},"isActive":{"type":"boolean","default":true}},"required":["type","name"]}}}},"responses":{"201":{"description":"Support channel created","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["email"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"emailAddress":{"type":"string"},"color":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["slack"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"channelId":{"type":"string"},"webhookUrl":{"type":"string"},"color":{"type":"string"},"botToken":{"type":"string"},"ingestionMode":{"type":"string","enum":["manual","one_to_one","time_based","ai"]}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["msteams"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"channelId":{"type":"string"},"webhookUrl":{"type":"string"},"color":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["discord"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"channelId":{"type":"string"},"webhookUrl":{"type":"string"},"color":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["chat"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"widgetId":{"type":"string"},"color":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["capture"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"formId":{"type":"string"},"color":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["api"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"endpoint":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["intercom"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"appId":{"type":"string"},"accessToken":{"type":"string"},"adminId":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["zendesk"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"subdomain":{"type":"string"},"accessToken":{"type":"string"},"email":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]},{"type":"object","properties":{"type":{"type":"string","enum":["plain"]},"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"config":{"type":"object","properties":{"workspaceId":{"type":"string"},"accessToken":{"type":"string"}}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["type","id","organizationId","name","isActive","config","createdAt","updatedAt"]}]}}}}}}},"/support/webhooks/intercom/{organizationId}":{"post":{"tags":["support-channels"],"summary":"Receive Intercom support webhook notifications","parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"x-hub-signature","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"nullable":true}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}}}}},"/support/webhooks/zendesk/{organizationId}":{"post":{"tags":["support-channels"],"summary":"Receive Zendesk support webhook notifications","parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"x-zendesk-webhook-signature","in":"header"},{"schema":{"type":"string"},"required":false,"name":"x-zendesk-webhook-signature-timestamp","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"nullable":true}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}}}}},"/support/webhooks/plain/{organizationId}":{"post":{"tags":["support-channels"],"summary":"Receive Plain support webhook notifications","parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"plain-request-signature","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"nullable":true}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}}}}},"/support/webhooks/slack/{organizationId}":{"post":{"tags":["support-channels"],"summary":"Receive Slack support events","parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"x-slack-signature","in":"header"},{"schema":{"type":"string"},"required":false,"name":"x-slack-request-timestamp","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"nullable":true}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"challenge":{"type":"string"}},"required":["ok"]}}}}}}},"/support/incoming/{channelId}":{"post":{"tags":["support-channels"],"summary":"Receive a generic incoming support message","parameters":[{"schema":{"type":"string"},"required":true,"name":"channelId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"fromEmail":{"type":"string","format":"email"},"fromName":{"type":"string"},"subject":{"type":"string","default":""},"text":{"type":"string"},"html":{"type":"string"},"externalTicketId":{"type":"string"},"externalMessageId":{"type":"string"},"subType":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["fromEmail","text"]}}}},"responses":{"201":{"description":"Message processed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"ticketId":{"type":"string"},"ticketNumber":{"type":"number"}},"required":["ok","ticketId","ticketNumber"]}}}},"404":{"description":"Channel not found or inactive"}}}},"/support/feedback":{"post":{"tags":["support-channels"],"summary":"File product feedback into the configured feedback channel","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string","minLength":5,"maxLength":200},"text":{"type":"string","minLength":20,"maxLength":4000},"fromEmail":{"type":"string","format":"email"},"fromName":{"type":"string","minLength":1,"maxLength":200},"context":{"type":"object","properties":{"client":{"type":"string","minLength":1,"maxLength":100},"version":{"type":"string","minLength":1,"maxLength":50},"os":{"type":"string","minLength":1,"maxLength":100},"workspace":{"type":"string","maxLength":100}},"required":["client","version","os"]}},"required":["subject","text","fromEmail","fromName","context"]}}}},"responses":{"201":{"description":"Feedback filed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"ticketId":{"type":"string"},"ticketNumber":{"type":"number"}},"required":["ok","ticketId","ticketNumber"]}}}},"404":{"description":"Feedback channel not configured"}}}},"/workspaces/{organizationId}/support/channels/{channelId}/send":{"post":{"tags":["support-channels"],"summary":"Send an outbound support message","parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"channelId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ticketId":{"type":"string"},"textContent":{"type":"string"},"markdownContent":{"type":"string"},"subject":{"type":"string"},"idempotencyKey":{"type":"string"}},"required":["ticketId","textContent"]}}}},"responses":{"200":{"description":"Message sent","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"messageId":{"type":"string"},"sent":{"type":"boolean"}},"required":["ok","messageId","sent"]}}}},"400":{"description":"Bad request"},"404":{"description":"Ticket, customer, or channel not found"}}}},"/workspaces/{organizationId}/support/channels/{channelId}/validate":{"post":{"tags":["support-channels"],"summary":"Validate a support channel","parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"channelId","in":"path"}],"responses":{"200":{"description":"Validation result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]}}}},"404":{"description":"Channel not found or inactive"}}}},"/workspaces/{organizationId}/available-users":{"get":{"tags":["workspace-users"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"}],"responses":{"200":{"description":"Users not in this workspace","content":{"application/json":{"schema":{"type":"object","properties":{"users":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":"string","nullable":true}},"required":["id","name","email","image"]}}},"required":["users"]}}}}}}},"/workspaces/{organizationId}/leave":{"post":{"tags":["workspace-users"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"204":{"description":"Left workspace"},"400":{"description":"Cannot leave as only owner"}}}},"/workspaces/{organizationId}/invitations":{"post":{"tags":["workspace-users"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["owner","admin","member"]},"teamId":{"type":"string"}},"required":["email","role"]}}}},"responses":{"201":{"description":"Invitation created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"status":{"type":"string"},"teamId":{"type":"string","nullable":true},"expiresAt":{"type":"integer"},"expired":{"type":"boolean"},"inviterId":{"type":"string"},"createdAt":{"type":"integer"}},"required":["id","organizationId","email","role","status","teamId","expiresAt","expired","inviterId","createdAt"]}}}},"400":{"description":"Invalid email, unknown team, or the address already belongs to a member or pending invitation"}}},"get":{"tags":["workspace-users"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","enum":["pending","accepted","canceled","rejected","expired","all"],"description":"Invitation status filter; defaults to pending (excludes expired rows). `expired` lists pending invitations past their expiry"},"required":false,"description":"Invitation status filter; defaults to pending (excludes expired rows). `expired` lists pending invitations past their expiry","name":"status","in":"query"}],"responses":{"200":{"description":"Invitations list","content":{"application/json":{"schema":{"type":"object","properties":{"invitations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"status":{"type":"string"},"teamId":{"type":"string","nullable":true},"expiresAt":{"type":"integer"},"expired":{"type":"boolean"},"inviterId":{"type":"string"},"createdAt":{"type":"integer"}},"required":["id","organizationId","email","role","status","teamId","expiresAt","expired","inviterId","createdAt"]}}},"required":["invitations"]}}}}}}},"/workspaces/{organizationId}/invitations/{id}":{"delete":{"tags":["workspace-users"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Invitation canceled"},"404":{"description":"Invitation not found"},"409":{"description":"Invitation is not pending"}}}},"/workspaces/{organizationId}/invitations/{id}/resend":{"post":{"tags":["workspace-users"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Invitation resent","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"status":{"type":"string"},"teamId":{"type":"string","nullable":true},"expiresAt":{"type":"integer"},"expired":{"type":"boolean"},"inviterId":{"type":"string"},"createdAt":{"type":"integer"}},"required":["id","organizationId","email","role","status","teamId","expiresAt","expired","inviterId","createdAt"]}}}},"404":{"description":"Invitation not found"},"409":{"description":"Invitation is not pending"},"503":{"description":"Email not configured"}}}},"/workspaces/{organizationId}/usage":{"get":{"tags":["usage"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"period","in":"query"}],"responses":{"200":{"description":"Usage records","content":{"application/json":{"schema":{"type":"object","properties":{"usage":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"period":{"type":"string"},"resource":{"type":"string"},"action":{"type":"string"},"count":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","period","resource","action","count","createdAt","updatedAt"]}}},"required":["usage"]}}}}}},"post":{"tags":["usage"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"period":{"type":"string","minLength":1},"resource":{"type":"string","minLength":1},"action":{"type":"string","minLength":1},"count":{"type":"integer","minimum":0,"default":1}},"required":["period","resource","action"]}}}},"responses":{"201":{"description":"Usage recorded","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"period":{"type":"string"},"resource":{"type":"string"},"action":{"type":"string"},"count":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","period","resource","action","count","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/billing":{"get":{"tags":["billing"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"period","in":"query"}],"responses":{"200":{"description":"Billing usage for the workspace","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"period":{"type":"string"},"plan":{"type":"string","enum":["free","paid"]},"status":{"type":"string","enum":["active","past_due","canceled"]},"cap":{"type":"integer"},"used":{"type":"integer"},"remaining":{"type":"integer"},"upgradeRequired":{"type":"boolean"},"upgradeUrl":{"type":"string"},"usage":{"type":"array","items":{"type":"object","properties":{"resource":{"type":"string"},"action":{"type":"string"},"count":{"type":"integer"}},"required":["resource","action","count"]}},"total":{"type":"integer"}},"required":["organizationId","period","plan","status","cap","used","remaining","upgradeRequired","usage","total"]}}}}}}},"/workspaces/{organizationId}/billing/subscribe":{"post":{"tags":["billing"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Subscribe to the paid plan","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"customerId":{"type":"string","nullable":true},"upgradeUrl":{"type":"string","nullable":true}},"required":["organizationId","customerId","upgradeUrl"]}}}},"503":{"description":"Billing not configured","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/workspaces/{organizationId}/billing/plan":{"post":{"tags":["billing"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"type":"string","enum":["free","paid"]},"status":{"type":"string","enum":["active","past_due","canceled"]}},"required":["plan"]}}}},"responses":{"200":{"description":"Updated billing account","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"plan":{"type":"string","enum":["free","paid"]},"status":{"type":"string","enum":["active","past_due","canceled"]},"vortexCustomerId":{"type":"string","nullable":true},"currentPeriodEnd":{"type":"string","nullable":true}},"required":["organizationId","plan","status","vortexCustomerId","currentPeriodEnd"]}}}}}}},"/billing/webhook":{"post":{"tags":["billing"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string"},"data":{"type":"object","properties":{"externalCustomerRef":{"type":"string"},"status":{"type":"string"},"currentPeriodEnd":{"type":"string"}},"additionalProperties":{"nullable":true}}},"required":["type","data"]}}}},"responses":{"200":{"description":"Webhook processed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}}}}},"/workspaces/{organizationId}/view-preferences":{"get":{"tags":["view-preferences"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"View preferences","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"userId":{"type":"string"},"defaultViewId":{"type":"string","nullable":true},"updatedAt":{"type":"string"}},"required":["organizationId","userId","defaultViewId","updatedAt"]}}}}}},"put":{"tags":["view-preferences"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"defaultViewId":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"Preferences updated","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"userId":{"type":"string"},"defaultViewId":{"type":"string","nullable":true},"updatedAt":{"type":"string"}},"required":["organizationId","userId","defaultViewId","updatedAt"]}}}}}}},"/workspaces/{organizationId}/time-schedules":{"get":{"tags":["time-schedules"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Time schedules","content":{"application/json":{"schema":{"type":"object","properties":{"timeSchedules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"timeData":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","timeData","createdAt","updatedAt"]}}},"required":["timeSchedules"]}}}}}},"post":{"tags":["time-schedules"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"timeData":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"Time schedule created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"timeData":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","timeData","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/time-schedules/{id}":{"get":{"tags":["time-schedules"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Time schedule","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"timeData":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","timeData","createdAt","updatedAt"]}}}},"404":{"description":"Time schedule not found"}}},"patch":{"tags":["time-schedules"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"timeData":{"type":"string"}}}}}},"responses":{"200":{"description":"Time schedule updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"timeData":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","timeData","createdAt","updatedAt"]}}}},"404":{"description":"Time schedule not found"}}},"delete":{"tags":["time-schedules"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Time schedule deleted"},"404":{"description":"Time schedule not found"}}}},"/workspaces/{organizationId}/git-automation-states":{"get":{"tags":["git-automation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Git automation states","content":{"application/json":{"schema":{"type":"object","properties":{"states":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"stateId":{"type":"string"},"prState":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","stateId","prState","createdAt"]}}},"required":["states"]}}}}}},"post":{"tags":["git-automation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"stateId":{"type":"string"},"prState":{"type":"string"}},"required":["stateId","prState"]}}}},"responses":{"201":{"description":"State created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"stateId":{"type":"string"},"prState":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","stateId","prState","createdAt"]}}}}}}},"/workspaces/{organizationId}/git-automation-states/{id}":{"get":{"tags":["git-automation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"State","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"stateId":{"type":"string"},"prState":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","stateId","prState","createdAt"]}}}},"404":{"description":"State not found"}}},"patch":{"tags":["git-automation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"stateId":{"type":"string"},"prState":{"type":"string"}}}}}},"responses":{"200":{"description":"State updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"stateId":{"type":"string"},"prState":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","stateId","prState","createdAt"]}}}},"404":{"description":"State not found"}}},"delete":{"tags":["git-automation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"State deleted"},"404":{"description":"State not found"}}}},"/workspaces/{organizationId}/git-automation-target-branches":{"get":{"tags":["git-automation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Target branches","content":{"application/json":{"schema":{"type":"object","properties":{"branches":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"pattern":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","name","pattern","createdAt"]}}},"required":["branches"]}}}}}},"post":{"tags":["git-automation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"pattern":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"Target branch created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"pattern":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","name","pattern","createdAt"]}}}}}}},"/workspaces/{organizationId}/git-automation-target-branches/{id}":{"get":{"tags":["git-automation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Target branch","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"pattern":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","name","pattern","createdAt"]}}}},"404":{"description":"Target branch not found"}}},"patch":{"tags":["git-automation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"pattern":{"type":"string"}}}}}},"responses":{"200":{"description":"Target branch updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"pattern":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","name","pattern","createdAt"]}}}},"404":{"description":"Target branch not found"}}},"delete":{"tags":["git-automation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Target branch deleted"},"404":{"description":"Target branch not found"}}}},"/workspaces/{organizationId}/git/identities":{"get":{"tags":["git-identities"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Git identities","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"repo":{"type":"string"},"name":{"type":"string"},"email":{"type":"string","pattern":"^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$"},"githubUsername":{"type":"string","nullable":true},"signingKeyRef":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","repo","name","email","githubUsername","signingKeyRef","createdAt","updatedAt"]}}}}}}},"post":{"tags":["git-identities"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"repo":{"type":"string"},"name":{"type":"string"},"email":{"type":"string","pattern":"^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$"},"githubUsername":{"type":"string","nullable":true},"signingKeyRef":{"type":"string","nullable":true}},"required":["repo","name","email"]}}}},"responses":{"200":{"description":"Git identity saved","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"repo":{"type":"string"},"name":{"type":"string"},"email":{"type":"string","pattern":"^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$"},"githubUsername":{"type":"string","nullable":true},"signingKeyRef":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","repo","name","email","githubUsername","signingKeyRef","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/git/identities/{id}":{"delete":{"tags":["git-identities"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Git identity deleted"},"404":{"description":"Git identity not found"}}}},"/workspaces/{organizationId}/files":{"post":{"tags":["files"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filename":{"type":"string","minLength":1},"contentType":{"type":"string"},"contentBase64":{"type":"string","minLength":1}},"required":["filename","contentBase64"]}}}},"responses":{"201":{"description":"File uploaded","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"url":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer"}},"required":["id","key","url","contentType","size"]}}}},"503":{"description":"File storage not configured"}}},"get":{"tags":["files"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"key","in":"query"}],"responses":{"200":{"description":"File content"},"404":{"description":"File not found"},"503":{"description":"File storage not configured"}}}},"/workspaces/{organizationId}/images/from-url":{"post":{"tags":["files"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"filename":{"type":"string"}},"required":["url"]}}}},"responses":{"201":{"description":"Image uploaded","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"url":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer"}},"required":["id","key","url","contentType","size"]}}}},"503":{"description":"File storage not configured"}}}},"/workspaces/{organizationId}/gitlab/users":{"post":{"tags":["gitlab"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"gitlabUsername":{"type":"string"}},"required":["userId","gitlabUsername"]}}}},"responses":{"201":{"description":"GitLab user mapping created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string"},"gitlabUsername":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","userId","gitlabUsername","createdAt"]}}}}}},"get":{"tags":["gitlab"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"GitLab user mappings","content":{"application/json":{"schema":{"type":"object","properties":{"users":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string"},"gitlabUsername":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","userId","gitlabUsername","createdAt"]}}},"required":["users"]}}}}}}},"/workspaces/{organizationId}/gitlab/install":{"post":{"tags":["gitlab"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"type":"string"},"projectPath":{"type":"string"},"token":{"type":"string"},"webhookSecret":{"type":"string"}},"required":["projectId","projectPath","token"]}}}},"responses":{"200":{"description":"GitLab project installed","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"projectId":{"type":"string"},"projectPath":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","projectId","projectPath","createdAt"]}}}}}}},"/workspaces/{organizationId}/gitlab/installations":{"get":{"tags":["gitlab"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"GitLab installations","content":{"application/json":{"schema":{"type":"object","properties":{"installations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"projectId":{"type":"string"},"projectPath":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","projectId","projectPath","createdAt"]}}},"required":["installations"]}}}}}}},"/workspaces/{organizationId}/gitlab/installations/{id}":{"delete":{"tags":["gitlab"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Installation removed"}}}},"/workspaces/{organizationId}/issues/{issueId}/comments":{"get":{"tags":["comments"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"responses":{"200":{"description":"Comments list","content":{"application/json":{"schema":{"type":"object","properties":{"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string","nullable":true},"documentId":{"type":"string","nullable":true},"authorId":{"type":"string","nullable":true},"body":{"type":"string"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string","nullable":true},"externalAuthor":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"resolvedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","issueId","documentId","authorId","body","externalId","externalSource","externalAuthor","resolvedAt","resolvedById","createdAt","updatedAt"]}}},"required":["comments"]}}}}}},"post":{"tags":["comments"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","minLength":1}},"required":["body"]}}}},"responses":{"201":{"description":"Comment created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string","nullable":true},"documentId":{"type":"string","nullable":true},"authorId":{"type":"string","nullable":true},"body":{"type":"string"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string","nullable":true},"externalAuthor":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"resolvedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","issueId","documentId","authorId","body","externalId","externalSource","externalAuthor","resolvedAt","resolvedById","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/issues/{issueId}/comments/{id}":{"get":{"tags":["comments"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Comment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string","nullable":true},"documentId":{"type":"string","nullable":true},"authorId":{"type":"string","nullable":true},"body":{"type":"string"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string","nullable":true},"externalAuthor":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"resolvedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","issueId","documentId","authorId","body","externalId","externalSource","externalAuthor","resolvedAt","resolvedById","createdAt","updatedAt"]}}}}}},"patch":{"tags":["comments"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","minLength":1}},"required":["body"]}}}},"responses":{"200":{"description":"Comment updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string","nullable":true},"documentId":{"type":"string","nullable":true},"authorId":{"type":"string","nullable":true},"body":{"type":"string"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string","nullable":true},"externalAuthor":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"resolvedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","issueId","documentId","authorId","body","externalId","externalSource","externalAuthor","resolvedAt","resolvedById","createdAt","updatedAt"]}}}}}},"delete":{"tags":["comments"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Comment deleted"}}}},"/workspaces/{organizationId}/issues/{issueId}/comments/{id}/resolve":{"post":{"tags":["comments"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Comment resolved","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string","nullable":true},"documentId":{"type":"string","nullable":true},"authorId":{"type":"string","nullable":true},"body":{"type":"string"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string","nullable":true},"externalAuthor":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"resolvedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","issueId","documentId","authorId","body","externalId","externalSource","externalAuthor","resolvedAt","resolvedById","createdAt","updatedAt"]}}}},"404":{"description":"Comment not found"}}}},"/workspaces/{organizationId}/issues/{issueId}/comments/{id}/unresolve":{"post":{"tags":["comments"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Comment unresolved","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string","nullable":true},"documentId":{"type":"string","nullable":true},"authorId":{"type":"string","nullable":true},"body":{"type":"string"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string","nullable":true},"externalAuthor":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"resolvedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","issueId","documentId","authorId","body","externalId","externalSource","externalAuthor","resolvedAt","resolvedById","createdAt","updatedAt"]}}}},"404":{"description":"Comment not found"}}}},"/workspaces/{organizationId}/documents":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"projectId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"issueId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"initiativeId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"parentDocumentId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"spaceId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"isTemplate","in":"query"},{"schema":{"type":"string"},"required":false,"name":"includeTrashed","in":"query"}],"responses":{"200":{"description":"Document list","content":{"application/json":{"schema":{"type":"object","properties":{"documents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","nullable":true},"content":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},{"type":"string"}]},"contentFormat":{"type":"string","enum":["blocks","markdown"]},"slug":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"initiativeId":{"type":"string","nullable":true},"parentDocumentId":{"type":"string","nullable":true},"spaceId":{"type":"string","nullable":true},"isTemplate":{"type":"boolean"},"createdById":{"type":"string"},"updatedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"trashedAt":{"type":"string","nullable":true}},"required":["id","organizationId","title","icon","content","contentFormat","slug","projectId","issueId","initiativeId","parentDocumentId","spaceId","isTemplate","createdById","updatedById","createdAt","updatedAt","trashedAt"]}}},"required":["documents"]}}}}}},"post":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"icon":{"type":"string"},"content":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},{"type":"string"}]},"contentFormat":{"type":"string","enum":["blocks","markdown"]},"slug":{"type":"string"},"projectId":{"type":"string"},"issueId":{"type":"string"},"initiativeId":{"type":"string"},"parentDocumentId":{"type":"string"},"spaceId":{"type":"string"},"isTemplate":{"type":"boolean"}},"required":["title"]}}}},"responses":{"201":{"description":"Document created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","nullable":true},"content":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},{"type":"string"}]},"contentFormat":{"type":"string","enum":["blocks","markdown"]},"slug":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"initiativeId":{"type":"string","nullable":true},"parentDocumentId":{"type":"string","nullable":true},"spaceId":{"type":"string","nullable":true},"isTemplate":{"type":"boolean"},"createdById":{"type":"string"},"updatedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"trashedAt":{"type":"string","nullable":true}},"required":["id","organizationId","title","icon","content","contentFormat","slug","projectId","issueId","initiativeId","parentDocumentId","spaceId","isTemplate","createdById","updatedById","createdAt","updatedAt","trashedAt"]}}}}}}},"/workspaces/{organizationId}/documents/{id}":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Document","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","nullable":true},"content":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},{"type":"string"}]},"contentFormat":{"type":"string","enum":["blocks","markdown"]},"slug":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"initiativeId":{"type":"string","nullable":true},"parentDocumentId":{"type":"string","nullable":true},"spaceId":{"type":"string","nullable":true},"isTemplate":{"type":"boolean"},"createdById":{"type":"string"},"updatedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"trashedAt":{"type":"string","nullable":true}},"required":["id","organizationId","title","icon","content","contentFormat","slug","projectId","issueId","initiativeId","parentDocumentId","spaceId","isTemplate","createdById","updatedById","createdAt","updatedAt","trashedAt"]}}}},"404":{"description":"Document not found"}}},"patch":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"icon":{"type":"string","nullable":true},"content":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},{"type":"string"}]},"contentFormat":{"type":"string","enum":["blocks","markdown"]},"slug":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"initiativeId":{"type":"string","nullable":true},"parentDocumentId":{"type":"string","nullable":true},"spaceId":{"type":"string","nullable":true},"isTemplate":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Document updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","nullable":true},"content":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},{"type":"string"}]},"contentFormat":{"type":"string","enum":["blocks","markdown"]},"slug":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"initiativeId":{"type":"string","nullable":true},"parentDocumentId":{"type":"string","nullable":true},"spaceId":{"type":"string","nullable":true},"isTemplate":{"type":"boolean"},"createdById":{"type":"string"},"updatedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"trashedAt":{"type":"string","nullable":true}},"required":["id","organizationId","title","icon","content","contentFormat","slug","projectId","issueId","initiativeId","parentDocumentId","spaceId","isTemplate","createdById","updatedById","createdAt","updatedAt","trashedAt"]}}}},"404":{"description":"Document not found"}}},"delete":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Document deleted"},"404":{"description":"Document not found"}}}},"/workspaces/{organizationId}/documents/{id}/restore":{"post":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Document restored","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","nullable":true},"content":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},{"type":"string"}]},"contentFormat":{"type":"string","enum":["blocks","markdown"]},"slug":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"initiativeId":{"type":"string","nullable":true},"parentDocumentId":{"type":"string","nullable":true},"spaceId":{"type":"string","nullable":true},"isTemplate":{"type":"boolean"},"createdById":{"type":"string"},"updatedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"trashedAt":{"type":"string","nullable":true}},"required":["id","organizationId","title","icon","content","contentFormat","slug","projectId","issueId","initiativeId","parentDocumentId","spaceId","isTemplate","createdById","updatedById","createdAt","updatedAt","trashedAt"]}}}},"404":{"description":"Document not found"}}}},"/workspaces/{organizationId}/documents/{id}/history":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Document content history, newest first","content":{"application/json":{"schema":{"type":"object","properties":{"history":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"documentId":{"type":"string"},"content":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},{"type":"string"}]},"actorId":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","documentId","content","actorId","createdAt"]}}},"required":["history"]}}}},"404":{"description":"Document not found"}}}},"/workspaces/{organizationId}/document-spaces":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Document spaces","content":{"application/json":{"schema":{"type":"object","properties":{"spaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"icon":{"type":"string","nullable":true},"publicSharing":{"type":"boolean"},"createdById":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","description","icon","publicSharing","createdById","createdAt"]}}},"required":["spaces"]}}}}}},"post":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"icon":{"type":"string"},"publicSharing":{"type":"boolean"}},"required":["name"]}}}},"responses":{"201":{"description":"Space created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"icon":{"type":"string","nullable":true},"publicSharing":{"type":"boolean"},"createdById":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","description","icon","publicSharing","createdById","createdAt"]}}}}}}},"/workspaces/{organizationId}/document-spaces/{id}":{"patch":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"icon":{"type":"string","nullable":true},"publicSharing":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Space updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"icon":{"type":"string","nullable":true},"publicSharing":{"type":"boolean"},"createdById":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","description","icon","publicSharing","createdById","createdAt"]}}}},"404":{"description":"Space not found"}}},"delete":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Space deleted; documents are unlinked"},"404":{"description":"Space not found"}}}},"/workspaces/{organizationId}/documents/{id}/comments":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Document comments","content":{"application/json":{"schema":{"type":"object","properties":{"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string","nullable":true},"documentId":{"type":"string","nullable":true},"authorId":{"type":"string","nullable":true},"body":{"type":"string"},"resolvedAt":{"type":"string","nullable":true},"resolvedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","issueId","documentId","authorId","body","resolvedAt","resolvedById","createdAt","updatedAt"]}}},"required":["comments"]}}}},"404":{"description":"Document not found"}}},"post":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","minLength":1}},"required":["body"]}}}},"responses":{"201":{"description":"Comment created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string","nullable":true},"documentId":{"type":"string","nullable":true},"authorId":{"type":"string","nullable":true},"body":{"type":"string"},"resolvedAt":{"type":"string","nullable":true},"resolvedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","issueId","documentId","authorId","body","resolvedAt","resolvedById","createdAt","updatedAt"]}}}},"404":{"description":"Document not found"}}}},"/workspaces/{organizationId}/comments/{commentId}/resolve":{"post":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"commentId","in":"path"}],"responses":{"200":{"description":"Comment resolved","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string","nullable":true},"documentId":{"type":"string","nullable":true},"authorId":{"type":"string","nullable":true},"body":{"type":"string"},"resolvedAt":{"type":"string","nullable":true},"resolvedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","issueId","documentId","authorId","body","resolvedAt","resolvedById","createdAt","updatedAt"]}}}},"404":{"description":"Comment not found"}}}},"/workspaces/{organizationId}/comments/{commentId}/unresolve":{"post":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"commentId","in":"path"}],"responses":{"200":{"description":"Comment unresolved","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string","nullable":true},"documentId":{"type":"string","nullable":true},"authorId":{"type":"string","nullable":true},"body":{"type":"string"},"resolvedAt":{"type":"string","nullable":true},"resolvedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","issueId","documentId","authorId","body","resolvedAt","resolvedById","createdAt","updatedAt"]}}}},"404":{"description":"Comment not found"}}}},"/workspaces/{organizationId}/documents/{id}/share":{"post":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"includeChildren":{"type":"boolean"},"expiresAt":{"type":"string"}}}}}},"responses":{"201":{"description":"Share link created","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"documentId":{"type":"string"},"includeChildren":{"type":"boolean"},"createdAt":{"type":"string"},"expiresAt":{"type":"string","nullable":true}},"required":["token","documentId","includeChildren","createdAt","expiresAt"]}}}},"404":{"description":"Document not found"}}}},"/workspaces/{organizationId}/documents/{id}/share/{token}":{"delete":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"token","in":"path"}],"responses":{"204":{"description":"Share revoked"},"404":{"description":"Share not found"}}}},"/shared-documents/{organizationId}/{token}":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"token","in":"path"}],"responses":{"200":{"description":"Shared document","content":{"application/json":{"schema":{"type":"object","properties":{"document":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","nullable":true},"content":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},{"type":"string"}]},"contentFormat":{"type":"string","enum":["blocks","markdown"]},"slug":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"initiativeId":{"type":"string","nullable":true},"parentDocumentId":{"type":"string","nullable":true},"spaceId":{"type":"string","nullable":true},"isTemplate":{"type":"boolean"},"createdById":{"type":"string"},"updatedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"trashedAt":{"type":"string","nullable":true}},"required":["id","organizationId","title","icon","content","contentFormat","slug","projectId","issueId","initiativeId","parentDocumentId","spaceId","isTemplate","createdById","updatedById","createdAt","updatedAt","trashedAt"]},"children":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","nullable":true},"content":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},{"type":"string"}]},"contentFormat":{"type":"string","enum":["blocks","markdown"]},"slug":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"initiativeId":{"type":"string","nullable":true},"parentDocumentId":{"type":"string","nullable":true},"spaceId":{"type":"string","nullable":true},"isTemplate":{"type":"boolean"},"createdById":{"type":"string"},"updatedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"trashedAt":{"type":"string","nullable":true}},"required":["id","organizationId","title","icon","content","contentFormat","slug","projectId","issueId","initiativeId","parentDocumentId","spaceId","isTemplate","createdById","updatedById","createdAt","updatedAt","trashedAt"]}}},"required":["document"]}}}},"404":{"description":"Share not found or expired"}}}},"/workspaces/{organizationId}/documents/{id}/watch":{"post":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Watching document"},"404":{"description":"Document not found"}}},"delete":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Unwatched"}}}},"/workspaces/{organizationId}/documents/search":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"q","in":"query"}],"responses":{"200":{"description":"Matching documents","content":{"application/json":{"schema":{"type":"object","properties":{"documents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","nullable":true},"content":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},{"type":"string"}]},"contentFormat":{"type":"string","enum":["blocks","markdown"]},"slug":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"initiativeId":{"type":"string","nullable":true},"parentDocumentId":{"type":"string","nullable":true},"spaceId":{"type":"string","nullable":true},"isTemplate":{"type":"boolean"},"createdById":{"type":"string"},"updatedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"trashedAt":{"type":"string","nullable":true}},"required":["id","organizationId","title","icon","content","contentFormat","slug","projectId","issueId","initiativeId","parentDocumentId","spaceId","isTemplate","createdById","updatedById","createdAt","updatedAt","trashedAt"]}}},"required":["documents"]}}}}}}},"/workspaces/{organizationId}/documents/{id}/permissions":{"put":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"actorId":{"type":"string"},"actorType":{"type":"string","enum":["user","agent","team"]},"level":{"type":"string","enum":["view","edit"]}},"required":["actorId","level"]}}}},"responses":{"200":{"description":"Permission set"},"404":{"description":"Document not found"}}}},"/workspaces/{organizationId}/documents/{id}/permissions/{actorId}":{"delete":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"actorId","in":"path"}],"responses":{"204":{"description":"Permission revoked"}}}},"/workspaces/{organizationId}/documents/{id}/links":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Outgoing links from this document","content":{"application/json":{"schema":{"type":"object","properties":{"links":{"type":"array","items":{"type":"object","properties":{"targetType":{"type":"string"},"targetId":{"type":"string"}},"required":["targetType","targetId"]}}},"required":["links"]}}}}}}},"/workspaces/{organizationId}/documents/{id}/backlinks":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Documents that link to this document","content":{"application/json":{"schema":{"type":"object","properties":{"documents":{"type":"array","items":{"type":"string"}}},"required":["documents"]}}}}}}},"/workspaces/{organizationId}/issues/{issueId}/documents":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"responses":{"200":{"description":"Documents that link to this issue","content":{"application/json":{"schema":{"type":"object","properties":{"documents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","nullable":true},"content":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},{"type":"string"}]},"contentFormat":{"type":"string","enum":["blocks","markdown"]},"slug":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"initiativeId":{"type":"string","nullable":true},"parentDocumentId":{"type":"string","nullable":true},"spaceId":{"type":"string","nullable":true},"isTemplate":{"type":"boolean"},"createdById":{"type":"string"},"updatedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"trashedAt":{"type":"string","nullable":true}},"required":["id","organizationId","title","icon","content","contentFormat","slug","projectId","issueId","initiativeId","parentDocumentId","spaceId","isTemplate","createdById","updatedById","createdAt","updatedAt","trashedAt"]}}},"required":["documents"]}}}}}}},"/workspaces/{organizationId}/documents/{id}/history/{entryId}/restore":{"post":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"entryId","in":"path"}],"responses":{"200":{"description":"Document restored to the given history entry","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","nullable":true},"content":{"anyOf":[{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},{"type":"string"}]},"contentFormat":{"type":"string","enum":["blocks","markdown"]},"slug":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"initiativeId":{"type":"string","nullable":true},"parentDocumentId":{"type":"string","nullable":true},"spaceId":{"type":"string","nullable":true},"isTemplate":{"type":"boolean"},"createdById":{"type":"string"},"updatedById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"trashedAt":{"type":"string","nullable":true}},"required":["id","organizationId","title","icon","content","contentFormat","slug","projectId","issueId","initiativeId","parentDocumentId","spaceId","isTemplate","createdById","updatedById","createdAt","updatedAt","trashedAt"]}}}},"404":{"description":"Document or history entry not found"}}}},"/workspaces/{organizationId}/emojis":{"get":{"tags":["emojis"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Emojis","content":{"application/json":{"schema":{"type":"object","properties":{"emojis":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"shortcut":{"type":"string"},"url":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","shortcut","url","createdAt"]}}},"required":["emojis"]}}}}}},"post":{"tags":["emojis"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"shortcut":{"type":"string","minLength":1},"url":{"type":"string","format":"uri"}},"required":["name","shortcut","url"]}}}},"responses":{"201":{"description":"Emoji created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"shortcut":{"type":"string"},"url":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","shortcut","url","createdAt"]}}}}}}},"/workspaces/{organizationId}/emojis/{id}":{"get":{"tags":["emojis"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Emoji","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"shortcut":{"type":"string"},"url":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","shortcut","url","createdAt"]}}}},"404":{"description":"Emoji not found"}}},"patch":{"tags":["emojis"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"shortcut":{"type":"string","minLength":1},"url":{"type":"string","format":"uri"}}}}}},"responses":{"200":{"description":"Emoji updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"shortcut":{"type":"string"},"url":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","shortcut","url","createdAt"]}}}},"404":{"description":"Emoji not found"}}},"delete":{"tags":["emojis"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Emoji deleted"},"404":{"description":"Emoji not found"}}}},"/docs/{organizationId}/{spaceId}/llms.txt":{"get":{"tags":["docs-site"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"spaceId","in":"path"}],"responses":{"200":{"description":"llms.txt index of published documents in the space","content":{"text/plain":{"schema":{"type":"string"}}}},"404":{"description":"Space not found or not public"}}}},"/docs/{organizationId}/{spaceId}/{slug}":{"get":{"tags":["docs-site"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"spaceId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"Document content as markdown","content":{"text/markdown":{"schema":{"type":"string"}}}},"404":{"description":"Document not found or not published"}}}},"/workspaces/{organizationId}/audit-log":{"get":{"tags":["audit"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"entityType","in":"query"},{"schema":{"type":"string"},"required":false,"name":"entityId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"action","in":"query"},{"schema":{"type":"string"},"required":false,"name":"actorId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Workspace audit log, newest first","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"actorId":{"type":"string","nullable":true},"actorType":{"type":"string","nullable":true},"action":{"type":"string"},"entityType":{"type":"string"},"entityId":{"type":"string"},"changes":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"ip":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"userAgent":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","actorId","actorType","action","entityType","entityId","changes","ip","country","userAgent","createdAt"]}}},"required":["entries"]}}}}}}},"/workspaces/{organizationId}/audit-log/{id}":{"get":{"tags":["audit"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Audit log entry","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"actorId":{"type":"string","nullable":true},"actorType":{"type":"string","nullable":true},"action":{"type":"string"},"entityType":{"type":"string"},"entityId":{"type":"string"},"changes":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"ip":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"userAgent":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","actorId","actorType","action","entityType","entityId","changes","ip","country","userAgent","createdAt"]}}}},"404":{"description":"Audit log entry not found"}}}},"/workspaces/{organizationId}/customers":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Customer list","content":{"application/json":{"schema":{"type":"object","properties":{"customers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"url":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"tierId":{"type":"string","nullable":true},"statusId":{"type":"string","nullable":true},"ownerId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","url","logoUrl","externalId","tierId","statusId","ownerId","createdAt","updatedAt"]}}},"required":["customers"]}}}}}},"post":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"url":{"type":"string"},"logoUrl":{"type":"string"},"externalId":{"type":"string"},"tierId":{"type":"string"},"statusId":{"type":"string"},"ownerId":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"Customer created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"url":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"tierId":{"type":"string","nullable":true},"statusId":{"type":"string","nullable":true},"ownerId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","url","logoUrl","externalId","tierId","statusId","ownerId","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/customers/{id}":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Customer","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"url":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"tierId":{"type":"string","nullable":true},"statusId":{"type":"string","nullable":true},"ownerId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","url","logoUrl","externalId","tierId","statusId","ownerId","createdAt","updatedAt"]}}}},"404":{"description":"Customer not found"}}},"patch":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"url":{"type":"string"},"logoUrl":{"type":"string"},"externalId":{"type":"string"},"tierId":{"type":"string"},"statusId":{"type":"string"},"ownerId":{"type":"string"}}}}}},"responses":{"200":{"description":"Customer updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"url":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"tierId":{"type":"string","nullable":true},"statusId":{"type":"string","nullable":true},"ownerId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","url","logoUrl","externalId","tierId","statusId","ownerId","createdAt","updatedAt"]}}}},"404":{"description":"Customer not found"}}},"delete":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Customer deleted"},"404":{"description":"Customer not found"}}}},"/workspaces/{organizationId}/customers/{id}/attachments":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Customer attachments","content":{"application/json":{"schema":{"type":"object","properties":{"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"fileName":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer"},"r2Key":{"type":"string"},"url":{"type":"string"},"createdById":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","customerId","fileName","contentType","size","r2Key","url","createdById","createdAt"]}}},"required":["attachments"]}}}},"404":{"description":"Customer not found"}}},"post":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"fileName":{"type":"string","minLength":1},"contentType":{"type":"string"},"contentBase64":{"type":"string","minLength":1}},"required":["fileName","contentBase64"]}}}},"responses":{"201":{"description":"Attachment uploaded","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"fileName":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer"},"r2Key":{"type":"string"},"url":{"type":"string"},"createdById":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","customerId","fileName","contentType","size","r2Key","url","createdById","createdAt"]}}}},"404":{"description":"Customer not found"},"503":{"description":"File storage not configured"}}}},"/workspaces/{organizationId}/customers/{id}/attachments/{attachmentId}":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"attachmentId","in":"path"}],"responses":{"200":{"description":"Customer attachment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"fileName":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer"},"r2Key":{"type":"string"},"url":{"type":"string"},"createdById":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","customerId","fileName","contentType","size","r2Key","url","createdById","createdAt"]}}}},"404":{"description":"Attachment not found"}}},"delete":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"attachmentId","in":"path"}],"responses":{"204":{"description":"Attachment deleted"},"404":{"description":"Attachment not found"}}}},"/workspaces/{organizationId}/customers/{id}/attachments/{attachmentId}/content":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"attachmentId","in":"path"}],"responses":{"200":{"description":"Attachment content"},"404":{"description":"Attachment not found"},"503":{"description":"File storage not configured"}}}},"/workspaces/{organizationId}/customer-tiers":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Customer tiers","content":{"application/json":{"schema":{"type":"object","properties":{"tiers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"position":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","color","position","createdAt"]}}},"required":["tiers"]}}}}}},"post":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"color":{"type":"string"},"position":{"type":"number"}},"required":["name"]}}}},"responses":{"201":{"description":"Tier created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"position":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","color","position","createdAt"]}}}}}}},"/workspaces/{organizationId}/customer-tiers/{id}":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Tier","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"position":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","color","position","createdAt"]}}}},"404":{"description":"Tier not found"}}},"patch":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"color":{"type":"string"},"position":{"type":"number"}}}}}},"responses":{"200":{"description":"Tier updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"position":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","color","position","createdAt"]}}}},"404":{"description":"Tier not found"}}},"delete":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Tier deleted"},"404":{"description":"Tier not found"}}}},"/workspaces/{organizationId}/customer-statuses":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Customer statuses","content":{"application/json":{"schema":{"type":"object","properties":{"statuses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"position":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","color","position","createdAt"]}}},"required":["statuses"]}}}}}},"post":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"color":{"type":"string"},"position":{"type":"number"}},"required":["name"]}}}},"responses":{"201":{"description":"Status created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"position":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","color","position","createdAt"]}}}}}}},"/workspaces/{organizationId}/customer-statuses/{id}":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Status","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"position":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","color","position","createdAt"]}}}},"404":{"description":"Status not found"}}},"patch":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"color":{"type":"string"},"position":{"type":"number"}}}}}},"responses":{"200":{"description":"Status updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"position":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","organizationId","name","color","position","createdAt"]}}}},"404":{"description":"Status not found"}}},"delete":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Status deleted"},"404":{"description":"Status not found"}}}},"/workspaces/{organizationId}/customer-needs":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"customerId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"issueId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"projectId","in":"query"}],"responses":{"200":{"description":"Customer needs","content":{"application/json":{"schema":{"type":"object","properties":{"needs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"issueId":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"priority":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","customerId","issueId","projectId","priority","note","createdAt"]}}},"required":["needs"]}}}}}},"post":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"issueId":{"type":"string"},"projectId":{"type":"string"},"priority":{"type":"string"},"note":{"type":"string"}},"required":["customerId"]}}}},"responses":{"201":{"description":"Need created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"issueId":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"priority":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","customerId","issueId","projectId","priority","note","createdAt"]}}}}}}},"/workspaces/{organizationId}/customer-needs/{id}":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Need","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"issueId":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"priority":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","customerId","issueId","projectId","priority","note","createdAt"]}}}},"404":{"description":"Need not found"}}},"patch":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"issueId":{"type":"string"},"projectId":{"type":"string"},"priority":{"type":"string"},"note":{"type":"string"}}}}}},"responses":{"200":{"description":"Need updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"issueId":{"type":"string","nullable":true},"projectId":{"type":"string","nullable":true},"priority":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","customerId","issueId","projectId","priority","note","createdAt"]}}}},"404":{"description":"Need not found"}}},"delete":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Need deleted"},"404":{"description":"Need not found"}}}},"/workspaces/{organizationId}/customers/{id}/intake":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Customer intake items (inbound mail filed on the record)","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"source":{"type":"string"},"inboxId":{"type":"string","nullable":true},"fromAddress":{"type":"string"},"fromName":{"type":"string","nullable":true},"toAddress":{"type":"string"},"subject":{"type":"string","nullable":true},"text":{"type":"string","nullable":true},"html":{"type":"string","nullable":true},"externalId":{"type":"string"},"messageId":{"type":"string","nullable":true},"attachments":{"type":"array","nullable":true,"items":{"type":"object","properties":{"key":{"type":"string","nullable":true},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"number"}},"required":["key","filename","contentType","size"]}},"receivedAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","customerId","source","inboxId","fromAddress","fromName","toAddress","subject","text","html","externalId","messageId","attachments","receivedAt","createdAt"]}}},"required":["items"]}}}},"404":{"description":"Customer not found"}}}},"/support/unsubscribe":{"post":{"tags":["support-contacts"],"summary":"Opt a customer email out of outbound notifications","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"email":{"type":"string","format":"email"}},"required":["organizationId","email"]}}}},"responses":{"200":{"description":"Opt-out recorded","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}}}}},"/workspaces/{organizationId}/support/customers":{"post":{"tags":["support-contacts"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"fullName":{"type":"string"},"phone":{"type":"string"},"userId":{"type":"string"},"externalId":{"type":"string"},"externalSource":{"type":"string"},"companies":{"type":"array","items":{"type":"object","properties":{"companyId":{"type":"string"},"isPrimary":{"type":"boolean","default":false}},"required":["companyId"]}},"identities":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"subType":{"type":"string"},"value":{"type":"string"},"isPrimary":{"type":"boolean","default":false}},"required":["type","value"]}}},"required":["email"]}}}},"responses":{"201":{"description":"Customer created","content":{"application/json":{"schema":{"type":"object","properties":{"customer":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"emailOptOut":{"type":"boolean"},"emailOptOutAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"companyId":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","customerId","companyId","name","isPrimary","createdAt"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"subType":{"type":"string","nullable":true},"value":{"type":"string"},"isPrimary":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","customerId","type","subType","value","isPrimary","createdAt"]}}},"required":["id","organizationId","userId","externalId","externalSource","email","fullName","phone","emailOptOut","emailOptOutAt","createdAt","updatedAt","companies","identities"]}},"required":["customer"]}}}}}},"get":{"tags":["support-contacts"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string"},"required":false,"name":"companyId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"}],"responses":{"200":{"description":"Customers list","content":{"application/json":{"schema":{"type":"object","properties":{"customers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"emailOptOut":{"type":"boolean"},"emailOptOutAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"companyId":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","customerId","companyId","name","isPrimary","createdAt"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"subType":{"type":"string","nullable":true},"value":{"type":"string"},"isPrimary":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","customerId","type","subType","value","isPrimary","createdAt"]}}},"required":["id","organizationId","userId","externalId","externalSource","email","fullName","phone","emailOptOut","emailOptOutAt","createdAt","updatedAt","companies","identities"]}},"nextCursor":{"type":"string","nullable":true}},"required":["customers","nextCursor"]}}}}}}},"/workspaces/{organizationId}/support/customers/{customerId}":{"get":{"tags":["support-contacts"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"customerId","in":"path"}],"responses":{"200":{"description":"Customer","content":{"application/json":{"schema":{"type":"object","properties":{"customer":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"emailOptOut":{"type":"boolean"},"emailOptOutAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"companyId":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","customerId","companyId","name","isPrimary","createdAt"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"subType":{"type":"string","nullable":true},"value":{"type":"string"},"isPrimary":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","customerId","type","subType","value","isPrimary","createdAt"]}}},"required":["id","organizationId","userId","externalId","externalSource","email","fullName","phone","emailOptOut","emailOptOutAt","createdAt","updatedAt","companies","identities"]}},"required":["customer"]}}}}}},"patch":{"tags":["support-contacts"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"customerId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"fullName":{"type":"string"},"phone":{"type":"string"},"userId":{"type":"string"},"externalId":{"type":"string"},"externalSource":{"type":"string"},"emailOptOut":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Customer updated","content":{"application/json":{"schema":{"type":"object","properties":{"customer":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"emailOptOut":{"type":"boolean"},"emailOptOutAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"companyId":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","customerId","companyId","name","isPrimary","createdAt"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"subType":{"type":"string","nullable":true},"value":{"type":"string"},"isPrimary":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","customerId","type","subType","value","isPrimary","createdAt"]}}},"required":["id","organizationId","userId","externalId","externalSource","email","fullName","phone","emailOptOut","emailOptOutAt","createdAt","updatedAt","companies","identities"]}},"required":["customer"]}}}}}},"delete":{"tags":["support-contacts"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"customerId","in":"path"}],"responses":{"200":{"description":"Customer PII scrubbed — email/name/phone/externalId anonymized, widget sessions removed. Ticket history is kept.","content":{"application/json":{"schema":{"type":"object","properties":{"anonymized":{"type":"boolean"},"sessionsRemoved":{"type":"number"}},"required":["anonymized","sessionsRemoved"]}}}},"404":{"description":"Customer not found"}}}},"/workspaces/{organizationId}/support/customers/{customerId}/companies":{"put":{"tags":["support-contacts"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"customerId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"companies":{"type":"array","items":{"type":"object","properties":{"companyId":{"type":"string"},"isPrimary":{"type":"boolean","default":false}},"required":["companyId"]}}},"required":["companies"]}}}},"responses":{"200":{"description":"Customer companies updated","content":{"application/json":{"schema":{"type":"object","properties":{"customer":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"emailOptOut":{"type":"boolean"},"emailOptOutAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"companyId":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","customerId","companyId","name","isPrimary","createdAt"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"subType":{"type":"string","nullable":true},"value":{"type":"string"},"isPrimary":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","customerId","type","subType","value","isPrimary","createdAt"]}}},"required":["id","organizationId","userId","externalId","externalSource","email","fullName","phone","emailOptOut","emailOptOutAt","createdAt","updatedAt","companies","identities"]}},"required":["customer"]}}}}}}},"/workspaces/{organizationId}/support/customers/{customerId}/identities":{"put":{"tags":["support-contacts"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"customerId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"identities":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"subType":{"type":"string"},"value":{"type":"string"},"isPrimary":{"type":"boolean","default":false}},"required":["type","value"]}}},"required":["identities"]}}}},"responses":{"200":{"description":"Customer identities updated","content":{"application/json":{"schema":{"type":"object","properties":{"customer":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"emailOptOut":{"type":"boolean"},"emailOptOutAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"companyId":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","customerId","companyId","name","isPrimary","createdAt"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"customerId":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"subType":{"type":"string","nullable":true},"value":{"type":"string"},"isPrimary":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","customerId","type","subType","value","isPrimary","createdAt"]}}},"required":["id","organizationId","userId","externalId","externalSource","email","fullName","phone","emailOptOut","emailOptOutAt","createdAt","updatedAt","companies","identities"]}},"required":["customer"]}}}}}}},"/workspaces/{organizationId}/support/companies":{"post":{"tags":["support-contacts"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"domain":{"type":"string"},"externalId":{"type":"string"},"externalSource":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"Company created","content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","domain","externalId","externalSource","createdAt","updatedAt"]}},"required":["company"]}}}}}},"get":{"tags":["support-contacts"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"}],"responses":{"200":{"description":"Companies list","content":{"application/json":{"schema":{"type":"object","properties":{"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","domain","externalId","externalSource","createdAt","updatedAt"]}},"nextCursor":{"type":"string","nullable":true}},"required":["companies","nextCursor"]}}}}}}},"/workspaces/{organizationId}/support/companies/{companyId}":{"get":{"tags":["support-contacts"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"companyId","in":"path"}],"responses":{"200":{"description":"Company","content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","domain","externalId","externalSource","createdAt","updatedAt"]}},"required":["company"]}}}}}}},"/workspaces/{organizationId}/board":{"get":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Public roadmap board — tickets flagged public, grouped by status, ranked by weighted vote score. No authentication; exposes no customer PII.","content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"object","additionalProperties":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"number"},"title":{"type":"string"},"status":{"type":"string"},"priority":{"type":"string"},"voteCount":{"type":"number"},"issueId":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","number","title","status","priority","voteCount","issueId","createdAt"]}}},"nextCursor":{"type":"string","nullable":true}},"required":["columns","nextCursor"]}}}}}}},"/workspaces/{organizationId}/support/tickets":{"post":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string"},"title":{"type":"string","minLength":1},"sourceChannel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"priority":{"type":"string","enum":["low","medium","high","urgent"],"default":"medium"},"status":{"type":"string","enum":["todo","done","snoozed"],"default":"todo"},"externalId":{"type":"string"},"externalSource":{"type":"string","enum":["intercom","zendesk","plain","email","slack","msteams","discord","chat","api","manual"],"default":"manual"},"issueId":{"type":"string"},"message":{"type":"object","properties":{"textContent":{"type":"string"},"markdownContent":{"type":"string"},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"],"default":"chat"}},"required":["textContent"]}},"required":["customerId","title","sourceChannel"]}}}},"responses":{"201":{"description":"Ticket created","content":{"application/json":{"schema":{"type":"object","properties":{"ticket":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"number":{"type":"integer"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["todo","done","snoozed"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"sourceChannel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"issueId":{"type":"string","nullable":true},"snoozedUntil":{"type":"string","nullable":true},"lastCustomerMessageAt":{"type":"string","nullable":true},"lastAgentMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true}},"required":["id","email","fullName","phone"]},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"}},"required":["id","name","isPrimary"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"value":{"type":"string"},"subType":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","value","subType","isPrimary"]}},"labels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"labelId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true}},"required":["id","labelId","name","color"]}},"assignees":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["user","team"]},"assigneeId":{"type":"string"},"name":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","assigneeId","name","isPrimary"]}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"type":{"type":"string"},"subType":{"type":"string","nullable":true},"actorType":{"type":"string"},"actorId":{"type":"string","nullable":true},"metadata":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"message":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"customerId":{"type":"string","nullable":true},"userId":{"type":"string","nullable":true}},"required":["id","eventId","direction","textContent","markdownContent","channel","customerId","userId"]},"note":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"body":{"type":"string"}},"required":["id","eventId","body"]}},"required":["id","ticketId","type","subType","actorType","actorId","metadata","externalId","createdAt"]}}},"required":["id","organizationId","customerId","number","externalId","externalSource","title","status","priority","sourceChannel","issueId","snoozedUntil","lastCustomerMessageAt","lastAgentMessageAt","createdAt","updatedAt","customer","companies","identities","labels","assignees","events"]}},"required":["ticket"]}}}}}},"get":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string"},"required":false,"name":"customerId","in":"query"},{"schema":{"type":"string","enum":["todo","done","snoozed"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["low","medium","high","urgent"]},"required":false,"name":"priority","in":"query"},{"schema":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"required":false,"name":"sourceChannel","in":"query"},{"schema":{"type":"string","enum":["intercom","zendesk","plain","email","slack","msteams","discord","chat","api","manual"]},"required":false,"name":"externalSource","in":"query"},{"schema":{"type":"string"},"required":false,"name":"assignedTo","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"}],"responses":{"200":{"description":"Tickets list","content":{"application/json":{"schema":{"type":"object","properties":{"tickets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"number":{"type":"integer"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["todo","done","snoozed"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"sourceChannel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"issueId":{"type":"string","nullable":true},"snoozedUntil":{"type":"string","nullable":true},"lastCustomerMessageAt":{"type":"string","nullable":true},"lastAgentMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true}},"required":["id","email","fullName","phone"]},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"}},"required":["id","name","isPrimary"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"value":{"type":"string"},"subType":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","value","subType","isPrimary"]}},"labels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"labelId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true}},"required":["id","labelId","name","color"]}},"assignees":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["user","team"]},"assigneeId":{"type":"string"},"name":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","assigneeId","name","isPrimary"]}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"type":{"type":"string"},"subType":{"type":"string","nullable":true},"actorType":{"type":"string"},"actorId":{"type":"string","nullable":true},"metadata":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"message":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"customerId":{"type":"string","nullable":true},"userId":{"type":"string","nullable":true}},"required":["id","eventId","direction","textContent","markdownContent","channel","customerId","userId"]},"note":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"body":{"type":"string"}},"required":["id","eventId","body"]}},"required":["id","ticketId","type","subType","actorType","actorId","metadata","externalId","createdAt"]}}},"required":["id","organizationId","customerId","number","externalId","externalSource","title","status","priority","sourceChannel","issueId","snoozedUntil","lastCustomerMessageAt","lastAgentMessageAt","createdAt","updatedAt","customer","companies","identities","labels","assignees","events"]}},"nextCursor":{"type":"string","nullable":true}},"required":["tickets","nextCursor"]}}}}}}},"/workspaces/{organizationId}/support/tickets/{ticketId}":{"get":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"responses":{"200":{"description":"Ticket","content":{"application/json":{"schema":{"type":"object","properties":{"ticket":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"number":{"type":"integer"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["todo","done","snoozed"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"sourceChannel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"issueId":{"type":"string","nullable":true},"snoozedUntil":{"type":"string","nullable":true},"lastCustomerMessageAt":{"type":"string","nullable":true},"lastAgentMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true}},"required":["id","email","fullName","phone"]},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"}},"required":["id","name","isPrimary"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"value":{"type":"string"},"subType":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","value","subType","isPrimary"]}},"labels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"labelId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true}},"required":["id","labelId","name","color"]}},"assignees":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["user","team"]},"assigneeId":{"type":"string"},"name":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","assigneeId","name","isPrimary"]}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"type":{"type":"string"},"subType":{"type":"string","nullable":true},"actorType":{"type":"string"},"actorId":{"type":"string","nullable":true},"metadata":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"message":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"customerId":{"type":"string","nullable":true},"userId":{"type":"string","nullable":true}},"required":["id","eventId","direction","textContent","markdownContent","channel","customerId","userId"]},"note":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"body":{"type":"string"}},"required":["id","eventId","body"]}},"required":["id","ticketId","type","subType","actorType","actorId","metadata","externalId","createdAt"]}}},"required":["id","organizationId","customerId","number","externalId","externalSource","title","status","priority","sourceChannel","issueId","snoozedUntil","lastCustomerMessageAt","lastAgentMessageAt","createdAt","updatedAt","customer","companies","identities","labels","assignees","events"]}},"required":["ticket"]}}}}}},"patch":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"status":{"type":"string","enum":["todo","done","snoozed"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"snoozedUntil":{"type":"string","nullable":true,"format":"date-time"},"issueId":{"type":"string","nullable":true},"isPublic":{"type":"boolean"},"actorType":{"type":"string","enum":["customer","user","agent","automation"]},"actorId":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"Ticket updated","content":{"application/json":{"schema":{"type":"object","properties":{"ticket":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"number":{"type":"integer"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["todo","done","snoozed"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"sourceChannel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"issueId":{"type":"string","nullable":true},"snoozedUntil":{"type":"string","nullable":true},"lastCustomerMessageAt":{"type":"string","nullable":true},"lastAgentMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true}},"required":["id","email","fullName","phone"]},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"}},"required":["id","name","isPrimary"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"value":{"type":"string"},"subType":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","value","subType","isPrimary"]}},"labels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"labelId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true}},"required":["id","labelId","name","color"]}},"assignees":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["user","team"]},"assigneeId":{"type":"string"},"name":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","assigneeId","name","isPrimary"]}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"type":{"type":"string"},"subType":{"type":"string","nullable":true},"actorType":{"type":"string"},"actorId":{"type":"string","nullable":true},"metadata":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"message":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"customerId":{"type":"string","nullable":true},"userId":{"type":"string","nullable":true}},"required":["id","eventId","direction","textContent","markdownContent","channel","customerId","userId"]},"note":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"body":{"type":"string"}},"required":["id","eventId","body"]}},"required":["id","ticketId","type","subType","actorType","actorId","metadata","externalId","createdAt"]}}},"required":["id","organizationId","customerId","number","externalId","externalSource","title","status","priority","sourceChannel","issueId","snoozedUntil","lastCustomerMessageAt","lastAgentMessageAt","createdAt","updatedAt","customer","companies","identities","labels","assignees","events"]}},"required":["ticket"]}}}}}}},"/workspaces/{organizationId}/support/tickets/{ticketId}/artifacts":{"get":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"responses":{"200":{"description":"Ticket artifacts — attachments with inline content for text/JSON payloads (debugger.json, network logs, replay HTML). One call gives an agent the full capture bundle for debugging.","content":{"application/json":{"schema":{"type":"object","properties":{"artifacts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"fileName":{"type":"string","nullable":true},"contentType":{"type":"string","nullable":true},"size":{"type":"number","nullable":true},"url":{"type":"string","nullable":true},"available":{"type":"boolean"},"content":{"nullable":true}},"required":["id","type","fileName","contentType","size","url","available"]}}},"required":["artifacts"]}}}},"404":{"description":"Ticket not found"}}}},"/workspaces/{organizationId}/support/tickets/{ticketId}/messages":{"post":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"direction":{"type":"string","enum":["inbound","outbound"]},"textContent":{"type":"string"},"markdownContent":{"type":"string"},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"customerId":{"type":"string"},"userId":{"type":"string"},"actorType":{"type":"string","enum":["customer","user","agent","automation"]},"actorId":{"type":"string","nullable":true},"subType":{"type":"string","nullable":true},"metadata":{"type":"object","additionalProperties":{"nullable":true}}},"required":["direction","textContent","channel"]}}}},"responses":{"201":{"description":"Message added","content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"type":{"type":"string"},"subType":{"type":"string","nullable":true},"actorType":{"type":"string"},"actorId":{"type":"string","nullable":true},"metadata":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"message":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"customerId":{"type":"string","nullable":true},"userId":{"type":"string","nullable":true}},"required":["id","eventId","direction","textContent","markdownContent","channel","customerId","userId"]},"note":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"body":{"type":"string"}},"required":["id","eventId","body"]}},"required":["id","ticketId","type","subType","actorType","actorId","metadata","externalId","createdAt"]}},"required":["event"]}}}}}}},"/workspaces/{organizationId}/support/tickets/{ticketId}/notes":{"post":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string"},"userId":{"type":"string"},"actorType":{"type":"string","enum":["customer","user","agent","automation"]},"actorId":{"type":"string","nullable":true},"subType":{"type":"string","nullable":true},"metadata":{"type":"object","additionalProperties":{"nullable":true}}},"required":["body"]}}}},"responses":{"201":{"description":"Note added","content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"type":{"type":"string"},"subType":{"type":"string","nullable":true},"actorType":{"type":"string"},"actorId":{"type":"string","nullable":true},"metadata":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"message":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"customerId":{"type":"string","nullable":true},"userId":{"type":"string","nullable":true}},"required":["id","eventId","direction","textContent","markdownContent","channel","customerId","userId"]},"note":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"body":{"type":"string"}},"required":["id","eventId","body"]}},"required":["id","ticketId","type","subType","actorType","actorId","metadata","externalId","createdAt"]}},"required":["event"]}}}}}}},"/workspaces/{organizationId}/support/tickets/{ticketId}/events":{"get":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Ticket events","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"type":{"type":"string"},"subType":{"type":"string","nullable":true},"actorType":{"type":"string"},"actorId":{"type":"string","nullable":true},"metadata":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"message":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"customerId":{"type":"string","nullable":true},"userId":{"type":"string","nullable":true}},"required":["id","eventId","direction","textContent","markdownContent","channel","customerId","userId"]},"note":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"body":{"type":"string"}},"required":["id","eventId","body"]}},"required":["id","ticketId","type","subType","actorType","actorId","metadata","externalId","createdAt"]}},"nextCursor":{"type":"string","nullable":true}},"required":["events","nextCursor"]}}}}}}},"/workspaces/{organizationId}/support/tickets/{ticketId}/done":{"post":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"responses":{"200":{"description":"Ticket marked done","content":{"application/json":{"schema":{"type":"object","properties":{"ticket":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"number":{"type":"integer"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["todo","done","snoozed"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"sourceChannel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"issueId":{"type":"string","nullable":true},"snoozedUntil":{"type":"string","nullable":true},"lastCustomerMessageAt":{"type":"string","nullable":true},"lastAgentMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true}},"required":["id","email","fullName","phone"]},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"}},"required":["id","name","isPrimary"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"value":{"type":"string"},"subType":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","value","subType","isPrimary"]}},"labels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"labelId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true}},"required":["id","labelId","name","color"]}},"assignees":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["user","team"]},"assigneeId":{"type":"string"},"name":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","assigneeId","name","isPrimary"]}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"type":{"type":"string"},"subType":{"type":"string","nullable":true},"actorType":{"type":"string"},"actorId":{"type":"string","nullable":true},"metadata":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"message":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"customerId":{"type":"string","nullable":true},"userId":{"type":"string","nullable":true}},"required":["id","eventId","direction","textContent","markdownContent","channel","customerId","userId"]},"note":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"body":{"type":"string"}},"required":["id","eventId","body"]}},"required":["id","ticketId","type","subType","actorType","actorId","metadata","externalId","createdAt"]}}},"required":["id","organizationId","customerId","number","externalId","externalSource","title","status","priority","sourceChannel","issueId","snoozedUntil","lastCustomerMessageAt","lastAgentMessageAt","createdAt","updatedAt","customer","companies","identities","labels","assignees","events"]}},"required":["ticket"]}}}}}}},"/workspaces/{organizationId}/support/tickets/{ticketId}/todo":{"post":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"responses":{"200":{"description":"Ticket marked todo","content":{"application/json":{"schema":{"type":"object","properties":{"ticket":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"number":{"type":"integer"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["todo","done","snoozed"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"sourceChannel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"issueId":{"type":"string","nullable":true},"snoozedUntil":{"type":"string","nullable":true},"lastCustomerMessageAt":{"type":"string","nullable":true},"lastAgentMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true}},"required":["id","email","fullName","phone"]},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"}},"required":["id","name","isPrimary"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"value":{"type":"string"},"subType":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","value","subType","isPrimary"]}},"labels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"labelId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true}},"required":["id","labelId","name","color"]}},"assignees":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["user","team"]},"assigneeId":{"type":"string"},"name":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","assigneeId","name","isPrimary"]}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"type":{"type":"string"},"subType":{"type":"string","nullable":true},"actorType":{"type":"string"},"actorId":{"type":"string","nullable":true},"metadata":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"message":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"customerId":{"type":"string","nullable":true},"userId":{"type":"string","nullable":true}},"required":["id","eventId","direction","textContent","markdownContent","channel","customerId","userId"]},"note":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"body":{"type":"string"}},"required":["id","eventId","body"]}},"required":["id","ticketId","type","subType","actorType","actorId","metadata","externalId","createdAt"]}}},"required":["id","organizationId","customerId","number","externalId","externalSource","title","status","priority","sourceChannel","issueId","snoozedUntil","lastCustomerMessageAt","lastAgentMessageAt","createdAt","updatedAt","customer","companies","identities","labels","assignees","events"]}},"required":["ticket"]}}}}}}},"/workspaces/{organizationId}/support/tickets/{ticketId}/snooze":{"post":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"until":{"type":"string","format":"date-time"},"actorType":{"type":"string","enum":["customer","user","agent","automation"]},"actorId":{"type":"string","nullable":true}},"required":["until"]}}}},"responses":{"200":{"description":"Ticket snoozed","content":{"application/json":{"schema":{"type":"object","properties":{"ticket":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"number":{"type":"integer"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["todo","done","snoozed"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"sourceChannel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"issueId":{"type":"string","nullable":true},"snoozedUntil":{"type":"string","nullable":true},"lastCustomerMessageAt":{"type":"string","nullable":true},"lastAgentMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true}},"required":["id","email","fullName","phone"]},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"}},"required":["id","name","isPrimary"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"value":{"type":"string"},"subType":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","value","subType","isPrimary"]}},"labels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"labelId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true}},"required":["id","labelId","name","color"]}},"assignees":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["user","team"]},"assigneeId":{"type":"string"},"name":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","assigneeId","name","isPrimary"]}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"type":{"type":"string"},"subType":{"type":"string","nullable":true},"actorType":{"type":"string"},"actorId":{"type":"string","nullable":true},"metadata":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"message":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"customerId":{"type":"string","nullable":true},"userId":{"type":"string","nullable":true}},"required":["id","eventId","direction","textContent","markdownContent","channel","customerId","userId"]},"note":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"body":{"type":"string"}},"required":["id","eventId","body"]}},"required":["id","ticketId","type","subType","actorType","actorId","metadata","externalId","createdAt"]}}},"required":["id","organizationId","customerId","number","externalId","externalSource","title","status","priority","sourceChannel","issueId","snoozedUntil","lastCustomerMessageAt","lastAgentMessageAt","createdAt","updatedAt","customer","companies","identities","labels","assignees","events"]}},"required":["ticket"]}}}}}}},"/workspaces/{organizationId}/support/tickets/{ticketId}/assignees":{"put":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"assignees":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"userId":{"type":"string"},"teamId":{"type":"string"},"isPrimary":{"type":"boolean","default":false}},"required":["userId"]},{"type":"object","properties":{"userId":{"type":"string"},"teamId":{"type":"string"},"isPrimary":{"type":"boolean","default":false}},"required":["teamId"]}]}}},"required":["assignees"]}}}},"responses":{"200":{"description":"Ticket assignees updated","content":{"application/json":{"schema":{"type":"object","properties":{"ticket":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"number":{"type":"integer"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["todo","done","snoozed"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"sourceChannel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"issueId":{"type":"string","nullable":true},"snoozedUntil":{"type":"string","nullable":true},"lastCustomerMessageAt":{"type":"string","nullable":true},"lastAgentMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true}},"required":["id","email","fullName","phone"]},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"}},"required":["id","name","isPrimary"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"value":{"type":"string"},"subType":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","value","subType","isPrimary"]}},"labels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"labelId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true}},"required":["id","labelId","name","color"]}},"assignees":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["user","team"]},"assigneeId":{"type":"string"},"name":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","assigneeId","name","isPrimary"]}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"type":{"type":"string"},"subType":{"type":"string","nullable":true},"actorType":{"type":"string"},"actorId":{"type":"string","nullable":true},"metadata":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"message":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"customerId":{"type":"string","nullable":true},"userId":{"type":"string","nullable":true}},"required":["id","eventId","direction","textContent","markdownContent","channel","customerId","userId"]},"note":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"body":{"type":"string"}},"required":["id","eventId","body"]}},"required":["id","ticketId","type","subType","actorType","actorId","metadata","externalId","createdAt"]}}},"required":["id","organizationId","customerId","number","externalId","externalSource","title","status","priority","sourceChannel","issueId","snoozedUntil","lastCustomerMessageAt","lastAgentMessageAt","createdAt","updatedAt","customer","companies","identities","labels","assignees","events"]}},"required":["ticket"]}}}}}}},"/workspaces/{organizationId}/support/tickets/{ticketId}/labels":{"put":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"labels":{"type":"array","items":{"type":"string"}}},"required":["labels"]}}}},"responses":{"200":{"description":"Ticket labels updated","content":{"application/json":{"schema":{"type":"object","properties":{"ticket":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"customerId":{"type":"string"},"number":{"type":"integer"},"externalId":{"type":"string","nullable":true},"externalSource":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["todo","done","snoozed"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"sourceChannel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"issueId":{"type":"string","nullable":true},"snoozedUntil":{"type":"string","nullable":true},"lastCustomerMessageAt":{"type":"string","nullable":true},"lastAgentMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true}},"required":["id","email","fullName","phone"]},"companies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"isPrimary":{"type":"boolean"}},"required":["id","name","isPrimary"]}},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["email","phone","slack","msteams","discord","whatsapp","chat","api","social","custom"]},"value":{"type":"string"},"subType":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","value","subType","isPrimary"]}},"labels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"labelId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true}},"required":["id","labelId","name","color"]}},"assignees":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["user","team"]},"assigneeId":{"type":"string"},"name":{"type":"string","nullable":true},"isPrimary":{"type":"boolean"}},"required":["id","type","assigneeId","name","isPrimary"]}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"type":{"type":"string"},"subType":{"type":"string","nullable":true},"actorType":{"type":"string"},"actorId":{"type":"string","nullable":true},"metadata":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"message":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain","linear"]},"customerId":{"type":"string","nullable":true},"userId":{"type":"string","nullable":true}},"required":["id","eventId","direction","textContent","markdownContent","channel","customerId","userId"]},"note":{"type":"object","properties":{"id":{"type":"string"},"eventId":{"type":"string"},"body":{"type":"string"}},"required":["id","eventId","body"]}},"required":["id","ticketId","type","subType","actorType","actorId","metadata","externalId","createdAt"]}}},"required":["id","organizationId","customerId","number","externalId","externalSource","title","status","priority","sourceChannel","issueId","snoozedUntil","lastCustomerMessageAt","lastAgentMessageAt","createdAt","updatedAt","customer","companies","identities","labels","assignees","events"]}},"required":["ticket"]}}}}}}},"/workspaces/{organizationId}/support/tickets/{ticketId}/votes":{"post":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"customerId":{"type":"string"},"priority":{"type":"string","nullable":true,"enum":["nice_to_have","important","must_have",null]},"sourceTicketId":{"type":"string"}},"required":["email"]}}}},"responses":{"201":{"description":"Vote added — idempotent per (ticket, email); repeat calls update priority/provenance. When the caller is staff or an agent, the vote is recorded as cast on behalf of the voter.","content":{"application/json":{"schema":{"type":"object","properties":{"vote":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"customerId":{"type":"string","nullable":true},"voterEmail":{"type":"string"},"priority":{"type":"string","nullable":true,"enum":["nice_to_have","important","must_have",null]},"castByActorType":{"type":"string","nullable":true,"enum":["user","agent","customer",null]},"castByActorId":{"type":"string","nullable":true},"sourceTicketId":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","ticketId","customerId","voterEmail","priority","castByActorType","castByActorId","sourceTicketId","createdAt"]},"created":{"type":"boolean"}},"required":["vote","created"]}}}}}},"delete":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"voteId","in":"query"},{"schema":{"type":"string","format":"email"},"required":false,"name":"email","in":"query"}],"responses":{"200":{"description":"Vote removed","content":{"application/json":{"schema":{"type":"object","properties":{"removed":{"type":"boolean"}},"required":["removed"]}}}}}},"get":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ticketId","in":"path"}],"responses":{"200":{"description":"Votes on the ticket, oldest first","content":{"application/json":{"schema":{"type":"object","properties":{"votes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ticketId":{"type":"string"},"customerId":{"type":"string","nullable":true},"voterEmail":{"type":"string"},"priority":{"type":"string","nullable":true,"enum":["nice_to_have","important","must_have",null]},"castByActorType":{"type":"string","nullable":true,"enum":["user","agent","customer",null]},"castByActorId":{"type":"string","nullable":true},"sourceTicketId":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","ticketId","customerId","voterEmail","priority","castByActorType","castByActorId","sourceTicketId","createdAt"]}},"count":{"type":"number"}},"required":["votes","count"]}}}}}}},"/workspaces/{organizationId}/changelog":{"get":{"tags":["changelog"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"boolean","nullable":true,"default":false},"required":false,"name":"includeDrafts","in":"query"}],"responses":{"200":{"description":"Published changelog entries — anonymous public read. Drafts require a workspace token (includeDrafts).","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"labels":{"type":"string"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"links":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"entryId":{"type":"string"},"ticketId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true}},"required":["id","entryId","ticketId","issueId"]}}},"required":["id","organizationId","title","body","labels","publishedAt","createdAt","updatedAt","links"]}},"nextCursor":{"type":"string","nullable":true}},"required":["entries","nextCursor"]}}}}}},"post":{"tags":["changelog"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":300},"body":{"type":"string","minLength":1,"maxLength":20000},"labels":{"type":"array","items":{"type":"string","maxLength":50},"maxItems":10},"links":{"type":"array","items":{"type":"object","properties":{"ticketId":{"type":"string"},"issueId":{"type":"string"}}},"maxItems":100},"publish":{"type":"boolean"}},"required":["title","body"]}}}},"responses":{"201":{"description":"Changelog entry created","content":{"application/json":{"schema":{"type":"object","properties":{"entry":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"labels":{"type":"string"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"links":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"entryId":{"type":"string"},"ticketId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true}},"required":["id","entryId","ticketId","issueId"]}}},"required":["id","organizationId","title","body","labels","publishedAt","createdAt","updatedAt","links"]}},"required":["entry"]}}}}}}},"/workspaces/{organizationId}/changelog/{entryId}":{"get":{"tags":["changelog"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"entryId","in":"path"}],"responses":{"200":{"description":"Changelog entry","content":{"application/json":{"schema":{"type":"object","properties":{"entry":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"labels":{"type":"string"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"links":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"entryId":{"type":"string"},"ticketId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true}},"required":["id","entryId","ticketId","issueId"]}}},"required":["id","organizationId","title","body","labels","publishedAt","createdAt","updatedAt","links"]}},"required":["entry"]}}}},"404":{"description":"Not found"}}},"patch":{"tags":["changelog"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"entryId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":300},"body":{"type":"string","minLength":1,"maxLength":20000},"labels":{"type":"array","items":{"type":"string","maxLength":50},"maxItems":10},"links":{"type":"array","items":{"type":"object","properties":{"ticketId":{"type":"string"},"issueId":{"type":"string"}}},"maxItems":100}}}}}},"responses":{"200":{"description":"Changelog entry updated","content":{"application/json":{"schema":{"type":"object","properties":{"entry":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"labels":{"type":"string"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"links":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"entryId":{"type":"string"},"ticketId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true}},"required":["id","entryId","ticketId","issueId"]}}},"required":["id","organizationId","title","body","labels","publishedAt","createdAt","updatedAt","links"]}},"required":["entry"]}}}},"404":{"description":"Not found"}}},"delete":{"tags":["changelog"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"entryId","in":"path"}],"responses":{"200":{"description":"Changelog entry deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}},"required":["deleted"]}}}}}}},"/workspaces/{organizationId}/changelog/{entryId}/publish":{"post":{"tags":["changelog"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"entryId","in":"path"}],"responses":{"200":{"description":"Entry published — notifies voters on linked tickets (opt-outs honored)","content":{"application/json":{"schema":{"type":"object","properties":{"entry":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"labels":{"type":"string"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"links":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"entryId":{"type":"string"},"ticketId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true}},"required":["id","entryId","ticketId","issueId"]}}},"required":["id","organizationId","title","body","labels","publishedAt","createdAt","updatedAt","links"]},"notified":{"type":"array","items":{"type":"string"}}},"required":["entry","notified"]}}}},"404":{"description":"Not found"}}}},"/workspaces/{organizationId}/changelog/{entryId}/unpublish":{"post":{"tags":["changelog"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"entryId","in":"path"}],"responses":{"200":{"description":"Entry unpublished","content":{"application/json":{"schema":{"type":"object","properties":{"entry":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"labels":{"type":"string"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"links":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"entryId":{"type":"string"},"ticketId":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true}},"required":["id","entryId","ticketId","issueId"]}}},"required":["id","organizationId","title","body","labels","publishedAt","createdAt","updatedAt","links"]}},"required":["entry"]}}}},"404":{"description":"Not found"}}}},"/workspaces/{organizationId}/support/trace/{id}":{"get":{"tags":["support-tickets"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Correlated trace — resolves any of {ticket id, capture session id, widget session id} and returns the full picture: ticket, timeline events, attachments with R2 availability, capture session, widget session, escalated issue, and agent sessions.","content":{"application/json":{"schema":{"type":"object","properties":{"resolvedAs":{"type":"string","enum":["ticket","capture_session","widget_session"]},"ticket":{"nullable":true},"events":{"type":"array","items":{"nullable":true}},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"fileName":{"type":"string","nullable":true},"size":{"type":"number","nullable":true},"r2Key":{"type":"string","nullable":true},"available":{"type":"boolean"}},"required":["id","type","fileName","size","r2Key","available"]}},"captureSession":{"nullable":true},"widgetSession":{"nullable":true},"issue":{"nullable":true},"agentSessions":{"type":"array","items":{"nullable":true}}},"required":["resolvedAs","events","attachments","agentSessions"]}}}},"404":{"description":"No ticket, capture session, or widget session with this id"}}}},"/workspaces/{organizationId}/support/snippets":{"post":{"tags":["support-content"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"textContent":{"type":"string"},"markdownContent":{"type":"string"}},"required":["name","textContent"]}}}},"responses":{"201":{"description":"Snippet created","content":{"application/json":{"schema":{"type":"object","properties":{"snippet":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","textContent","markdownContent","createdAt","updatedAt"]}},"required":["snippet"]}}}}}},"get":{"tags":["support-content"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Snippets list","content":{"application/json":{"schema":{"type":"object","properties":{"snippets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","textContent","markdownContent","createdAt","updatedAt"]}}},"required":["snippets"]}}}}}}},"/workspaces/{organizationId}/support/snippets/{snippetId}":{"get":{"tags":["support-content"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"snippetId","in":"path"}],"responses":{"200":{"description":"Snippet details","content":{"application/json":{"schema":{"type":"object","properties":{"snippet":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","textContent","markdownContent","createdAt","updatedAt"]}},"required":["snippet"]}}}}}},"patch":{"tags":["support-content"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"snippetId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"Snippet updated","content":{"application/json":{"schema":{"type":"object","properties":{"snippet":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"textContent":{"type":"string"},"markdownContent":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","textContent","markdownContent","createdAt","updatedAt"]}},"required":["snippet"]}}}}}}},"/workspaces/{organizationId}/support/snippets/{snippetId}/insert":{"post":{"tags":["support-content"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"snippetId","in":"path"}],"responses":{"200":{"description":"Snippet rendered for context","content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string"},"markdown":{"type":"string","nullable":true}},"required":["text","markdown"]}}}}}}},"/workspaces/{organizationId}/support/autoresponders":{"post":{"tags":["support-content"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"enabled":{"type":"boolean"},"trigger":{"type":"string","enum":["ticket_created","customer_replied","out_of_hours"]},"order":{"type":"integer"},"snippetId":{"type":"string"},"conditions":{"type":"object","additionalProperties":{"type":"string"}}},"required":["name","trigger","order"]}}}},"responses":{"201":{"description":"Autoresponder created","content":{"application/json":{"schema":{"type":"object","properties":{"autoresponder":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"enabled":{"type":"boolean"},"trigger":{"type":"string","enum":["ticket_created","customer_replied","out_of_hours"]},"order":{"type":"integer"},"snippetId":{"type":"string","nullable":true},"conditions":{"type":"object","additionalProperties":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","enabled","trigger","order","snippetId","conditions","createdAt","updatedAt"]}},"required":["autoresponder"]}}}}}},"get":{"tags":["support-content"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Autoresponders list","content":{"application/json":{"schema":{"type":"object","properties":{"autoresponders":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"enabled":{"type":"boolean"},"trigger":{"type":"string","enum":["ticket_created","customer_replied","out_of_hours"]},"order":{"type":"integer"},"snippetId":{"type":"string","nullable":true},"conditions":{"type":"object","additionalProperties":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","enabled","trigger","order","snippetId","conditions","createdAt","updatedAt"]}}},"required":["autoresponders"]}}}}}}},"/workspaces/{organizationId}/support/autoresponders/{autoresponderId}":{"patch":{"tags":["support-content"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"autoresponderId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"enabled":{"type":"boolean"},"trigger":{"type":"string","enum":["ticket_created","customer_replied","out_of_hours"]},"order":{"type":"integer"},"snippetId":{"type":"string","nullable":true},"conditions":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"responses":{"200":{"description":"Autoresponder updated","content":{"application/json":{"schema":{"type":"object","properties":{"autoresponder":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"enabled":{"type":"boolean"},"trigger":{"type":"string","enum":["ticket_created","customer_replied","out_of_hours"]},"order":{"type":"integer"},"snippetId":{"type":"string","nullable":true},"conditions":{"type":"object","additionalProperties":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","enabled","trigger","order","snippetId","conditions","createdAt","updatedAt"]}},"required":["autoresponder"]}}}}}}},"/workspaces/{organizationId}/support/labels":{"post":{"tags":["support-content"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"color":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"Support label created","content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"kind":{"type":"string","enum":["issue","support"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","color","kind","createdAt","updatedAt"]}},"required":["label"]}}}}}},"get":{"tags":["support-content"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Support labels list","content":{"application/json":{"schema":{"type":"object","properties":{"labels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"color":{"type":"string","nullable":true},"kind":{"type":"string","enum":["issue","support"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","color","kind","createdAt","updatedAt"]}}},"required":["labels"]}}}}}}},"/workspaces/{organizationId}/support/escalation-rules":{"get":{"tags":["support-escalation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Escalation rules","content":{"application/json":{"schema":{"type":"object","properties":{"rules":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"sortOrder":{"type":"number"},"conditions":{"type":"object","properties":{"keywords":{"type":"array","items":{"type":"string","minLength":1}},"channels":{"type":"array","items":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain"]}},"priorities":{"type":"array","items":{"type":"string","enum":["low","medium","high","urgent"]}},"statuses":{"type":"array","items":{"type":"string","enum":["todo","done","snoozed"]}},"sources":{"type":"array","items":{"type":"string","enum":["intercom","zendesk","plain","email","slack","msteams","discord","chat","api","manual"]}},"customerDomains":{"type":"array","items":{"type":"string"}}}},"action":{"type":"object","properties":{"type":{"type":"string","enum":["create_issue"]},"teamId":{"type":"string"},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"status":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"labelIds":{"type":"array","items":{"type":"string"}},"agentId":{"type":"string"},"repo":{"type":"string"},"instructions":{"type":"string"}},"required":["type"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","isActive","sortOrder","conditions","action","createdAt","updatedAt"]}}},"required":["rules"]}}}}}},"post":{"tags":["support-escalation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"isActive":{"type":"boolean"},"sortOrder":{"type":"integer"},"conditions":{"type":"object","properties":{"keywords":{"type":"array","items":{"type":"string","minLength":1}},"channels":{"type":"array","items":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain"]}},"priorities":{"type":"array","items":{"type":"string","enum":["low","medium","high","urgent"]}},"statuses":{"type":"array","items":{"type":"string","enum":["todo","done","snoozed"]}},"sources":{"type":"array","items":{"type":"string","enum":["intercom","zendesk","plain","email","slack","msteams","discord","chat","api","manual"]}},"customerDomains":{"type":"array","items":{"type":"string"}}}},"action":{"type":"object","properties":{"type":{"type":"string","enum":["create_issue"]},"teamId":{"type":"string"},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"status":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"labelIds":{"type":"array","items":{"type":"string"}},"agentId":{"type":"string"},"repo":{"type":"string"},"instructions":{"type":"string"}},"required":["type"]}},"required":["name","conditions","action"]}}}},"responses":{"201":{"description":"Rule created","content":{"application/json":{"schema":{"type":"object","properties":{"rule":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"sortOrder":{"type":"number"},"conditions":{"type":"object","properties":{"keywords":{"type":"array","items":{"type":"string","minLength":1}},"channels":{"type":"array","items":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain"]}},"priorities":{"type":"array","items":{"type":"string","enum":["low","medium","high","urgent"]}},"statuses":{"type":"array","items":{"type":"string","enum":["todo","done","snoozed"]}},"sources":{"type":"array","items":{"type":"string","enum":["intercom","zendesk","plain","email","slack","msteams","discord","chat","api","manual"]}},"customerDomains":{"type":"array","items":{"type":"string"}}}},"action":{"type":"object","properties":{"type":{"type":"string","enum":["create_issue"]},"teamId":{"type":"string"},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"status":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"labelIds":{"type":"array","items":{"type":"string"}},"agentId":{"type":"string"},"repo":{"type":"string"},"instructions":{"type":"string"}},"required":["type"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","isActive","sortOrder","conditions","action","createdAt","updatedAt"]}},"required":["rule"]}}}}}}},"/workspaces/{organizationId}/support/escalation-rules/{ruleId}":{"get":{"tags":["support-escalation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ruleId","in":"path"}],"responses":{"200":{"description":"Rule","content":{"application/json":{"schema":{"type":"object","properties":{"rule":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"sortOrder":{"type":"number"},"conditions":{"type":"object","properties":{"keywords":{"type":"array","items":{"type":"string","minLength":1}},"channels":{"type":"array","items":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain"]}},"priorities":{"type":"array","items":{"type":"string","enum":["low","medium","high","urgent"]}},"statuses":{"type":"array","items":{"type":"string","enum":["todo","done","snoozed"]}},"sources":{"type":"array","items":{"type":"string","enum":["intercom","zendesk","plain","email","slack","msteams","discord","chat","api","manual"]}},"customerDomains":{"type":"array","items":{"type":"string"}}}},"action":{"type":"object","properties":{"type":{"type":"string","enum":["create_issue"]},"teamId":{"type":"string"},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"status":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"labelIds":{"type":"array","items":{"type":"string"}},"agentId":{"type":"string"},"repo":{"type":"string"},"instructions":{"type":"string"}},"required":["type"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","isActive","sortOrder","conditions","action","createdAt","updatedAt"]}},"required":["rule"]}}}},"404":{"description":"Not found"}}},"patch":{"tags":["support-escalation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ruleId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"isActive":{"type":"boolean"},"sortOrder":{"type":"integer"},"conditions":{"type":"object","properties":{"keywords":{"type":"array","items":{"type":"string","minLength":1}},"channels":{"type":"array","items":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain"]}},"priorities":{"type":"array","items":{"type":"string","enum":["low","medium","high","urgent"]}},"statuses":{"type":"array","items":{"type":"string","enum":["todo","done","snoozed"]}},"sources":{"type":"array","items":{"type":"string","enum":["intercom","zendesk","plain","email","slack","msteams","discord","chat","api","manual"]}},"customerDomains":{"type":"array","items":{"type":"string"}}}},"action":{"type":"object","properties":{"type":{"type":"string","enum":["create_issue"]},"teamId":{"type":"string"},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"status":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"labelIds":{"type":"array","items":{"type":"string"}},"agentId":{"type":"string"},"repo":{"type":"string"},"instructions":{"type":"string"}},"required":["type"]}}}}}},"responses":{"200":{"description":"Rule updated","content":{"application/json":{"schema":{"type":"object","properties":{"rule":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"isActive":{"type":"boolean"},"sortOrder":{"type":"number"},"conditions":{"type":"object","properties":{"keywords":{"type":"array","items":{"type":"string","minLength":1}},"channels":{"type":"array","items":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain"]}},"priorities":{"type":"array","items":{"type":"string","enum":["low","medium","high","urgent"]}},"statuses":{"type":"array","items":{"type":"string","enum":["todo","done","snoozed"]}},"sources":{"type":"array","items":{"type":"string","enum":["intercom","zendesk","plain","email","slack","msteams","discord","chat","api","manual"]}},"customerDomains":{"type":"array","items":{"type":"string"}}}},"action":{"type":"object","properties":{"type":{"type":"string","enum":["create_issue"]},"teamId":{"type":"string"},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"status":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"labelIds":{"type":"array","items":{"type":"string"}},"agentId":{"type":"string"},"repo":{"type":"string"},"instructions":{"type":"string"}},"required":["type"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","isActive","sortOrder","conditions","action","createdAt","updatedAt"]}},"required":["rule"]}}}},"404":{"description":"Not found"}}},"delete":{"tags":["support-escalation"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"ruleId","in":"path"}],"responses":{"204":{"description":"Deleted"},"404":{"description":"Not found"}}}},"/workspaces/{organizationId}/support/inbox":{"get":{"tags":["support-inbox"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","enum":["todo","done","snoozed"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["low","medium","high","urgent"]},"required":false,"name":"priority","in":"query"},{"schema":{"type":"string"},"required":false,"name":"assignedTo","in":"query"},{"schema":{"type":"string"},"required":false,"name":"customerId","in":"query"},{"schema":{"type":"string","enum":["email","slack","msteams","discord","chat","capture","api","intercom","zendesk","plain"]},"required":false,"name":"channel","in":"query"},{"schema":{"type":"string"},"required":false,"name":"label","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Inbox tickets","content":{"application/json":{"schema":{"type":"object","properties":{"tickets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"integer"},"title":{"type":"string"},"status":{"type":"string","enum":["todo","done","snoozed"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true}},"required":["id","email"]},"primaryAssignee":{"type":"string"},"labels":{"type":"array","items":{"type":"string"}},"lastCustomerMessageAt":{"type":"string","format":"date-time"},"lastAgentMessageAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","number","title","status","priority","customer","labels","createdAt","updatedAt"]}},"nextCursor":{"type":"string","nullable":true}},"required":["tickets"]}}}}}}},"/workspaces/{organizationId}/support/inbox/counts":{"get":{"tags":["support-inbox"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Inbox counts","content":{"application/json":{"schema":{"type":"object","properties":{"counts":{"type":"object","properties":{"todo":{"type":"integer"},"done":{"type":"integer"},"snoozed":{"type":"integer"},"mine":{"type":"integer"},"unassigned":{"type":"integer"}},"required":["todo","done","snoozed","mine","unassigned"]}},"required":["counts"]}}}}}}},"/workspaces/{organizationId}/support/inbox/next":{"get":{"tags":["support-inbox"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Next ticket","content":{"application/json":{"schema":{"type":"object","properties":{"ticketId":{"type":"string"},"userId":{"type":"string"}},"required":["ticketId","userId"]}}}},"404":{"description":"No unassigned ticket or available agent"}}}},"/workspaces/{organizationId}/support/inbox/views":{"post":{"tags":["support-inbox"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"filter":{"type":"object","additionalProperties":{"nullable":true}},"sort":{"type":"object","additionalProperties":{"nullable":true}}},"required":["name","filter"]}}}},"responses":{"201":{"description":"View created","content":{"application/json":{"schema":{"type":"object","properties":{"view":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string","nullable":true},"name":{"type":"string"},"filter":{"type":"object","additionalProperties":{"nullable":true}},"sort":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","userId","name","filter","sort","createdAt","updatedAt"]}},"required":["view"]}}}}}},"get":{"tags":["support-inbox"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Saved views","content":{"application/json":{"schema":{"type":"object","properties":{"views":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string","nullable":true},"name":{"type":"string"},"filter":{"type":"object","additionalProperties":{"nullable":true}},"sort":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","userId","name","filter","sort","createdAt","updatedAt"]}}},"required":["views"]}}}}}}},"/workspaces/{organizationId}/support/inbox/views/{viewId}":{"get":{"tags":["support-inbox"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"viewId","in":"path"}],"responses":{"200":{"description":"View","content":{"application/json":{"schema":{"type":"object","properties":{"view":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string","nullable":true},"name":{"type":"string"},"filter":{"type":"object","additionalProperties":{"nullable":true}},"sort":{"type":"object","additionalProperties":{"nullable":true}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","userId","name","filter","sort","createdAt","updatedAt"]}},"required":["view"]}}}},"404":{"description":"Not found"}}}},"/workspaces/{organizationId}/support/inbox/views/{viewId}/run":{"get":{"tags":["support-inbox"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"viewId","in":"path"}],"responses":{"200":{"description":"Run view","content":{"application/json":{"schema":{"type":"object","properties":{"tickets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"integer"},"title":{"type":"string"},"status":{"type":"string","enum":["todo","done","snoozed"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"customer":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"fullName":{"type":"string","nullable":true}},"required":["id","email"]},"primaryAssignee":{"type":"string"},"labels":{"type":"array","items":{"type":"string"}},"lastCustomerMessageAt":{"type":"string","format":"date-time"},"lastAgentMessageAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","number","title","status","priority","customer","labels","createdAt","updatedAt"]}},"nextCursor":{"type":"string","nullable":true}},"required":["tickets"]}}}},"404":{"description":"View not found"}}}},"/workspaces/{organizationId}/support/imports":{"post":{"tags":["support-migration"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"source":{"type":"string","enum":["intercom"]},"credentials":{"type":"object","properties":{"token":{"type":"string","minLength":1}},"required":["token"]},"options":{"type":"object","properties":{"teamId":{"type":"string"},"state":{"type":"string","enum":["open","closed","snoozed","all"],"default":"all"},"limit":{"type":"integer","minimum":1,"maximum":1000},"cursor":{"type":"string"},"teamName":{"type":"string"}}}},"required":["source","credentials"]},{"type":"object","properties":{"source":{"type":"string","enum":["jam"]},"credentials":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["data"]},"options":{"type":"object","properties":{"limit":{"type":"integer","minimum":1,"maximum":1000,"default":50},"cursor":{"type":"string"}}}},"required":["source","credentials"]},{"type":"object","properties":{"source":{"type":"string","enum":["jam-mcp"]},"credentials":{"type":"object","properties":{"token":{"type":"string","minLength":1}},"required":["token"]},"options":{"type":"object","properties":{"limit":{"type":"integer","minimum":1,"maximum":100,"default":25},"after":{"type":"string"},"text":{"type":"string"},"type":{"type":"string","enum":["video","screenshot","sessionReplay","recording"]},"folder":{"type":"string"},"author":{"type":"string"},"url":{"type":"string"},"createdAt":{"type":"string"}}}},"required":["source","credentials"]},{"type":"object","properties":{"source":{"type":"string","enum":["plain"]},"credentials":{"type":"object","properties":{"token":{"type":"string","minLength":1}},"required":["token"]},"options":{"type":"object","properties":{"state":{"type":"string","enum":["todo","done","snoozed","all"],"default":"all"},"limit":{"type":"integer","minimum":1,"maximum":1000},"cursor":{"type":"string"},"teamId":{"type":"string"},"teamName":{"type":"string"}}}},"required":["source","credentials"]},{"type":"object","properties":{"source":{"type":"string","enum":["zendesk"]},"credentials":{"type":"object","properties":{"subdomain":{"type":"string","minLength":1},"email":{"type":"string","format":"email"},"token":{"type":"string","minLength":1}},"required":["subdomain","email","token"]},"options":{"type":"object","properties":{"state":{"type":"string","enum":["open","pending","hold","solved","closed","all"],"default":"all"},"limit":{"type":"integer","minimum":1,"maximum":1000},"cursor":{"type":"string"}}}},"required":["source","credentials"]}]}}}},"responses":{"200":{"description":"Import started","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"source":{"type":"string"},"jobId":{"type":"string"},"status":{"type":"string"},"counts":{"type":"object","additionalProperties":{"type":"number"}},"nextCursor":{"type":"string"}},"required":["ok","source","jobId","status"]}}}}}}},"/workspaces/{organizationId}/support/imports/{importId}":{"get":{"tags":["support-migration"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"importId","in":"path"}],"responses":{"200":{"description":"Import status","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"source":{"type":"string"},"status":{"type":"string"},"options":{"type":"object","additionalProperties":{"nullable":true}},"counts":{"type":"object","additionalProperties":{"type":"number"}},"cursor":{"type":"string"},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"completedAt":{"type":"string","nullable":true}},"required":["id","organizationId","source","status","error","createdAt","updatedAt","completedAt"]}}}},"404":{"description":"Import not found"}}}},"/workspaces/{organizationId}/support/imports/{importId}/resume":{"post":{"tags":["support-migration"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"importId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"source":{"type":"string","enum":["intercom"]},"credentials":{"type":"object","properties":{"token":{"type":"string","minLength":1}},"required":["token"]},"options":{"type":"object","properties":{"teamId":{"type":"string"},"state":{"type":"string","enum":["open","closed","snoozed","all"],"default":"all"},"limit":{"type":"integer","minimum":1,"maximum":1000},"cursor":{"type":"string"},"teamName":{"type":"string"}}}},"required":["source","credentials"]},{"type":"object","properties":{"source":{"type":"string","enum":["jam"]},"credentials":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["data"]},"options":{"type":"object","properties":{"limit":{"type":"integer","minimum":1,"maximum":1000,"default":50},"cursor":{"type":"string"}}}},"required":["source","credentials"]},{"type":"object","properties":{"source":{"type":"string","enum":["jam-mcp"]},"credentials":{"type":"object","properties":{"token":{"type":"string","minLength":1}},"required":["token"]},"options":{"type":"object","properties":{"limit":{"type":"integer","minimum":1,"maximum":100,"default":25},"after":{"type":"string"},"text":{"type":"string"},"type":{"type":"string","enum":["video","screenshot","sessionReplay","recording"]},"folder":{"type":"string"},"author":{"type":"string"},"url":{"type":"string"},"createdAt":{"type":"string"}}}},"required":["source","credentials"]},{"type":"object","properties":{"source":{"type":"string","enum":["plain"]},"credentials":{"type":"object","properties":{"token":{"type":"string","minLength":1}},"required":["token"]},"options":{"type":"object","properties":{"state":{"type":"string","enum":["todo","done","snoozed","all"],"default":"all"},"limit":{"type":"integer","minimum":1,"maximum":1000},"cursor":{"type":"string"},"teamId":{"type":"string"},"teamName":{"type":"string"}}}},"required":["source","credentials"]},{"type":"object","properties":{"source":{"type":"string","enum":["zendesk"]},"credentials":{"type":"object","properties":{"subdomain":{"type":"string","minLength":1},"email":{"type":"string","format":"email"},"token":{"type":"string","minLength":1}},"required":["subdomain","email","token"]},"options":{"type":"object","properties":{"state":{"type":"string","enum":["open","pending","hold","solved","closed","all"],"default":"all"},"limit":{"type":"integer","minimum":1,"maximum":1000},"cursor":{"type":"string"}}}},"required":["source","credentials"]}]}}}},"responses":{"200":{"description":"Import resumed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"source":{"type":"string"},"jobId":{"type":"string"},"status":{"type":"string"},"counts":{"type":"object","additionalProperties":{"type":"number"}},"nextCursor":{"type":"string"}},"required":["ok","source","jobId","status"]}}}},"404":{"description":"Import not found"}}}},"/workspaces/{organizationId}/support/imports/{importId}/cancel":{"post":{"tags":["support-migration"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"importId","in":"path"}],"responses":{"200":{"description":"Import canceled","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"}},"required":["id","status"]}}}},"404":{"description":"Import not found"}}}},"/workspaces/{organizationId}/support/imports/validate":{"post":{"tags":["support-migration"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"source":{"type":"string","enum":["intercom"]},"credentials":{"type":"object","properties":{"token":{"type":"string","minLength":1}},"required":["token"]}},"required":["source","credentials"]},{"type":"object","properties":{"source":{"type":"string","enum":["jam"]},"credentials":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["data"]}},"required":["source","credentials"]},{"type":"object","properties":{"source":{"type":"string","enum":["jam-mcp"]},"credentials":{"type":"object","properties":{"token":{"type":"string","minLength":1}},"required":["token"]}},"required":["source","credentials"]},{"type":"object","properties":{"source":{"type":"string","enum":["plain"]},"credentials":{"type":"object","properties":{"token":{"type":"string","minLength":1}},"required":["token"]}},"required":["source","credentials"]},{"type":"object","properties":{"source":{"type":"string","enum":["zendesk"]},"credentials":{"type":"object","properties":{"subdomain":{"type":"string","minLength":1},"email":{"type":"string","format":"email"},"token":{"type":"string","minLength":1}},"required":["subdomain","email","token"]}},"required":["source","credentials"]}]}}}},"responses":{"200":{"description":"Validation result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"error":{"type":"string"}},"required":["ok"]}}}}}}},"/workspaces/{organizationId}/support/users/{userId}/status":{"post":{"tags":["support-team"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["active","away","snoozed","offline"]},"until":{"type":"string","format":"date-time"}},"required":["status"]}}}},"responses":{"200":{"description":"Status updated","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string"},"status":{"type":"string","enum":["active","away","snoozed","offline"]},"until":{"type":"string","nullable":true,"format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","userId","status","updatedAt"]}},"required":["status"]}}}}}}},"/workspaces/{organizationId}/support/agents":{"get":{"tags":["support-team"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Agents","content":{"application/json":{"schema":{"type":"object","properties":{"agents":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"status":{"type":"string","enum":["active","away","snoozed","offline"]},"until":{"type":"string","nullable":true,"format":"date-time"},"openTickets":{"type":"integer"}},"required":["userId","name","email","status","openTickets"]}}},"required":["agents"]}}}}}}},"/workspaces/{organizationId}/support/tiers":{"post":{"tags":["support-team"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"level":{"type":"integer"}},"required":["name","level"]}}}},"responses":{"201":{"description":"Tier created","content":{"application/json":{"schema":{"type":"object","properties":{"tier":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"level":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","level","createdAt","updatedAt"]}},"required":["tier"]}}}}}},"get":{"tags":["support-team"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Tiers","content":{"application/json":{"schema":{"type":"object","properties":{"tiers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"level":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","level","createdAt","updatedAt"]}}},"required":["tiers"]}}}}}}},"/workspaces/{organizationId}/support/tiers/{tierId}":{"get":{"tags":["support-team"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"tierId","in":"path"}],"responses":{"200":{"description":"Tier","content":{"application/json":{"schema":{"type":"object","properties":{"tier":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"level":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","level","createdAt","updatedAt"]}},"required":["tier"]}}}},"404":{"description":"Not found"}}},"patch":{"tags":["support-team"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"tierId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"level":{"type":"integer"}}}}}},"responses":{"200":{"description":"Tier updated","content":{"application/json":{"schema":{"type":"object","properties":{"tier":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"level":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","organizationId","name","level","createdAt","updatedAt"]}},"required":["tier"]}}}},"404":{"description":"Not found"}}},"delete":{"tags":["support-team"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"tierId","in":"path"}],"responses":{"204":{"description":"Deleted"},"404":{"description":"Not found"}}}},"/workspaces/{organizationId}/support/tiers/{tierId}/members":{"post":{"tags":["support-team"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"tierId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"}},"required":["userId"]}}}},"responses":{"201":{"description":"Member added"},"404":{"description":"Tier not found"}}},"get":{"tags":["support-team"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"tierId","in":"path"}],"responses":{"200":{"description":"Tier members","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"}},"required":["userId","name","email"]}}},"required":["members"]}}}}}}},"/workspaces/{organizationId}/support/tiers/{tierId}/members/{userId}":{"delete":{"tags":["support-team"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"tierId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"responses":{"204":{"description":"Member removed"},"404":{"description":"Member not found"}}}},"/workspaces/{organizationId}/csv-exports":{"post":{"tags":["csv-exports"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"entityType":{"type":"string","enum":["issues","projects"]},"teamId":{"type":"string"},"status":{"type":"string","enum":["triage","backlog","todo","in_progress","done","canceled"]},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"assigneeId":{"type":"string"},"projectId":{"type":"string"}},"required":["entityType"]}}}},"responses":{"200":{"description":"CSV export","content":{"text/csv":{"schema":{"type":"string"}}}}}}},"/workspaces/{organizationId}/releases":{"get":{"tags":["releases"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"projectId","in":"query"},{"schema":{"type":"string"},"required":false,"name":"teamId","in":"query"},{"schema":{"type":"string","enum":["upcoming","in_progress","released","archived"]},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"Releases list","content":{"application/json":{"schema":{"type":"object","properties":{"releases":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string","nullable":true},"teamId":{"type":"string","nullable":true},"name":{"type":"string"},"version":{"type":"string","nullable":true},"status":{"type":"string","enum":["upcoming","in_progress","released","archived"]},"notes":{"type":"string","nullable":true},"plannedAt":{"type":"string","nullable":true},"releasedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","teamId","name","version","status","notes","plannedAt","releasedAt","createdAt","updatedAt"]}}},"required":["releases"]}}}}}},"post":{"tags":["releases"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"type":"string"},"teamId":{"type":"string"},"name":{"type":"string","minLength":1},"version":{"type":"string"},"status":{"type":"string","enum":["upcoming","in_progress","released","archived"],"default":"upcoming"},"notes":{"type":"string"},"plannedAt":{"type":"string"},"releasedAt":{"type":"string"}},"required":["name"]}}}},"responses":{"201":{"description":"Release created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string","nullable":true},"teamId":{"type":"string","nullable":true},"name":{"type":"string"},"version":{"type":"string","nullable":true},"status":{"type":"string","enum":["upcoming","in_progress","released","archived"]},"notes":{"type":"string","nullable":true},"plannedAt":{"type":"string","nullable":true},"releasedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","teamId","name","version","status","notes","plannedAt","releasedAt","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/releases/{id}":{"get":{"tags":["releases"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Release","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string","nullable":true},"teamId":{"type":"string","nullable":true},"name":{"type":"string"},"version":{"type":"string","nullable":true},"status":{"type":"string","enum":["upcoming","in_progress","released","archived"]},"notes":{"type":"string","nullable":true},"plannedAt":{"type":"string","nullable":true},"releasedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","teamId","name","version","status","notes","plannedAt","releasedAt","createdAt","updatedAt"]}}}}}},"patch":{"tags":["releases"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"type":"string"},"teamId":{"type":"string"},"name":{"type":"string","minLength":1},"version":{"type":"string"},"status":{"type":"string","enum":["upcoming","in_progress","released","archived"],"default":"upcoming"},"notes":{"type":"string"},"plannedAt":{"type":"string"},"releasedAt":{"type":"string"}}}}}},"responses":{"200":{"description":"Release updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"projectId":{"type":"string","nullable":true},"teamId":{"type":"string","nullable":true},"name":{"type":"string"},"version":{"type":"string","nullable":true},"status":{"type":"string","enum":["upcoming","in_progress","released","archived"]},"notes":{"type":"string","nullable":true},"plannedAt":{"type":"string","nullable":true},"releasedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","projectId","teamId","name","version","status","notes","plannedAt","releasedAt","createdAt","updatedAt"]}}}}}},"delete":{"tags":["releases"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Release deleted"}}}},"/workspaces/{organizationId}/issues/{issueId}/relations":{"get":{"tags":["relations"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"},{"schema":{"type":"string","enum":["outgoing","incoming"]},"required":false,"name":"direction","in":"query"}],"responses":{"200":{"description":"Issue relations","content":{"application/json":{"schema":{"type":"object","properties":{"relations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"fromIssueId":{"type":"string"},"toIssueId":{"type":"string"},"type":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","fromIssueId","toIssueId","type","createdAt"]}},"inverseRelations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"fromIssueId":{"type":"string"},"toIssueId":{"type":"string"},"type":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","fromIssueId","toIssueId","type","createdAt"]}}},"required":["relations"]}}}}}},"post":{"tags":["relations"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"toIssueId":{"type":"string","minLength":1},"type":{"type":"string","enum":["related","blocks","duplicate","similar"]}},"required":["toIssueId","type"]}}}},"responses":{"201":{"description":"Relation created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"fromIssueId":{"type":"string"},"toIssueId":{"type":"string"},"type":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","fromIssueId","toIssueId","type","createdAt"]}}}}}}},"/workspaces/{organizationId}/relations/{id}":{"delete":{"tags":["relations"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Relation deleted"}}}},"/workspaces/{organizationId}/issues/{issueId}/external-links":{"get":{"tags":["issue-external-links"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"responses":{"200":{"description":"External links","content":{"application/json":{"schema":{"type":"object","properties":{"links":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"entityType":{"type":"string"},"entityId":{"type":"string"},"url":{"type":"string"},"label":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","entityType","entityId","url","label","createdAt"]}}},"required":["links"]}}}}}},"post":{"tags":["issue-external-links"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"label":{"type":"string"}},"required":["url"]}}}},"responses":{"201":{"description":"External link created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"entityType":{"type":"string"},"entityId":{"type":"string"},"url":{"type":"string"},"label":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","entityType","entityId","url","label","createdAt"]}}}}}}},"/workspaces/{organizationId}/issues/{issueId}/external-links/{id}":{"get":{"tags":["issue-external-links"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"External link","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"entityType":{"type":"string"},"entityId":{"type":"string"},"url":{"type":"string"},"label":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","entityType","entityId","url","label","createdAt"]}}}},"404":{"description":"External link not found"}}},"patch":{"tags":["issue-external-links"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"label":{"type":"string"}}}}}},"responses":{"200":{"description":"External link updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"entityType":{"type":"string"},"entityId":{"type":"string"},"url":{"type":"string"},"label":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","entityType","entityId","url","label","createdAt"]}}}},"404":{"description":"External link not found"}}},"delete":{"tags":["issue-external-links"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"External link deleted"},"404":{"description":"External link not found"}}}},"/workspaces/{organizationId}/mcp/servers":{"get":{"tags":["mcp-servers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","enum":["workspace","repo","issue"]},"required":false,"name":"scope","in":"query"}],"responses":{"200":{"description":"MCP servers list","content":{"application/json":{"schema":{"type":"object","properties":{"servers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"url":{"type":"string"},"scope":{"type":"string","enum":["workspace","repo","issue"]},"repo":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","url","scope","repo","issueId","createdAt","updatedAt"]}}},"required":["servers"]}}}}}},"post":{"tags":["mcp-servers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"url":{"type":"string","format":"uri"},"scope":{"type":"string","enum":["workspace","repo","issue"]},"repo":{"type":"string"},"issueId":{"type":"string"}},"required":["name","url","scope"]}}}},"responses":{"201":{"description":"MCP server created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"url":{"type":"string"},"scope":{"type":"string","enum":["workspace","repo","issue"]},"repo":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","url","scope","repo","issueId","createdAt","updatedAt"]}}}},"400":{"description":"Bad request"}}}},"/workspaces/{organizationId}/mcp/servers/{id}":{"get":{"tags":["mcp-servers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"MCP server","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"url":{"type":"string"},"scope":{"type":"string","enum":["workspace","repo","issue"]},"repo":{"type":"string","nullable":true},"issueId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","url","scope","repo","issueId","createdAt","updatedAt"]}}}},"404":{"description":"MCP server not found"}}},"delete":{"tags":["mcp-servers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"MCP server deleted"},"404":{"description":"MCP server not found"}}}},"/workspaces/{organizationId}/issues/{issueId}/subscribers":{"get":{"tags":["issue-subscribers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"responses":{"200":{"description":"Issue subscribers list","content":{"application/json":{"schema":{"type":"object","properties":{"subscribers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"linearUserId":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","issueId","linearUserId","createdAt"]}}},"required":["subscribers"]}}}}}},"post":{"tags":["issue-subscribers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"linearUserId":{"type":"string","minLength":1}},"required":["linearUserId"]}}}},"responses":{"201":{"description":"Subscriber added","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"linearUserId":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","issueId","linearUserId","createdAt"]}}}}}}},"/workspaces/{organizationId}/issues/{issueId}/subscribers/{id}":{"delete":{"tags":["issue-subscribers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Subscriber removed"}}}},"/workspaces/{organizationId}/issues/{issueId}/attachments":{"get":{"tags":["attachments"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"responses":{"200":{"description":"Attachments list","content":{"application/json":{"schema":{"type":"object","properties":{"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"linearId":{"type":"string"},"url":{"type":"string"},"title":{"type":"string","nullable":true},"subtitle":{"type":"string","nullable":true},"r2Key":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","issueId","linearId","url","title","subtitle","r2Key","createdAt"]}}},"required":["attachments"]}}}}}},"post":{"tags":["attachments"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"title":{"type":"string"},"subtitle":{"type":"string"}},"required":["url"]}}}},"responses":{"201":{"description":"Attachment created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"linearId":{"type":"string"},"url":{"type":"string"},"title":{"type":"string","nullable":true},"subtitle":{"type":"string","nullable":true},"r2Key":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","issueId","linearId","url","title","subtitle","r2Key","createdAt"]}}}},"404":{"description":"Issue not found"}}}},"/workspaces/{organizationId}/issues/{issueId}/attachments/{id}":{"get":{"tags":["attachments"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Attachment","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"linearId":{"type":"string"},"url":{"type":"string"},"title":{"type":"string","nullable":true},"subtitle":{"type":"string","nullable":true},"r2Key":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","issueId","linearId","url","title","subtitle","r2Key","createdAt"]}}}},"404":{"description":"Attachment not found"}}},"delete":{"tags":["attachments"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Attachment deleted"},"404":{"description":"Attachment not found"}}}},"/workspaces/{organizationId}/github/users":{"post":{"tags":["github"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"githubLogin":{"type":"string"}},"required":["userId","githubLogin"]}}}},"responses":{"201":{"description":"GitHub user mapping created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string"},"githubLogin":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","userId","githubLogin","createdAt"]}}}}}},"get":{"tags":["github"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"GitHub user mappings","content":{"application/json":{"schema":{"type":"object","properties":{"users":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string"},"githubLogin":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","userId","githubLogin","createdAt"]}}},"required":["users"]}}}}}}},"/workspaces/{organizationId}/github/install":{"post":{"tags":["github"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"installationId":{"type":"string"}},"required":["installationId"]}}}},"responses":{"200":{"description":"Installed repositories","content":{"application/json":{"schema":{"type":"object","properties":{"repos":{"type":"array","items":{"type":"object","properties":{"full_name":{"type":"string"}},"required":["full_name"]}}},"required":["repos"]}}}}}}},"/workspaces/{organizationId}/github/installations":{"get":{"tags":["github"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"GitHub installations","content":{"application/json":{"schema":{"type":"object","properties":{"installations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"installationId":{"type":"string"},"repo":{"type":"string"},"defaultAgentId":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","installationId","repo","defaultAgentId","createdAt"]}}},"required":["installations"]}}}}}}},"/workspaces/{organizationId}/github/installations/{id}":{"patch":{"tags":["github"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"defaultAgentId":{"type":"string","nullable":true}},"required":["defaultAgentId"]}}}},"responses":{"200":{"description":"Installation updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"installationId":{"type":"string"},"repo":{"type":"string"},"defaultAgentId":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","installationId","repo","defaultAgentId","createdAt"]}}}},"404":{"description":"Installation not found"}}},"delete":{"tags":["github"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Installation removed"}}}},"/workspaces/{organizationId}/issues/{issueId}/history":{"get":{"tags":["history"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"issueId","in":"path"}],"responses":{"200":{"description":"Issue history","content":{"application/json":{"schema":{"type":"object","properties":{"history":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"issueId":{"type":"string"},"linearId":{"type":"string","nullable":true},"field":{"type":"string"},"fromValue":{"type":"string","nullable":true},"toValue":{"type":"string","nullable":true},"actorId":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","issueId","linearId","field","fromValue","toValue","actorId","createdAt"]}}},"required":["history"]}}}}}}},"/workspaces/{organizationId}/states":{"post":{"tags":["states"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"linearId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"type":{"type":"string","minLength":1},"color":{"type":"string"},"position":{"type":"string"}},"required":["linearId","name","type"]}}}},"responses":{"201":{"description":"State created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"linearId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"color":{"type":"string","nullable":true},"position":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","linearId","name","type","color","position","createdAt"]}}}}}},"get":{"tags":["states"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"States list","content":{"application/json":{"schema":{"type":"object","properties":{"states":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"linearId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"color":{"type":"string","nullable":true},"position":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","linearId","name","type","color","position","createdAt"]}}},"required":["states"]}}}}}}},"/workspaces/{organizationId}/states/{id}":{"get":{"tags":["states"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"State","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"linearId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"color":{"type":"string","nullable":true},"position":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","linearId","name","type","color","position","createdAt"]}}}}}},"patch":{"tags":["states"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"type":{"type":"string"},"color":{"type":"string"},"position":{"type":"string"}}}}}},"responses":{"200":{"description":"State updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"linearId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"color":{"type":"string","nullable":true},"position":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","linearId","name","type","color","position","createdAt"]}}}}}},"delete":{"tags":["states"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"State deleted"}}}},"/workspaces/{organizationId}/webhook-subscriptions":{"post":{"tags":["webhooks"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"string"},"secret":{"type":"string"}},"required":["url"]}}}},"responses":{"201":{"description":"Webhook subscription created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"url":{"type":"string"},"events":{"type":"string"},"secret":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","url","events","secret","createdAt"]}}}}}},"get":{"tags":["webhooks"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Webhook subscriptions list","content":{"application/json":{"schema":{"type":"object","properties":{"subscriptions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"url":{"type":"string"},"events":{"type":"string"},"secret":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","url","events","secret","createdAt"]}}},"required":["subscriptions"]}}}}}}},"/workspaces/{organizationId}/webhook-subscriptions/{id}":{"get":{"tags":["webhooks"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Webhook subscription","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"url":{"type":"string"},"events":{"type":"string"},"secret":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","url","events","secret","createdAt"]}}}}}},"patch":{"tags":["webhooks"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"string"},"secret":{"type":"string"}}}}}},"responses":{"200":{"description":"Webhook subscription updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"url":{"type":"string"},"events":{"type":"string"},"secret":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","url","events","secret","createdAt"]}}}}}},"delete":{"tags":["webhooks"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Webhook subscription deleted"}}}},"/workspaces/{organizationId}/webhook-subscriptions/{id}/deliveries":{"get":{"tags":["webhooks"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Webhook deliveries list","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"subscriptionId":{"type":"string"},"event":{"type":"string"},"url":{"type":"string"},"status":{"type":"string"},"statusCode":{"type":"number","nullable":true},"error":{"type":"string","nullable":true},"attemptCount":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","subscriptionId","event","url","status","statusCode","error","attemptCount","createdAt","updatedAt"]}}},"required":["deliveries"]}}}}}}},"/workspaces/{organizationId}/webhook-deliveries":{"get":{"tags":["webhooks"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","enum":["pending","processing","completed","failed"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Inbound webhook delivery log","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"type":"object","properties":{"deliveryId":{"type":"string"},"source":{"type":"string"},"event":{"type":"string"},"organizationId":{"type":"string","nullable":true},"processedAt":{"type":"string"},"status":{"type":"string"},"attemptCount":{"type":"number"},"payload":{"type":"string","nullable":true},"lastError":{"type":"string","nullable":true},"nextRetryAt":{"type":"string","nullable":true},"lockedAt":{"type":"string","nullable":true},"result":{"type":"string","nullable":true}},"required":["deliveryId","source","event","organizationId","processedAt","status","attemptCount","payload","lastError","nextRetryAt","lockedAt","result"]}}},"required":["deliveries"]}}}}}}},"/workspaces/{organizationId}/linear-users":{"post":{"tags":["linear-users"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"linearId":{"type":"string","minLength":1},"name":{"type":"string"},"email":{"type":"string"}},"required":["linearId"]}}}},"responses":{"201":{"description":"Linear user created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"linearId":{"type":"string"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","linearId","name","email","createdAt"]}}}}}},"get":{"tags":["linear-users"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Linear users list","content":{"application/json":{"schema":{"type":"object","properties":{"linearUsers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"linearId":{"type":"string"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","linearId","name","email","createdAt"]}}},"required":["linearUsers"]}}}}}}},"/workspaces/{organizationId}/linear-users/{linearId}":{"get":{"tags":["linear-users"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"linearId","in":"path"}],"responses":{"200":{"description":"Linear user","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"linearId":{"type":"string"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","linearId","name","email","createdAt"]}}}}}}},"/workspaces/{organizationId}/notifications":{"get":{"tags":["notifications"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","description":"Only unread notifications"},"required":false,"description":"Only unread notifications","name":"unreadOnly","in":"query"},{"schema":{"type":"string","description":"Only snoozed notifications"},"required":false,"description":"Only snoozed notifications","name":"snoozedOnly","in":"query"},{"schema":{"type":"string","description":"Include snoozed notifications"},"required":false,"description":"Include snoozed notifications","name":"includeSnoozed","in":"query"},{"schema":{"type":"string","description":"Max notifications to return"},"required":false,"description":"Max notifications to return","name":"limit","in":"query"}],"responses":{"200":{"description":"Notifications list","content":{"application/json":{"schema":{"type":"object","properties":{"notifications":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"recipientId":{"type":"string"},"recipientType":{"type":"string"},"issueId":{"type":"string"},"type":{"type":"string"},"read":{"type":"boolean"},"snoozedUntil":{"type":"string","nullable":true},"metadata":{"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","recipientId","recipientType","issueId","type","read","snoozedUntil","createdAt","updatedAt"]}}},"required":["notifications"]}}}}}}},"/workspaces/{organizationId}/notifications/unread-count":{"get":{"tags":["notifications"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Unread notification count","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"}},"required":["count"]}}}}}}},"/workspaces/{organizationId}/notifications/{id}/read":{"patch":{"tags":["notifications"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Notification marked read","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"recipientId":{"type":"string"},"recipientType":{"type":"string"},"issueId":{"type":"string"},"type":{"type":"string"},"read":{"type":"boolean"},"snoozedUntil":{"type":"string","nullable":true},"metadata":{"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","recipientId","recipientType","issueId","type","read","snoozedUntil","createdAt","updatedAt"]}}}},"404":{"description":"Notification not found"}}}},"/workspaces/{organizationId}/notifications/{id}/unread":{"patch":{"tags":["notifications"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Notification marked unread","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"recipientId":{"type":"string"},"recipientType":{"type":"string"},"issueId":{"type":"string"},"type":{"type":"string"},"read":{"type":"boolean"},"snoozedUntil":{"type":"string","nullable":true},"metadata":{"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","recipientId","recipientType","issueId","type","read","snoozedUntil","createdAt","updatedAt"]}}}},"404":{"description":"Notification not found"}}}},"/workspaces/{organizationId}/notifications/{id}/snooze":{"patch":{"tags":["notifications"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"until":{"type":"string","nullable":true,"format":"date-time","description":"ISO timestamp to snooze until, or null to unsnooze"}},"required":["until"]}}}},"responses":{"200":{"description":"Notification snoozed","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"recipientId":{"type":"string"},"recipientType":{"type":"string"},"issueId":{"type":"string"},"type":{"type":"string"},"read":{"type":"boolean"},"snoozedUntil":{"type":"string","nullable":true},"metadata":{"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","recipientId","recipientType","issueId","type","read","snoozedUntil","createdAt","updatedAt"]}}}},"404":{"description":"Notification not found"}}}},"/workspaces/{organizationId}/notifications/mark-all-read":{"post":{"tags":["notifications"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"204":{"description":"All notifications marked read"}}}},"/workspaces/{organizationId}/notification-preferences":{"get":{"tags":["notifications"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"My notification delivery preferences","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"userId":{"type":"string"},"inApp":{"type":"boolean"},"webhook":{"type":"boolean"},"email":{"type":"boolean","nullable":true},"emailExplicit":{"type":"boolean"},"mutedTypes":{"type":"array","nullable":true,"items":{"type":"string"}},"updatedAt":{"type":"string"}},"required":["organizationId","userId","inApp","webhook","email","emailExplicit","mutedTypes","updatedAt"]}}}}}},"put":{"tags":["notifications"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"inApp":{"type":"boolean"},"webhook":{"type":"boolean"},"email":{"type":"boolean"},"mutedTypes":{"type":"array","nullable":true,"items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Preferences updated","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"userId":{"type":"string"},"inApp":{"type":"boolean"},"webhook":{"type":"boolean"},"email":{"type":"boolean","nullable":true},"emailExplicit":{"type":"boolean"},"mutedTypes":{"type":"array","nullable":true,"items":{"type":"string"}},"updatedAt":{"type":"string"}},"required":["organizationId","userId","inApp","webhook","email","emailExplicit","mutedTypes","updatedAt"]}}}}}}},"/workspaces/{organizationId}/observability/metrics":{"get":{"tags":["observability"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Workspace metrics","content":{"application/json":{"schema":{"type":"object","properties":{"supportTickets":{"type":"object","properties":{"total":{"type":"number"},"open":{"type":"number"},"done":{"type":"number"},"snoozed":{"type":"number"}},"required":["total","open","done","snoozed"]},"supportCustomers":{"type":"object","properties":{"total":{"type":"number"}},"required":["total"]},"webhookDeliveries":{"type":"object","properties":{"total":{"type":"number"},"pending":{"type":"number"},"processing":{"type":"number"},"completed":{"type":"number"},"failed":{"type":"number"}},"required":["total","pending","processing","completed","failed"]},"tokens":{"type":"object","properties":{"total":{"type":"number"}},"required":["total"]}},"required":["supportTickets","supportCustomers","webhookDeliveries","tokens"]}}}}}}},"/workspaces/{organizationId}/push-tokens":{"get":{"tags":["push"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Push tokens list","content":{"application/json":{"schema":{"type":"object","properties":{"tokens":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string"},"name":{"type":"string","nullable":true},"provider":{"type":"string","enum":["fcm","apns","expo"]},"token":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","userId","name","provider","token","createdAt"]}}},"required":["tokens"]}}}}}},"post":{"tags":["push"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"provider":{"type":"string","enum":["fcm","apns","expo"],"default":"fcm"},"token":{"type":"string","minLength":1}},"required":["token"]}}}},"responses":{"201":{"description":"Push token created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string"},"name":{"type":"string","nullable":true},"provider":{"type":"string","enum":["fcm","apns","expo"]},"token":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","userId","name","provider","token","createdAt"]}}}}}}},"/workspaces/{organizationId}/push-tokens/{id}":{"delete":{"tags":["push"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Push token deleted"}}}},"/workspaces/{organizationId}/push/send":{"post":{"tags":["push"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"tokenId":{"type":"string"},"userId":{"type":"string"},"title":{"type":"string","minLength":1},"body":{"type":"string","minLength":1},"data":{"type":"object","additionalProperties":{"nullable":true},"default":{}}},"required":["title","body"]}}}},"responses":{"202":{"description":"Push delivery accepted","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"tokenId":{"type":"string"},"userId":{"type":"string"},"payload":{"type":"string"},"status":{"type":"string"},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","tokenId","userId","payload","status","error","createdAt","updatedAt"]}}},"required":["deliveries"]}}}}}}},"/workspaces/{organizationId}/issues/{id}/reactions":{"get":{"tags":["reactions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Issue reactions","content":{"application/json":{"schema":{"type":"object","properties":{"reactions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"targetType":{"type":"string"},"targetId":{"type":"string"},"actorId":{"type":"string"},"emoji":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","targetType","targetId","actorId","emoji","createdAt","updatedAt"]}}},"required":["reactions"]}}}}}},"post":{"tags":["reactions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"emoji":{"type":"string"}},"required":["emoji"]}}}},"responses":{"201":{"description":"Reaction created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"targetType":{"type":"string"},"targetId":{"type":"string"},"actorId":{"type":"string"},"emoji":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","targetType","targetId","actorId","emoji","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/comments/{commentId}/reactions":{"get":{"tags":["reactions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"commentId","in":"path"}],"responses":{"200":{"description":"Comment reactions","content":{"application/json":{"schema":{"type":"object","properties":{"reactions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"targetType":{"type":"string"},"targetId":{"type":"string"},"actorId":{"type":"string"},"emoji":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","targetType","targetId","actorId","emoji","createdAt","updatedAt"]}}},"required":["reactions"]}}}}}},"post":{"tags":["reactions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"commentId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"emoji":{"type":"string"}},"required":["emoji"]}}}},"responses":{"201":{"description":"Reaction created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"targetType":{"type":"string"},"targetId":{"type":"string"},"actorId":{"type":"string"},"emoji":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","targetType","targetId","actorId","emoji","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/reactions/{reactionId}":{"delete":{"tags":["reactions"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"reactionId","in":"path"}],"responses":{"204":{"description":"Reaction deleted"}}}},"/workspaces/{organizationId}/realtime":{"get":{"tags":["realtime"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string","description":"Workspace API key for browser WebSocket clients, which cannot set the Authorization header"},"required":false,"description":"Workspace API key for browser WebSocket clients, which cannot set the Authorization header","name":"token","in":"query"}],"responses":{"101":{"description":"Switching Protocols to WebSocket"},"200":{"description":"Realtime endpoint (non-upgrade request)"},"426":{"description":"Upgrade Required"}}}},"/workspaces/{organizationId}/saved-views":{"get":{"tags":["saved-views"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Saved views list","content":{"application/json":{"schema":{"type":"object","properties":{"views":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"ownerId":{"type":"string"},"name":{"type":"string"},"shared":{"type":"boolean"},"isFavorite":{"type":"boolean"},"filter":{"nullable":true},"search":{"type":"string","nullable":true},"sort":{"type":"object","nullable":true,"properties":{"field":{"type":"string","minLength":1},"direction":{"type":"string","enum":["asc","desc"]}},"required":["field"]},"columns":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","ownerId","name","shared","search","sort","columns","createdAt","updatedAt"]}}},"required":["views"]}}}}}},"post":{"tags":["saved-views"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"shared":{"type":"boolean"},"filter":{"nullable":true},"search":{"type":"string"},"sort":{"type":"object","properties":{"field":{"type":"string","minLength":1},"direction":{"type":"string","enum":["asc","desc"]}},"required":["field"]},"columns":{"type":"array","items":{"type":"string"}}},"required":["name"]}}}},"responses":{"201":{"description":"Saved view created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"ownerId":{"type":"string"},"name":{"type":"string"},"shared":{"type":"boolean"},"isFavorite":{"type":"boolean"},"filter":{"nullable":true},"search":{"type":"string","nullable":true},"sort":{"type":"object","nullable":true,"properties":{"field":{"type":"string","minLength":1},"direction":{"type":"string","enum":["asc","desc"]}},"required":["field"]},"columns":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","ownerId","name","shared","search","sort","columns","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/saved-views/{id}/favorite":{"post":{"tags":["saved-views"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"View favorited","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"ownerId":{"type":"string"},"name":{"type":"string"},"shared":{"type":"boolean"},"isFavorite":{"type":"boolean"},"filter":{"nullable":true},"search":{"type":"string","nullable":true},"sort":{"type":"object","nullable":true,"properties":{"field":{"type":"string","minLength":1},"direction":{"type":"string","enum":["asc","desc"]}},"required":["field"]},"columns":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","ownerId","name","shared","search","sort","columns","createdAt","updatedAt"]}}}},"404":{"description":"Saved view not found"}}},"delete":{"tags":["saved-views"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"View unfavorited"},"404":{"description":"Saved view not found"}}}},"/workspaces/{organizationId}/me/view-preferences":{"get":{"tags":["saved-views"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Per-user view preferences","content":{"application/json":{"schema":{"type":"object","properties":{"defaultViewId":{"type":"string","nullable":true}},"required":["defaultViewId"]}}}}}},"put":{"tags":["saved-views"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"defaultViewId":{"type":"string","nullable":true}},"required":["defaultViewId"]}}}},"responses":{"200":{"description":"View preferences updated","content":{"application/json":{"schema":{"type":"object","properties":{"defaultViewId":{"type":"string","nullable":true}},"required":["defaultViewId"]}}}},"404":{"description":"Saved view not found"}}}},"/workspaces/{organizationId}/saved-views/{id}":{"get":{"tags":["saved-views"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Saved view","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"ownerId":{"type":"string"},"name":{"type":"string"},"shared":{"type":"boolean"},"isFavorite":{"type":"boolean"},"filter":{"nullable":true},"search":{"type":"string","nullable":true},"sort":{"type":"object","nullable":true,"properties":{"field":{"type":"string","minLength":1},"direction":{"type":"string","enum":["asc","desc"]}},"required":["field"]},"columns":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","ownerId","name","shared","search","sort","columns","createdAt","updatedAt"]}}}},"404":{"description":"Saved view not found"}}},"patch":{"tags":["saved-views"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"shared":{"type":"boolean"},"filter":{"nullable":true},"search":{"type":"string"},"sort":{"type":"object","nullable":true,"properties":{"field":{"type":"string","minLength":1},"direction":{"type":"string","enum":["asc","desc"]}},"required":["field"]},"columns":{"type":"array","nullable":true,"items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Saved view updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"ownerId":{"type":"string"},"name":{"type":"string"},"shared":{"type":"boolean"},"isFavorite":{"type":"boolean"},"filter":{"nullable":true},"search":{"type":"string","nullable":true},"sort":{"type":"object","nullable":true,"properties":{"field":{"type":"string","minLength":1},"direction":{"type":"string","enum":["asc","desc"]}},"required":["field"]},"columns":{"type":"array","nullable":true,"items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","ownerId","name","shared","search","sort","columns","createdAt","updatedAt"]}}}},"404":{"description":"Saved view not found"}}},"delete":{"tags":["saved-views"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Saved view deleted"}}}},"/workspaces/{organizationId}/search":{"post":{"tags":["search"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string","minLength":1},"teamIds":{"type":"array","items":{"type":"string"},"default":[]},"limit":{"type":"integer","minimum":1,"maximum":1000,"default":50}},"required":["query"]}}}},"responses":{"200":{"description":"Search results","content":{"application/json":{"schema":{"type":"object","properties":{"issueIds":{"type":"array","items":{"type":"string"}},"documentIds":{"type":"array","items":{"type":"string"}}},"required":["issueIds","documentIds"]}}}}}}},"/workspaces/{organizationId}/teams":{"get":{"tags":["teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Teams list","content":{"application/json":{"schema":{"type":"object","properties":{"teams":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"ownerId":{"type":"string"},"isDefault":{"type":"boolean"},"isPublic":{"type":"boolean"},"parentAutoClose":{"type":"boolean"},"triageAssigneeId":{"type":"string","nullable":true},"triageAgentId":{"type":"string","nullable":true},"defaultTemplateId":{"type":"string","nullable":true},"defaultRepo":{"type":"string","nullable":true},"subIssueAutoClose":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","name","ownerId","isDefault","isPublic","parentAutoClose","triageAssigneeId","triageAgentId","defaultTemplateId","defaultRepo","subIssueAutoClose","createdAt","updatedAt"]}}},"required":["teams"]}}}}}},"post":{"tags":["teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"isPublic":{"type":"boolean"},"parentAutoClose":{"type":"boolean"},"triageAssigneeId":{"type":"string","nullable":true},"triageAgentId":{"type":"string","nullable":true},"defaultTemplateId":{"type":"string","nullable":true},"defaultRepo":{"type":"string","nullable":true},"subIssueAutoClose":{"type":"boolean"}},"required":["key","name"]}}}},"responses":{"201":{"description":"Team created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"ownerId":{"type":"string"},"isDefault":{"type":"boolean"},"isPublic":{"type":"boolean"},"parentAutoClose":{"type":"boolean"},"triageAssigneeId":{"type":"string","nullable":true},"triageAgentId":{"type":"string","nullable":true},"defaultTemplateId":{"type":"string","nullable":true},"defaultRepo":{"type":"string","nullable":true},"subIssueAutoClose":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","name","ownerId","isDefault","isPublic","parentAutoClose","triageAssigneeId","triageAgentId","defaultTemplateId","defaultRepo","subIssueAutoClose","createdAt","updatedAt"]}}}}}}},"/workspaces/{organizationId}/teams/{id}":{"get":{"tags":["teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Team","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"ownerId":{"type":"string"},"isDefault":{"type":"boolean"},"isPublic":{"type":"boolean"},"parentAutoClose":{"type":"boolean"},"triageAssigneeId":{"type":"string","nullable":true},"triageAgentId":{"type":"string","nullable":true},"defaultTemplateId":{"type":"string","nullable":true},"defaultRepo":{"type":"string","nullable":true},"subIssueAutoClose":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","name","ownerId","isDefault","isPublic","parentAutoClose","triageAssigneeId","triageAgentId","defaultTemplateId","defaultRepo","subIssueAutoClose","createdAt","updatedAt"]}}}},"404":{"description":"Team not found"}}},"patch":{"tags":["teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"isPublic":{"type":"boolean"},"parentAutoClose":{"type":"boolean"},"triageAssigneeId":{"type":"string","nullable":true},"triageAgentId":{"type":"string","nullable":true},"defaultTemplateId":{"type":"string","nullable":true},"defaultRepo":{"type":"string","nullable":true},"subIssueAutoClose":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Team updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"ownerId":{"type":"string"},"isDefault":{"type":"boolean"},"isPublic":{"type":"boolean"},"parentAutoClose":{"type":"boolean"},"triageAssigneeId":{"type":"string","nullable":true},"triageAgentId":{"type":"string","nullable":true},"defaultTemplateId":{"type":"string","nullable":true},"defaultRepo":{"type":"string","nullable":true},"subIssueAutoClose":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","name","ownerId","isDefault","isPublic","parentAutoClose","triageAssigneeId","triageAgentId","defaultTemplateId","defaultRepo","subIssueAutoClose","createdAt","updatedAt"]}}}},"404":{"description":"Team not found"}}},"delete":{"tags":["teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Team deleted"},"400":{"description":"Team is the workspace default"},"403":{"description":"Cannot delete this team"},"409":{"description":"Team still has issues"}}}},"/workspaces/{organizationId}/teams/{id}/members":{"get":{"tags":["teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Team members","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"memberId":{"type":"string"},"memberType":{"type":"string","enum":["user","agent"]},"role":{"type":"string"}},"required":["memberId","memberType","role"]}}},"required":["members"]}}}}}},"post":{"tags":["teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"memberId":{"type":"string"},"memberType":{"type":"string","enum":["user","agent"]},"role":{"type":"string","enum":["member","guest"]}},"required":["memberId","memberType"]}}}},"responses":{"204":{"description":"Member added"}}}},"/workspaces/{organizationId}/teams/{id}/members/{memberId}":{"delete":{"tags":["teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"memberId","in":"path"},{"schema":{"type":"string","enum":["user","agent"]},"required":false,"name":"memberType","in":"query"}],"responses":{"204":{"description":"Member removed"}}},"patch":{"tags":["teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"memberId","in":"path"},{"schema":{"type":"string","enum":["user","agent"]},"required":false,"name":"memberType","in":"query"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["member","guest","admin"]}},"required":["role"]}}}},"responses":{"204":{"description":"Member role updated"}}}},"/workspaces/{organizationId}/users/{userId}/teams":{"get":{"tags":["teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"responses":{"200":{"description":"User teams","content":{"application/json":{"schema":{"type":"object","properties":{"teams":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"key":{"type":"string"},"name":{"type":"string"},"ownerId":{"type":"string"},"isDefault":{"type":"boolean"},"isPublic":{"type":"boolean"},"parentAutoClose":{"type":"boolean"},"triageAssigneeId":{"type":"string","nullable":true},"triageAgentId":{"type":"string","nullable":true},"defaultTemplateId":{"type":"string","nullable":true},"defaultRepo":{"type":"string","nullable":true},"subIssueAutoClose":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","name","ownerId","isDefault","isPublic","parentAutoClose","triageAssigneeId","triageAgentId","defaultTemplateId","defaultRepo","subIssueAutoClose","createdAt","updatedAt"]}}},"required":["teams"]}}}}}}},"/workspaces/{organizationId}/templates":{"get":{"tags":["templates"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Templates list","content":{"application/json":{"schema":{"type":"object","properties":{"templates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"linearId":{"type":"string"},"name":{"type":"string"},"templateData":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","linearId","name","templateData","createdAt"]}}},"required":["templates"]}}}}}},"post":{"tags":["templates"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"linearId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"templateData":{"type":"string"}},"required":["linearId","name"]}}}},"responses":{"201":{"description":"Template created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"linearId":{"type":"string"},"name":{"type":"string"},"templateData":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","linearId","name","templateData","createdAt"]}}}}}}},"/workspaces/{organizationId}/templates/{id}":{"get":{"tags":["templates"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Template","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"linearId":{"type":"string"},"name":{"type":"string"},"templateData":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","organizationId","linearId","name","templateData","createdAt"]}}}}}}},"/workspaces/{organizationId}/import":{"post":{"tags":["import"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","enum":["jira","confluence","linear","notion","github-issues","intercom"]},"credentials":{"nullable":true},"options":{"nullable":true}},"required":["source"]}}}},"responses":{"200":{"description":"Import started or awaiting approval","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"source":{"type":"string"},"jobId":{"type":"string"},"status":{"type":"string"},"counts":{"type":"object","additionalProperties":{"type":"number"}},"nextCursor":{"type":"string"}},"required":["ok","source","jobId","status"]}}}}}}},"/workspaces/{organizationId}/import/{jobId}":{"get":{"tags":["import"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"jobId","in":"path"}],"responses":{"200":{"description":"Import job status","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string"},"status":{"type":"string"},"counts":{"type":"object","additionalProperties":{"type":"number"}},"error":{"type":"string"},"approval":{"type":"object","properties":{"status":{"type":"string"},"approvedBy":{"type":"string"}},"required":["status"]}},"required":["id","source","status"]}}}},"404":{"description":"Import job not found"}}}},"/workspaces/{organizationId}/import/{jobId}/resume":{"post":{"tags":["import"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"jobId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"credentials":{"nullable":true},"limit":{"type":"integer","minimum":1}}}}}},"responses":{"200":{"description":"Import batch resumed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"source":{"type":"string"},"jobId":{"type":"string"},"status":{"type":"string"},"counts":{"type":"object","additionalProperties":{"type":"number"}},"nextCursor":{"type":"string"}},"required":["ok","source","jobId","status"]}}}},"404":{"description":"Import job not found"},"409":{"description":"Import job is not resumable"}}}},"/workspaces/{organizationId}/import/{jobId}/approve":{"post":{"tags":["import"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"jobId","in":"path"}],"responses":{"200":{"description":"Import approved","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"jobId":{"type":"string"}},"required":["ok","jobId"]}}}},"404":{"description":"Import job not found"}}}},"/workspaces/{organizationId}/import/{jobId}/reject":{"post":{"tags":["import"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"jobId","in":"path"}],"responses":{"200":{"description":"Import rejected","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"jobId":{"type":"string"}},"required":["ok","jobId"]}}}},"404":{"description":"Import job not found"}}}},"/workspaces/{organizationId}/notion/users":{"post":{"tags":["notion"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"notionUserId":{"type":"string"}},"required":["userId","notionUserId"]}}}},"responses":{"201":{"description":"Notion user mapping created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string"},"notionUserId":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","userId","notionUserId","createdAt"]}}}}}},"get":{"tags":["notion"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Notion user mappings","content":{"application/json":{"schema":{"type":"object","properties":{"users":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"userId":{"type":"string"},"notionUserId":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","organizationId","userId","notionUserId","createdAt"]}}},"required":["users"]}}}}}}},"/notion/{organizationId}/{workspaceId}":{"post":{"tags":["notion"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"workspaceId","in":"path"}],"responses":{"200":{"description":"Webhook processed"},"400":{"description":"Bad request"},"401":{"description":"Invalid signature"},"404":{"description":"Notion installation not found"}}}},"/workspaces/{organizationId}/export":{"get":{"tags":["hardening"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Workspace export","content":{"application/json":{"schema":{"type":"object","properties":{"organizationId":{"type":"string"},"exportedAt":{"type":"string"}},"required":["organizationId","exportedAt"],"additionalProperties":{"nullable":true}}}}}}}},"/workspaces/{organizationId}/readiness":{"get":{"tags":["hardening"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Workspace readiness","content":{"application/json":{"schema":{"type":"object","properties":{"ready":{"type":"boolean"},"checks":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"ok":{"type":"boolean"},"required":{"type":"boolean"}},"required":["name","ok","required"]}}},"required":["ready","checks"]}}}}}}},"/workspaces/{organizationId}/slack":{"get":{"tags":["slack"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Slack installation status","content":{"application/json":{"schema":{"type":"object","properties":{"installed":{"type":"boolean"},"teamId":{"type":"string","nullable":true},"teamName":{"type":"string","nullable":true},"defaultChannelId":{"type":"string","nullable":true}},"required":["installed","teamId","teamName","defaultChannelId"]}}}}}},"delete":{"tags":["slack"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"204":{"description":"Slack installation removed"}}}},"/workspaces/{organizationId}/slack/install":{"post":{"tags":["slack"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"200":{"description":"Slack OAuth install URL","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}}}}}}},"/workspaces/{organizationId}/slack/channel":{"post":{"tags":["slack"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"channelId":{"type":"string","minLength":1}},"required":["channelId"]}}}},"responses":{"200":{"description":"Default channel updated","content":{"application/json":{"schema":{"type":"object","properties":{"installed":{"type":"boolean"},"teamId":{"type":"string","nullable":true},"teamName":{"type":"string","nullable":true},"defaultChannelId":{"type":"string","nullable":true}},"required":["installed","teamId","teamName","defaultChannelId"]}}}}}}},"/health":{"get":{"tags":["platform"],"responses":{"200":{"description":"Healthy or degraded","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string","enum":["healthy","degraded","unhealthy"]},"version":{"type":"string"},"checks":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"healthy":{"type":"boolean"},"message":{"type":"string"}},"required":["name","healthy"]}}},"required":["ok","status","version","checks"]}}}},"503":{"description":"Unhealthy","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string","enum":["healthy","degraded","unhealthy"]},"version":{"type":"string"},"checks":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"healthy":{"type":"boolean"},"message":{"type":"string"}},"required":["name","healthy"]}}},"required":["ok","status","version","checks"]}}}}}}},"/api/auth/sign-up/email":{"post":{"operationId":"signUpEmail","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/sign-in/email":{"post":{"operationId":"signInEmail","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/sign-out":{"post":{"operationId":"signOut","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/get-session":{"get":{"operationId":"getSession","tags":["Auth"],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/list-sessions":{"get":{"operationId":"listSessions","tags":["Auth"],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/revoke-session":{"post":{"operationId":"revokeSession","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/revoke-sessions":{"post":{"operationId":"revokeSessions","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/request-password-reset":{"post":{"operationId":"requestPasswordReset","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/reset-password":{"post":{"operationId":"resetPassword","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/reset-password/{token}":{"get":{"operationId":"requestPasswordResetCallback","tags":["Auth"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"token","in":"path"}],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/send-verification-email":{"post":{"operationId":"sendVerificationEmail","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/verify-email":{"get":{"operationId":"verifyEmail","tags":["Auth"],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/change-password":{"post":{"operationId":"changePassword","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/change-email":{"post":{"operationId":"changeEmail","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/update-user":{"post":{"operationId":"updateUser","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/delete-user":{"post":{"operationId":"deleteUser","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/verify-password":{"post":{"operationId":"verifyPassword","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/set-role":{"post":{"operationId":"setRole","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/get-user":{"get":{"operationId":"getUser","tags":["Auth"],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/create-user":{"post":{"operationId":"createUser","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/update-user":{"post":{"operationId":"adminUpdateUser","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/list-users":{"get":{"operationId":"listUsers","tags":["Auth"],"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/list-user-sessions":{"post":{"operationId":"listUserSessions","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/unban-user":{"post":{"operationId":"unbanUser","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/ban-user":{"post":{"operationId":"banUser","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/impersonate-user":{"post":{"operationId":"impersonateUser","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/stop-impersonating":{"post":{"operationId":"stopImpersonating","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/revoke-user-session":{"post":{"operationId":"revokeUserSession","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/revoke-user-sessions":{"post":{"operationId":"revokeUserSessions","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/remove-user":{"post":{"operationId":"removeUser","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/set-user-password":{"post":{"operationId":"setUserPassword","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/api/auth/admin/has-permission":{"post":{"operationId":"userHasPermission","tags":["Auth"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true},"description":"Better Auth request body"}}}},"responses":{"200":{"description":"Success","content":{"text/plain":{"schema":{"type":"string","description":"Better Auth raw response (JSON or HTML)"}}}}}}},"/github":{"post":{"tags":["github"],"responses":{"200":{"description":"Webhook processed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}}}}},"/gitlab":{"post":{"tags":["gitlab"],"responses":{"200":{"description":"Webhook processed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}}}}},"/intercom/{organizationId}":{"post":{"tags":["webhooks"],"summary":"Receive Intercom webhook notifications","parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"x-hub-signature","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"nullable":true}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]}}}}}}},"/workspaces/{organizationId}/ws":{"get":{"tags":["realtime"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"responses":{"101":{"description":"WebSocket upgraded"}}}},"/workspaces/{organizationId}/intake":{"post":{"tags":["customers"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"organizationId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"intakeId":{"type":"string","minLength":1},"businessName":{"type":"string","minLength":1},"address":{"type":"string"},"websiteUrl":{"type":"string","format":"uri"},"visitedAt":{"type":"string"},"spokeWith":{"type":"object","properties":{"name":{"type":"string"},"role":{"type":"string"},"isDecisionMaker":{"type":"boolean"}}},"owner":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string","format":"email"},"bestTime":{"type":"string"}}},"meeting":{"type":"object","properties":{"booked":{"type":"boolean"},"at":{"type":"string"},"returnAt":{"type":"string"},"bookingUrl":{"type":"string","format":"uri"}},"required":["booked"]},"discovery":{"type":"object","properties":{"businessType":{"type":"string"},"billingSystems":{"type":"array","items":{"type":"string"}},"paymentMethods":{"type":"array","items":{"type":"string"}},"hardware":{"type":"string"},"hardwareOwnership":{"type":"string"},"signage":{"type":"string"},"fitNotes":{"type":"string"}}},"pricing":{"type":"object","properties":{"currentProcessor":{"type":"string"},"posSystem":{"type":"string"},"underContract":{"type":"boolean"},"contractEnd":{"type":"string"},"earlyTerminationFee":{"type":"string"},"timeWithProvider":{"type":"string"},"monthlyCardVolume":{"type":"string"},"averageTicket":{"type":"string"},"transactionsPerDay":{"type":"string"},"cardMix":{"type":"string"},"channelMix":{"type":"string"},"seasonality":{"type":"string"},"monthlySalesTotals":{"type":"string"}}},"pain":{"type":"object","properties":{"biggestComplaint":{"type":"string"},"switchedBefore":{"type":"string"},"wishes":{"type":"string"}}},"pipelineStatusId":{"type":"string"},"nextStep":{"type":"string"},"nextStepDate":{"type":"string"},"repNotes":{"type":"string"},"statementFiles":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1},"url":{"type":"string","minLength":1},"name":{"type":"string"}},"required":["key","url"]}}},"required":["businessName"]}}}},"responses":{"200":{"description":"Intake already recorded (idempotent retry)","content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string"},"contactId":{"type":"string","nullable":true},"documentId":{"type":"string","nullable":true},"statusId":{"type":"string","nullable":true},"bookingLinkId":{"type":"string","nullable":true},"deduped":{"type":"boolean"}},"required":["customerId","contactId","documentId","statusId","bookingLinkId","deduped"]}}}},"201":{"description":"Intake recorded","content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string"},"contactId":{"type":"string","nullable":true},"documentId":{"type":"string","nullable":true},"statusId":{"type":"string","nullable":true},"bookingLinkId":{"type":"string","nullable":true},"deduped":{"type":"boolean"}},"required":["customerId","contactId","documentId","statusId","bookingLinkId","deduped"]}}}},"400":{"description":"Invalid request"}}}}}}