{"openapi":"3.1.0","info":{"title":"Weft API","version":"2026-11-10","description":"Every action in the Weft app is available here. The same operations are served as GraphQL at /api/graphql and as MCP tools at /api/mcp."},"servers":[{"url":"/api/v1"}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"An API key: `Authorization: Bearer weft_sk_…`"}},"schemas":{"Workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"logo":{"type":["string","null"],"description":"Image URL or data URL."},"region":{"type":"string"},"plan":{"type":"string"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","name","slug","logo","region","plan","createdAt"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["type","message"]}},"required":["error"]},"MemberPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Member"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]},"Member":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"image":{"type":["string","null"]},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"createdAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","userId","name","email","image","role","createdAt"]},"InvitationPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Invitation"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]},"Invitation":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"status":{"type":"string"},"inviterId":{"type":"string"},"expiresAt":{"type":"string","description":"ISO 8601 timestamp"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","email","role","status","inviterId","expiresAt","createdAt"]},"ApiKeyPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]},"ApiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"lastUsedAt":{"type":["string","null"],"description":"ISO 8601 timestamp"},"revokedAt":{"type":["string","null"],"description":"ISO 8601 timestamp"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","name","prefix","role","lastUsedAt","revokedAt","createdAt"]},"ApiKeyCreated":{"type":"object","properties":{"apiKey":{"$ref":"#/components/schemas/ApiKey"},"secret":{"type":"string"}},"required":["apiKey","secret"]},"Tenant":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"domain":{"type":["string","null"]},"externalId":{"type":["string","null"]},"tier":{"type":["string","null"],"description":"Free-text tier from an external system. Prefer tierId."},"tierId":{"type":["string","null"]},"version":{"type":"integer"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"},"updatedAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","name","domain","externalId","tier","tierId","version","createdAt","updatedAt"]},"TenantPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Tenant"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]},"TierPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Tier"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]},"Tier":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"color":{"$ref":"#/components/schemas/Color"},"defaultPriority":{"type":["integer","null"],"minimum":0,"maximum":3,"description":"Priority for new threads from this tier's tenants; null keeps the default."},"position":{"type":"integer"},"version":{"type":"integer"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"},"updatedAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","name","color","defaultPriority","position","version","createdAt","updatedAt"]},"Color":{"type":"string","enum":["gray","red","orange","yellow","green","teal","blue","violet","pink"]},"CustomerPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]},"Customer":{"type":"object","properties":{"id":{"type":"string"},"fullName":{"type":"string"},"email":{"type":["string","null"]},"avatarUrl":{"type":["string","null"]},"externalId":{"type":["string","null"]},"tenantId":{"type":["string","null"]},"isTest":{"type":"boolean","description":"A simulated customer created for a test thread."},"version":{"type":"integer"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"},"updatedAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","fullName","email","avatarUrl","externalId","tenantId","isTest","version","createdAt","updatedAt"]},"Thread":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"integer","description":"Human number within the workspace, shown as T-<number>."},"title":{"type":"string"},"status":{"$ref":"#/components/schemas/ThreadStatus"},"statusDetail":{"type":["string","null"],"enum":["needs_first_response","needs_next_response","in_progress","waiting_for_customer",null],"description":"Who owes the next move while the thread is in Todo; null otherwise."},"priority":{"type":"integer","minimum":0,"maximum":3,"description":"0 urgent, 1 high, 2 normal, 3 low."},"channel":{"$ref":"#/components/schemas/Channel"},"customerId":{"type":"string"},"tenantId":{"type":["string","null"]},"assigneeId":{"type":["string","null"]},"labelIds":{"type":"array","items":{"type":"string"}},"isTest":{"type":"boolean","description":"Test thread: a simulated customer answers replies."},"links":{"type":"array","items":{"$ref":"#/components/schemas/ThreadLink"}},"snoozedUntil":{"type":["string","null"],"description":"ISO 8601 timestamp"},"firstResponseAt":{"type":["string","null"],"description":"The team's first reply."},"lastInboundAt":{"type":["string","null"],"description":"The customer's latest message."},"lastOutboundAt":{"type":["string","null"],"description":"The team's latest reply."},"lastActivityAt":{"type":"string","description":"ISO 8601 timestamp"},"statusChangedAt":{"type":"string","description":"ISO 8601 timestamp"},"version":{"type":"integer"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"},"updatedAt":{"type":"string","description":"ISO 8601 timestamp"},"customer":{"type":"object","properties":{"id":{"type":"string"},"fullName":{"type":"string"},"email":{"type":["string","null"]},"avatarUrl":{"type":["string","null"]},"externalId":{"type":["string","null"]},"tenantId":{"type":["string","null"]},"isTest":{"type":"boolean","description":"A simulated customer created for a test thread."},"version":{"type":"integer"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"},"updatedAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","fullName","email","avatarUrl","externalId","tenantId","isTest","version","createdAt","updatedAt"],"description":"Present when expand includes customer."},"tenant":{"type":["object","null"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"domain":{"type":["string","null"]},"externalId":{"type":["string","null"]},"tier":{"type":["string","null"],"description":"Free-text tier from an external system. Prefer tierId."},"tierId":{"type":["string","null"]},"version":{"type":"integer"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"},"updatedAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","name","domain","externalId","tier","tierId","version","createdAt","updatedAt"],"description":"Present when expand includes tenant."}},"required":["id","number","title","status","statusDetail","priority","channel","customerId","tenantId","assigneeId","labelIds","isTest","links","snoozedUntil","firstResponseAt","lastInboundAt","lastOutboundAt","lastActivityAt","statusChangedAt","version","createdAt","updatedAt"]},"ThreadStatus":{"type":"string","enum":["todo","snoozed","done"]},"Channel":{"type":"string","enum":["slack","email","chat","api","teams","discord","feishu"]},"ThreadLink":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"title":{"type":["string","null"]}},"required":["id","url","title"]},"CustomerIdentity":{"type":"object","properties":{"email":{"type":"string","format":"email"},"externalId":{"type":"string","minLength":1,"maxLength":200},"fullName":{"type":"string","minLength":1,"maxLength":200},"avatarUrl":{"type":"string","format":"uri"},"tenantId":{"type":["string","null"]}}},"ThreadPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Thread"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]},"StatusDetail":{"type":"string","enum":["needs_first_response","needs_next_response","in_progress","waiting_for_customer"]},"LabelPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Label"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]},"Label":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"color":{"$ref":"#/components/schemas/Color"},"version":{"type":"integer"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"},"updatedAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","name","color","version","createdAt","updatedAt"]},"SavedViewPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SavedView"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]},"SavedView":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"filters":{"$ref":"#/components/schemas/ThreadFilters"},"position":{"type":"integer"},"createdBy":{"type":["string","null"]},"version":{"type":"integer"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"},"updatedAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","name","filters","position","createdBy","version","createdAt","updatedAt"]},"ThreadFilters":{"type":"object","properties":{"status":{"type":"array","items":{"$ref":"#/components/schemas/ThreadStatus"}},"statusDetail":{"type":"array","items":{"$ref":"#/components/schemas/StatusDetail"}},"assignee":{"type":"array","items":{"type":"string"},"description":"User ids, \"me\" or \"none\" (unassigned)."},"labelIds":{"type":"array","items":{"type":"string"}},"priority":{"type":"array","items":{"type":"integer","minimum":0,"maximum":3}},"tenantIds":{"type":"array","items":{"type":"string"}},"tierIds":{"type":"array","items":{"type":"string"}},"channel":{"type":"array","items":{"$ref":"#/components/schemas/Channel"}}}},"SnippetPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Snippet"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]},"Snippet":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"text":{"type":"string"},"createdBy":{"type":["string","null"]},"version":{"type":"integer"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"},"updatedAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","name","text","createdBy","version","createdAt","updatedAt"]},"Insights":{"type":"object","properties":{"from":{"type":"string","description":"Start of the first day (ISO 8601)."},"to":{"type":"string"},"timeZone":{"type":"string"},"days":{"type":"integer"},"totals":{"type":"object","properties":{"created":{"type":"integer","description":"Threads created in the range."},"done":{"type":"integer","description":"Times a thread was marked done in the range."},"open":{"type":"integer","description":"Threads in Todo now."},"needsResponse":{"type":"integer","description":"Todo threads waiting on the team now."},"waiting":{"type":"integer","description":"Todo threads waiting on the customer now."},"snoozed":{"type":"integer"}},"required":["created","done","open","needsResponse","waiting","snoozed"]},"medianFirstResponseSeconds":{"type":["number","null"],"description":"Threads created in the range that got a reply."},"medianResolutionSeconds":{"type":["number","null"],"description":"From creation to done, for threads marked done in the range."},"volume":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","description":"YYYY-MM-DD"},"created":{"type":"integer"},"done":{"type":"integer"}},"required":["date","created","done"]}},"byLabel":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"color":{"type":"string"},"count":{"type":"integer"}},"required":["id","name","color","count"]}},"byTier":{"type":"array","items":{"type":"object","properties":{"id":{"type":["string","null"]},"name":{"type":"string"},"color":{"type":"string"},"count":{"type":"integer"}},"required":["id","name","color","count"]}},"byPriority":{"type":"array","items":{"type":"object","properties":{"priority":{"type":"integer"},"count":{"type":"integer"}},"required":["priority","count"]}}},"required":["from","to","timeZone","days","totals","medianFirstResponseSeconds","medianResolutionSeconds","volume","byLabel","byTier","byPriority"]},"WebhookEndpointPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEndpoint"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]},"WebhookEndpoint":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string"},"description":{"type":["string","null"]},"eventTypes":{"type":"array","items":{"type":"string"},"description":"Subscribed event types, or [\"*\"] for all."},"enabled":{"type":"boolean"},"version":{"type":"integer"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"},"updatedAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","url","description","eventTypes","enabled","version","createdAt","updatedAt"]},"WebhookEndpointWithSecret":{"type":"object","properties":{"endpoint":{"$ref":"#/components/schemas/WebhookEndpoint"},"secret":{"type":"string","description":"Shown once. Use it to verify Weft-Signature."}},"required":["endpoint","secret"]},"SearchResult":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SearchHit"}}},"required":["data"]},"SearchHit":{"type":"object","properties":{"thread":{"$ref":"#/components/schemas/Thread"},"score":{"type":"number","description":"Relevance; higher is better."},"matchedIn":{"type":"array","items":{"type":"string","enum":["title","message"]}}},"required":["thread","score","matchedIn"]},"Deleted":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean"}},"required":["id","deleted"]},"EntryPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Entry"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]},"Entry":{"type":"object","properties":{"id":{"type":"string"},"threadId":{"type":"string"},"kind":{"$ref":"#/components/schemas/EntryKind"},"actorType":{"type":"string"},"actorId":{"type":["string","null"]},"body":{"type":"object","additionalProperties":{},"description":"Kind-specific fields; messages and notes carry `text`."},"createdAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","threadId","kind","actorType","actorId","body","createdAt"]},"EntryKind":{"type":"string","enum":["message_in","message_out","note","status","priority","assignment","labels","link"]},"WebhookDeliveryPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string"},"endpointId":{"type":"string"},"eventId":{"type":"string"},"eventType":{"type":"string"},"status":{"type":"string","enum":["pending","succeeded","failed"]},"attempts":{"type":"integer"},"responseStatus":{"type":["integer","null"]},"responseBody":{"type":["string","null"]},"durationMs":{"type":["integer","null"]},"nextAttemptAt":{"type":["string","null"],"description":"ISO 8601 timestamp"},"lastAttemptAt":{"type":["string","null"],"description":"ISO 8601 timestamp"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"}},"required":["id","endpointId","eventId","eventType","status","attempts","responseStatus","responseBody","durationMs","nextAttemptAt","lastAttemptAt","createdAt"]},"WebhookTestSent":{"type":"object","properties":{"eventId":{"type":"string"}},"required":["eventId"]}},"parameters":{}},"paths":{"/workspace":{"get":{"operationId":"workspace.get","tags":["Workspace"],"summary":"Get the current workspace","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"workspace.update","tags":["Workspace"],"summary":"Rename the workspace or change its logo","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"logo":{"type":["string","null"],"maxLength":200000,"description":"https URL or a base64 data URL (PNG, JPEG, WebP); null removes it."}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/members":{"get":{"operationId":"members.list","tags":["Workspace"],"summary":"List the workspace's members","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberPage"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invitations":{"get":{"operationId":"invitations.list","tags":["Workspace"],"summary":"List pending invitations","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvitationPage"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"members.invite","tags":["Workspace"],"summary":"Invite someone by email","description":"Sends an email with a link to join. Inviting the same address again replaces the earlier invitation. Invitations expire after 7 days.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":254,"format":"email"},"role":{"type":"string","enum":["owner","admin","member","viewer"],"default":"member"}},"required":["email"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invitation"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api-keys":{"get":{"operationId":"apiKeys.list","tags":["API keys"],"summary":"List API keys","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyPage"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"apiKeys.create","tags":["API keys"],"summary":"Create an API key","description":"The secret is returned once and never again; only its hash is stored.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreated"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tenants":{"post":{"operationId":"tenants.create","tags":["Tenants"],"summary":"Create a tenant","description":"For tenants you add by hand. Integrations that sync from your system should use tenants.upsert with an externalId.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"domain":{"type":["string","null"],"maxLength":253},"tierId":{"type":["string","null"]},"externalId":{"type":["string","null"],"minLength":1,"maxLength":200}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"tenants.list","tags":["Tenants"],"summary":"List tenants","security":[{"bearer":[]}],"parameters":[{"schema":{"anyOf":[{"type":"array","items":{"type":"string"},"maxItems":200},{"type":"string"}],"description":"Only these ids (up to 200)."},"required":false,"description":"Only these ids (up to 200).","name":"ids","in":"query"},{"schema":{"type":"string","maxLength":200,"description":"Matches name or domain (case-insensitive substring)."},"required":false,"description":"Matches name or domain (case-insensitive substring).","name":"query","in":"query"},{"schema":{"type":"string"},"required":false,"name":"tierId","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50,"description":"Page size, 1 to 200."},"required":false,"description":"Page size, 1 to 200.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Cursor from the previous page's nextCursor."},"required":false,"description":"Cursor from the previous page's nextCursor.","name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantPage"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tiers":{"get":{"operationId":"tiers.list","tags":["Tiers"],"summary":"List tiers","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TierPage"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"tiers.create","tags":["Tiers"],"summary":"Create a tier","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"color":{"$ref":"#/components/schemas/Color"},"defaultPriority":{"type":["integer","null"],"minimum":0,"maximum":3}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tier"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers":{"get":{"operationId":"customers.list","tags":["Customers"],"summary":"List customers","security":[{"bearer":[]}],"parameters":[{"schema":{"anyOf":[{"type":"array","items":{"type":"string"},"maxItems":200},{"type":"string"}],"description":"Only these ids (up to 200)."},"required":false,"description":"Only these ids (up to 200).","name":"ids","in":"query"},{"schema":{"type":"string","maxLength":200,"description":"Matches name or email (case-insensitive substring)."},"required":false,"description":"Matches name or email (case-insensitive substring).","name":"query","in":"query"},{"schema":{"type":"string"},"required":false,"name":"tenantId","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50,"description":"Page size, 1 to 200."},"required":false,"description":"Page size, 1 to 200.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Cursor from the previous page's nextCursor."},"required":false,"description":"Cursor from the previous page's nextCursor.","name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPage"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/threads":{"post":{"operationId":"threads.create","tags":["Threads"],"summary":"Create a thread","description":"Finds or creates the customer, then opens a thread, optionally with the customer's first message. Without a priority, the tenant's tier decides (or Normal).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":300},"customer":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]},{"$ref":"#/components/schemas/CustomerIdentity"}]},"message":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":100000}},"required":["text"]},"priority":{"type":"integer","minimum":0,"maximum":3,"description":"0 urgent … 3 low. Defaults to the tenant tier's priority, else 2."},"channel":{"$ref":"#/components/schemas/Channel"},"assigneeId":{"type":["string","null"]},"labelIds":{"type":"array","items":{"type":"string"},"maxItems":50}},"required":["title","customer"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Thread"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"threads.list","tags":["Threads"],"summary":"List threads","description":"Most recent activity first. Filters combine with AND; several values for one filter mean any of them.","security":[{"bearer":[]}],"parameters":[{"schema":{"anyOf":[{"$ref":"#/components/schemas/ThreadStatus"},{"type":"array","items":{"$ref":"#/components/schemas/ThreadStatus"}}]},"required":false,"name":"status","in":"query"},{"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/StatusDetail"}},{"type":"string"}]},"required":false,"name":"statusDetail","in":"query"},{"schema":{"type":"string"},"required":false,"name":"customerId","in":"query"},{"schema":{"type":"string","description":"Deprecated: use assignee."},"required":false,"description":"Deprecated: use assignee.","name":"assigneeId","in":"query"},{"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}],"description":"User ids, \"me\" (the caller) or \"none\" (unassigned)."},"required":false,"description":"User ids, \"me\" (the caller) or \"none\" (unassigned).","name":"assignee","in":"query"},{"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}],"description":"Threads with any of these labels."},"required":false,"description":"Threads with any of these labels.","name":"labelIds","in":"query"},{"schema":{"anyOf":[{"type":"array","items":{"type":["integer","null"],"minimum":0,"maximum":3}},{"type":"string"}]},"required":false,"name":"priority","in":"query"},{"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"required":false,"name":"tenantIds","in":"query"},{"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"required":false,"name":"tierIds","in":"query"},{"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/Channel"}},{"type":"string"}]},"required":false,"name":"channel","in":"query"},{"schema":{"anyOf":[{"type":"array","items":{"type":"string","enum":["customer","tenant"]}},{"type":"string"}],"description":"Related objects to include: customer, tenant."},"required":false,"description":"Related objects to include: customer, tenant.","name":"expand","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50,"description":"Page size, 1 to 200."},"required":false,"description":"Page size, 1 to 200.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Cursor from the previous page's nextCursor."},"required":false,"description":"Cursor from the previous page's nextCursor.","name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThreadPage"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/labels":{"get":{"operationId":"labels.list","tags":["Labels"],"summary":"List labels","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LabelPage"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"labels.create","tags":["Labels"],"summary":"Create a label","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"color":{"$ref":"#/components/schemas/Color"}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Label"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/views":{"get":{"operationId":"views.list","tags":["Saved views"],"summary":"List saved views","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedViewPage"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"views.create","tags":["Saved views"],"summary":"Save a view","description":"A named set of thread filters, shared with the workspace.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"filters":{"$ref":"#/components/schemas/ThreadFilters"}},"required":["name","filters"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedView"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/snippets":{"get":{"operationId":"snippets.list","tags":["Snippets"],"summary":"List snippets","description":"Snippet text may use {customer.firstName}, {customer.fullName}, {customer.email}, {agent.firstName} and {agent.fullName}; the app fills them in when inserting.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SnippetPage"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"snippets.create","tags":["Snippets"],"summary":"Create a snippet","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"text":{"type":"string","minLength":1,"maxLength":20000}},"required":["name","text"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Snippet"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/insights":{"get":{"operationId":"insights.get","tags":["Insights"],"summary":"Support metrics for a date range","description":"Volume per day (created and done), median first-response and resolution times, the current queue, and new threads by label, tier and priority.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"integer","default":30},"required":false,"name":"days","in":"query"},{"schema":{"type":"string","maxLength":64,"default":"UTC","description":"IANA time zone for day boundaries, e.g. Europe/Berlin."},"required":false,"description":"IANA time zone for day boundaries, e.g. Europe/Berlin.","name":"timeZone","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Insights"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks":{"get":{"operationId":"webhooks.list","tags":["Webhooks"],"summary":"List webhook endpoints","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointPage"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"webhooks.create","tags":["Webhooks"],"summary":"Add a webhook endpoint","description":"Returns the signing secret once. Each delivery is a POST with a JSON body { id, type, createdAt, workspaceId, data } and a Weft-Signature header.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"description":{"type":["string","null"],"maxLength":200},"eventTypes":{"type":"array","items":{"anyOf":[{"type":"string","enum":["thread.created","thread.updated","entry.created","customer.created","customer.updated","tenant.created","tenant.updated","label.created","label.updated","label.deleted"]},{"type":"string","enum":["*"]}]},"minItems":1,"maxItems":11,"description":"Event types to receive, or [\"*\"] for all."}},"required":["url","eventTypes"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointWithSecret"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tenants/upsert":{"post":{"operationId":"tenants.upsert","tags":["Tenants"],"summary":"Create or update a tenant","description":"Matched by externalId; creates the tenant when no match exists.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200},"name":{"type":"string","minLength":1,"maxLength":200},"domain":{"type":["string","null"],"maxLength":253},"tier":{"type":["string","null"],"maxLength":80,"description":"Free-text tier from your system. Prefer tierId."},"tierId":{"type":["string","null"]}},"required":["externalId","name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers/upsert":{"post":{"operationId":"customers.upsert","tags":["Customers"],"summary":"Create or update a customer","description":"Matched by email or externalId.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customer":{"$ref":"#/components/schemas/CustomerIdentity"}},"required":["customer"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/threads/test":{"post":{"operationId":"threads.createTest","tags":["Threads"],"summary":"Create a test thread","description":"Opens a thread from a simulated customer (marked isTest). When you reply, the customer answers about ten seconds later, so you can try the whole flow before connecting a channel.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"script":{"type":"integer","minimum":0,"maximum":4,"description":"Which sample conversation; random when omitted."}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Thread"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/threads/search":{"get":{"operationId":"threads.search","tags":["Threads"],"summary":"Search threads","description":"Full-text search over thread titles and every message and note, in English (with stemming) and Chinese/Japanese/Korean (exact phrases). Best match first.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"query","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":50,"default":20},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResult"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/members/{id}":{"patch":{"operationId":"members.updateRole","tags":["Workspace"],"summary":"Change a member's role","description":"Only owners can make someone an owner or change an owner's role. A workspace always keeps at least one owner.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","description":"Member id."},"required":true,"description":"Member id.","name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["owner","admin","member","viewer"]}},"required":["role"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Member"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"members.remove","tags":["Workspace"],"summary":"Remove a member","description":"Their open threads become unassigned. They lose access at once.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","description":"Member id."},"required":true,"description":"Member id.","name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invitations/{id}":{"delete":{"operationId":"invitations.cancel","tags":["Workspace"],"summary":"Cancel an invitation","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invitation"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api-keys/{id}":{"delete":{"operationId":"apiKeys.revoke","tags":["API keys"],"summary":"Revoke an API key","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKey"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tenants/{id}":{"patch":{"operationId":"tenants.update","tags":["Tenants"],"summary":"Update a tenant","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"domain":{"type":["string","null"],"maxLength":253},"tierId":{"type":["string","null"]},"expectedVersion":{"type":"integer"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"tenants.get","tags":["Tenants"],"summary":"Get a tenant","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tiers/{id}":{"patch":{"operationId":"tiers.update","tags":["Tiers"],"summary":"Update a tier","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"color":{"$ref":"#/components/schemas/Color"},"defaultPriority":{"type":["integer","null"],"minimum":0,"maximum":3},"position":{"type":"integer","minimum":0},"expectedVersion":{"type":"integer"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tier"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"tiers.delete","tags":["Tiers"],"summary":"Delete a tier","description":"Tenants on this tier keep working, with no tier.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers/{id}":{"patch":{"operationId":"customers.update","tags":["Customers"],"summary":"Update a customer","description":"Edit name, email or tenant. Moving a customer to another tenant moves their threads with them.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fullName":{"type":"string","minLength":1,"maxLength":200},"email":{"type":["string","null"],"format":"email"},"tenantId":{"type":["string","null"]},"expectedVersion":{"type":"integer"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"customers.get","tags":["Customers"],"summary":"Get a customer","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/threads/{id}":{"get":{"operationId":"threads.get","tags":["Threads"],"summary":"Get a thread","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"anyOf":[{"type":"array","items":{"type":"string","enum":["customer","tenant"]}},{"type":"string"}],"description":"Related objects to include: customer, tenant."},"required":false,"description":"Related objects to include: customer, tenant.","name":"expand","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Thread"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"threads.update","tags":["Threads"],"summary":"Update a thread","description":"Change title, status, priority, assignee or snooze. statusDetail (Todo only) marks a thread as waiting for the customer or in progress; without it the detail follows the conversation. Each change is also written to the timeline. Pass expectedVersion to fail with 409 instead of overwriting someone else's change.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":300},"status":{"$ref":"#/components/schemas/ThreadStatus"},"statusDetail":{"type":"string","enum":["needs_first_response","needs_next_response","in_progress","waiting_for_customer"],"description":"Only with status todo (or on a Todo thread)."},"priority":{"type":"integer","minimum":0,"maximum":3},"assigneeId":{"type":["string","null"]},"snoozedUntil":{"type":["string","null"],"format":"date-time"},"expectedVersion":{"type":"integer"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Thread"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/labels/{id}":{"patch":{"operationId":"labels.update","tags":["Labels"],"summary":"Rename or recolour a label","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"color":{"$ref":"#/components/schemas/Color"},"expectedVersion":{"type":"integer"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Label"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"labels.delete","tags":["Labels"],"summary":"Delete a label","description":"Also removes it from every thread that has it.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/views/{id}":{"patch":{"operationId":"views.update","tags":["Saved views"],"summary":"Update a saved view","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"filters":{"$ref":"#/components/schemas/ThreadFilters"},"position":{"type":"integer","minimum":0},"expectedVersion":{"type":"integer"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedView"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"views.delete","tags":["Saved views"],"summary":"Delete a saved view","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/snippets/{id}":{"patch":{"operationId":"snippets.update","tags":["Snippets"],"summary":"Update a snippet","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"text":{"type":"string","minLength":1,"maxLength":20000},"expectedVersion":{"type":"integer"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Snippet"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"snippets.delete","tags":["Snippets"],"summary":"Delete a snippet","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}":{"patch":{"operationId":"webhooks.update","tags":["Webhooks"],"summary":"Update a webhook endpoint","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"description":{"type":["string","null"],"maxLength":200},"eventTypes":{"type":"array","items":{"anyOf":[{"type":"string","enum":["thread.created","thread.updated","entry.created","customer.created","customer.updated","tenant.created","tenant.updated","label.created","label.updated","label.deleted"]},{"type":"string","enum":["*"]}]},"minItems":1,"maxItems":11,"description":"Event types to receive, or [\"*\"] for all."},"enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"webhooks.delete","tags":["Webhooks"],"summary":"Delete a webhook endpoint","description":"Its delivery log is deleted with it.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/threads/{id}/labels":{"post":{"operationId":"threads.addLabels","tags":["Threads"],"summary":"Add labels to a thread","description":"Labels already on the thread are ignored.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"labelIds":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":50}},"required":["labelIds"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Thread"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/threads/{id}/links":{"post":{"operationId":"threads.addLink","tags":["Threads"],"summary":"Attach a link to a thread","description":"A Linear or GitHub issue, a doc, anything with an https URL.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"title":{"type":["string","null"],"maxLength":200}},"required":["url"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Thread"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/threads/{threadId}/entries":{"get":{"operationId":"entries.list","tags":["Timeline"],"summary":"List a thread's timeline","description":"Oldest first.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"threadId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50,"description":"Page size, 1 to 200."},"required":false,"description":"Page size, 1 to 200.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Cursor from the previous page's nextCursor."},"required":false,"description":"Cursor from the previous page's nextCursor.","name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntryPage"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/threads/{threadId}/notes":{"post":{"operationId":"notes.create","tags":["Timeline"],"summary":"Add an internal note","description":"Visible to the team only; never sent to the customer.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"threadId","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":100000}},"required":["text"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Entry"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/threads/{threadId}/messages":{"post":{"operationId":"messages.send","tags":["Timeline"],"summary":"Reply to the customer","description":"Records the reply and queues it for delivery on the thread's channel. `then` decides what happens to the thread: none (stays where it is), wait (waiting for the customer until they answer) or done.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"threadId","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":100000},"then":{"type":"string","enum":["none","wait","done"],"default":"none"}},"required":["text"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Entry"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}/roll-secret":{"post":{"operationId":"webhooks.rollSecret","tags":["Webhooks"],"summary":"Replace an endpoint's signing secret","description":"The old secret stops working at once; the new one is returned once.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointWithSecret"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}/deliveries":{"get":{"operationId":"webhooks.deliveries","tags":["Webhooks"],"summary":"List an endpoint's deliveries","description":"Newest first, with each attempt's response.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","description":"Endpoint id."},"required":true,"description":"Endpoint id.","name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50,"description":"Page size, 1 to 200."},"required":false,"description":"Page size, 1 to 200.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Cursor from the previous page's nextCursor."},"required":false,"description":"Cursor from the previous page's nextCursor.","name":"cursor","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliveryPage"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhook-deliveries/{id}/retry":{"post":{"operationId":"webhooks.retryDelivery","tags":["Webhooks"],"summary":"Retry a delivery now","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string","description":"Delivery id."},"required":true,"description":"Delivery id.","name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/webhooks/{id}/test":{"post":{"operationId":"webhooks.test","tags":["Webhooks"],"summary":"Send a test event","description":"Delivers a webhook.test event to this endpoint only.","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookTestSent"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/threads/{id}/labels/remove":{"post":{"operationId":"threads.removeLabels","tags":["Threads"],"summary":"Remove labels from a thread","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"labelIds":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":50}},"required":["labelIds"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Thread"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/threads/{threadId}/messages/inbound":{"post":{"operationId":"messages.receive","tags":["Timeline"],"summary":"Record a customer message","description":"For custom channels: adds the customer's message and moves the thread back to Todo (needs first or next response).","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"threadId","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":100000}},"required":["text"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Entry"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/threads/{id}/links/{linkId}":{"delete":{"operationId":"threads.removeLink","tags":["Threads"],"summary":"Remove a link from a thread","security":[{"bearer":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"linkId","in":"path"},{"schema":{"type":"string","maxLength":255,"description":"Retries with the same key return the first result."},"required":false,"description":"Retries with the same key return the first result.","name":"idempotency-key","in":"header"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Thread"}}}},"default":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{}}