{"openapi":"3.1.0","info":{"title":"Samva API","version":"1.0.0","description":"Samva is a developer email API for product teams: deliverability, versioned templates, inbound threading, and signed webhooks behind one typed send call."},"paths":{"/v1/messages":{"get":{"tags":["Messages"],"operationId":"messages.list","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"channel","in":"query","schema":{"anyOf":[{"type":"string","enum":["email"]},{"type":"null"}]},"required":false},{"name":"status","in":"query","schema":{"anyOf":[{"type":"string","enum":["pending","scheduled","queued","processing","sent","delivered","read","failed","bounced","complained"]},{"type":"null"}]},"required":false},{"name":"conversationId","in":"query","schema":{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]},"required":false},{"name":"contactId","in":"query","schema":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"required":false},{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of messages across all channels, with optional filters for channel, status, conversation, contact, and date range.","summary":"List messages"},"post":{"tags":["Messages"],"operationId":"messages.send","parameters":[{"name":"idempotency-key","in":"header","schema":{"anyOf":[{"type":"string","pattern":"^[\\s\\S]{1,255}$","description":"Optional org-scoped key that makes a send idempotent. Repeating a request with the same key and identical payload replays the original 201 response; reusing the key with different content returns 409."},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorEncoded"}}}},"403":{"description":"ForbiddenError | FlagDisabledError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/FlagDisabledErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"429":{"description":"RateLimitedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitedErrorEncoded"}}}},"500":{"description":"InternalError | WebhookEnqueueError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/InternalErrorEncoded"},{"$ref":"#/components/schemas/WebhookEnqueueErrorEncoded"}]}}}},"502":{"description":"BillingProviderError | ExternalServiceError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/BillingProviderErrorEncoded"},{"$ref":"#/components/schemas/ExternalServiceErrorEncoded"}]}}}}},"description":"Sends a message on the requested channel and returns the created message with a 201 Created status. `channel` selects the payload variant. Repeating an identical request with the same optional `Idempotency-Key` header returns the original message; reusing the key for different content returns a conflict.","summary":"Send a message","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessagePayload"}}},"required":true}}},"/v1/messages/{id}":{"get":{"tags":["Messages"],"operationId":"messages.get","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/MessageId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a single message by its ID.","summary":"Get a message"},"delete":{"tags":["Messages"],"operationId":"messages.remove","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/MessageId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Permanently deletes a message by its ID.","summary":"Delete a message"}},"/v1/messages/{id}/email":{"get":{"tags":["Messages"],"operationId":"messages.getEmail","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/MessageId"},"required":true},{"name":"includeS3Urls","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"urlExpiresIn","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/MessageId"},"organizationId":{"type":"string"},"conversationId":{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]},"status":{"type":"string","enum":["pending","scheduled","queued","processing","sent","delivered","read","failed","bounced","complained"]},"channel":{"type":"string","enum":["email"]},"direction":{"type":"string","enum":["outbound","inbound"]},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"fromEmail":{"type":"string"},"fromName":{"anyOf":[{"type":"string"},{"type":"null"}]},"toEmails":{"type":"array","items":{"$ref":"#/components/schemas/EmailAddress"}},"ccEmails":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/EmailAddress"}},{"type":"null"}]},"bccEmails":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/EmailAddress"}},{"type":"null"}]},"replyToEmails":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"messageIdHeader":{"type":"string"},"inReplyTo":{"anyOf":[{"type":"string"},{"type":"null"}]},"references":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"threadPosition":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"newContent":{"anyOf":[{"type":"string"},{"type":"null"}]},"quotedContent":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasQuotedContent":{"type":"boolean"},"dkimVerdict":{"anyOf":[{"type":"string","enum":["pass","fail","softfail","neutral","none","policy","temperror","permerror"]},{"type":"null"}]},"spfVerdict":{"anyOf":[{"type":"string","enum":["pass","fail","softfail","neutral","none","policy","temperror","permerror"]},{"type":"null"}]},"dmarcVerdict":{"anyOf":[{"type":"string","enum":["pass","fail","softfail","neutral","none","policy","temperror","permerror"]},{"type":"null"}]},"isAutoReply":{"type":"boolean"},"autoReplyReason":{"anyOf":[{"type":"string","enum":["out-of-office","auto-response","delivery-status","read-receipt"]},{"type":"null"}]},"listUnsubscribeUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"listUnsubscribeEmail":{"anyOf":[{"type":"string"},{"type":"null"}]},"priority":{"anyOf":[{"type":"string","enum":["high","normal","low"]},{"type":"null"}]},"parsingErrors":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"parsingDuration":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"hasAttachments":{"type":"boolean"},"attachmentCount":{"type":"integer","minimum":0},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/AttachmentId"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer","minimum":0},"isInline":{"type":"boolean"},"contentId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","filename","contentType","size","isInline","contentId"],"additionalProperties":false}},"s3ContentUrls":{"anyOf":[{"type":"object","properties":{"rawMime":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"expiresAt":{"type":"string"}},"required":["rawMime","html","text","expiresAt"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"receivedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"processedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","organizationId","conversationId","status","channel","direction","subject","fromEmail","fromName","toEmails","ccEmails","bccEmails","replyToEmails","messageIdHeader","inReplyTo","references","threadPosition","newContent","quotedContent","hasQuotedContent","dkimVerdict","spfVerdict","dmarcVerdict","isAutoReply","autoReplyReason","listUnsubscribeUrl","listUnsubscribeEmail","priority","parsingErrors","parsingDuration","hasAttachments","attachmentCount","attachments","s3ContentUrls","createdAt","receivedAt","processedAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns email delivery details for a message, optionally including signed URLs for its raw MIME, HTML, and text content.","summary":"Get email message details"}},"/v1/messages/{id}/status":{"get":{"tags":["Messages"],"operationId":"messages.getStatus","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/MessageId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/MessageId"},"status":{"type":"string","enum":["pending","scheduled","queued","processing","sent","delivered","read","failed","bounced","complained"]},"updatedAt":{"type":"string"}},"required":["id","status","updatedAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the current delivery status of a message by its ID.","summary":"Get message delivery status"}},"/v1/messages/{id}/events":{"get":{"tags":["Messages"],"operationId":"messages.getEvents","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/MessageId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/MessageEventId"},"messageId":{"$ref":"#/components/schemas/MessageId"},"eventType":{"type":"string"},"status":{"type":"string"},"timestamp":{"type":"string"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}]}},"required":["id","messageId","eventType","status","timestamp"],"additionalProperties":false}}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the list of delivery events recorded for a message.","summary":"List message events"}},"/v1/messages/scheduled":{"post":{"tags":["Scheduled Messages"],"operationId":"scheduledMessages.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledMessage"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"FlagDisabledError | ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/FlagDisabledErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}]}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorEncoded"}}}}},"description":"Schedules a message at the absolute ISO-8601 instant in scheduledFor. Optional timezone is validated IANA display metadata only and never changes the execution instant.","summary":"Schedule a message","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"send":{"$ref":"#/components/schemas/DispatchSendMessagePayload"},"scheduledFor":{"$ref":"#/components/schemas/AbsoluteInstantEncoded"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}]},"idempotencyKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"referenceId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["send","scheduledFor"],"additionalProperties":false}}},"required":true}},"get":{"tags":["Scheduled Messages"],"operationId":"scheduledMessages.list","parameters":[{"name":"status","in":"query","schema":{"anyOf":[{"type":"string","enum":["pending","dispatching","dispatched","cancelled","failed"]},{"type":"null"}]},"required":false},{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ScheduledMessage"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of scheduled messages, optionally filtered by status.","summary":"List scheduled messages"}},"/v1/messages/scheduled/{id}":{"get":{"tags":["Scheduled Messages"],"operationId":"scheduledMessages.get","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ScheduledMessageId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"ScheduledMessage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledMessage"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a single scheduled message by its ID.","summary":"Get a scheduled message"}},"/v1/messages/scheduled/{id}/cancel":{"post":{"tags":["Scheduled Messages"],"operationId":"scheduledMessages.cancel","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ScheduledMessageId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"item":{"$ref":"#/components/schemas/ScheduledMessage"}},"required":["success","item"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Cancels a pending scheduled message so it will not be sent, and returns the updated scheduled message.","summary":"Cancel a scheduled message"}},"/v1/campaigns":{"post":{"tags":["Campaigns"],"operationId":"campaigns.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"FlagDisabledError | ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/FlagDisabledErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}]}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Creates an email campaign draft for the given audience and content, returning the created campaign.","summary":"Create a campaign","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"channel":{"type":"string","enum":["email"]},"content":{"$ref":"#/components/schemas/CampaignContentInput"},"audience":{"$ref":"#/components/schemas/CampaignAudience"},"policy":{"anyOf":[{"$ref":"#/components/schemas/CampaignPolicy"},{"type":"null"}]}},"required":["name","channel","content","audience"],"additionalProperties":false}}},"required":true}},"get":{"tags":["Campaigns"],"operationId":"campaigns.list","parameters":[{"name":"status","in":"query","schema":{"anyOf":[{"type":"string","enum":["draft","archived"]},{"type":"null"}]},"required":false},{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Campaign"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of the organization's campaigns, optionally filtered by status.","summary":"List campaigns"}},"/v1/campaigns/{id}":{"get":{"tags":["Campaigns"],"operationId":"campaigns.get","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/CampaignId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Campaign","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a single campaign, including its content, audience, and policy, by its identifier.","summary":"Get a campaign"},"patch":{"tags":["Campaigns"],"operationId":"campaigns.update","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/CampaignId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Campaign","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"FlagDisabledError | ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/FlagDisabledErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates the name, content, audience, or policy of a campaign draft.","summary":"Update a campaign","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"content":{"anyOf":[{"$ref":"#/components/schemas/CampaignContentInput"},{"type":"null"}]},"audience":{"anyOf":[{"$ref":"#/components/schemas/CampaignAudience"},{"type":"null"}]},"policy":{"anyOf":[{"$ref":"#/components/schemas/CampaignPolicy"},{"type":"null"}]}},"additionalProperties":false}}},"required":true}},"delete":{"tags":["Campaigns"],"operationId":"campaigns.archive","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/CampaignId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Campaign","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Archives a draft campaign so it can no longer be scheduled, returning the archived campaign.","summary":"Archive a campaign"}},"/v1/campaigns/{id}/runs":{"post":{"tags":["Campaigns"],"operationId":"campaigns.scheduleRun","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/CampaignId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignRun"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"FlagDisabledError | ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/FlagDisabledErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorEncoded"}}}}},"description":"Schedules an email campaign run at the absolute ISO-8601 instant in scheduledFor, or immediately when omitted. The optional idempotencyKey is scoped to the organization and replays return the original run.","summary":"Schedule a campaign run","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"scheduledFor":{"anyOf":[{"$ref":"#/components/schemas/AbsoluteInstantEncoded"},{"type":"null"}]},"idempotencyKey":{"anyOf":[{"type":"string","pattern":"^[\\s\\S]{1,255}$"},{"type":"null"}]}},"additionalProperties":false}}},"required":true}},"get":{"tags":["Campaigns"],"operationId":"campaigns.listRuns","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/CampaignId"},"required":true},{"name":"status","in":"query","schema":{"anyOf":[{"type":"string","enum":["scheduled","resolving","dispatching","paused","completed","cancelled","failed"]},{"type":"null"}]},"required":false},{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CampaignRun"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of runs for a campaign, optionally filtered by status.","summary":"List campaign runs"}},"/v1/campaigns/{id}/runs/{runId}":{"get":{"tags":["Campaigns"],"operationId":"campaigns.getRun","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/CampaignId"},"required":true},{"name":"runId","in":"path","schema":{"$ref":"#/components/schemas/CampaignRunId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"CampaignRun","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignRun"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a single run of a campaign by its identifier.","summary":"Get a campaign run"}},"/v1/campaigns/{id}/runs/{runId}/pause":{"post":{"tags":["Campaigns"],"operationId":"campaigns.pauseRun","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/CampaignId"},"required":true},{"name":"runId","in":"path","schema":{"$ref":"#/components/schemas/CampaignRunId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"CampaignRunAction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignRunAction"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorEncoded"}}}}},"description":"Pauses an in-progress campaign run and returns the updated run.","summary":"Pause a campaign run"}},"/v1/campaigns/{id}/runs/{runId}/resume":{"post":{"tags":["Campaigns"],"operationId":"campaigns.resumeRun","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/CampaignId"},"required":true},{"name":"runId","in":"path","schema":{"$ref":"#/components/schemas/CampaignRunId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"CampaignRunAction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignRunAction"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorEncoded"}}}}},"description":"Resumes a paused campaign run and returns the updated run.","summary":"Resume a campaign run"}},"/v1/campaigns/{id}/runs/{runId}/cancel":{"post":{"tags":["Campaigns"],"operationId":"campaigns.cancelRun","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/CampaignId"},"required":true},{"name":"runId","in":"path","schema":{"$ref":"#/components/schemas/CampaignRunId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"CampaignRunAction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignRunAction"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorEncoded"}}}}},"description":"Best-effort cancellation: pending recipients are skipped, while already claimed or provider-submitted deliveries may finish. Returns the updated run.","summary":"Cancel a campaign run"}},"/v1/campaigns/{id}/runs/{runId}/recipients":{"get":{"tags":["Campaigns"],"operationId":"campaigns.listRecipients","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/CampaignId"},"required":true},{"name":"runId","in":"path","schema":{"$ref":"#/components/schemas/CampaignRunId"},"required":true},{"name":"status","in":"query","schema":{"anyOf":[{"type":"string","enum":["pending","dispatching","dispatched","failed","skipped"]},{"type":"null"}]},"required":false},{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/CampaignRecipientId"},"runId":{"$ref":"#/components/schemas/CampaignRunId"},"contactId":{"$ref":"#/components/schemas/ContactId"},"status":{"type":"string","enum":["pending","dispatching","dispatched","failed","skipped"]},"messageId":{"anyOf":[{"type":"string"},{"type":"null"}]},"failureReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"skippedReason":{"anyOf":[{"type":"string","enum":["unsubscribed","blocked","suppressed","no_identity","inactive","run_cancelled","run_failed"]},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","runId","contactId","status","messageId","failureReason","skippedReason","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of recipients for a campaign run, optionally filtered by status.","summary":"List campaign recipients"}},"/v1/email/tracking/defaults":{"get":{"tags":["Email"],"operationId":"email.getTrackingDefaults","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"EmailTrackingDefaults","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailTrackingDefaults"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the organization's default open and click tracking policy. Each field is independent and defaults to enabled. Recipient opt-out takes precedence over these defaults.","summary":"Get email tracking defaults"},"patch":{"tags":["Email"],"operationId":"email.updateTrackingDefaults","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"EmailTrackingDefaults","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailTrackingDefaults"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates one or both organization email tracking defaults and returns the complete saved policy. Recipient opt-out still takes precedence.","summary":"Update email tracking defaults","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"}},"additionalProperties":false}}},"required":true}}},"/v1/email/tracking/recipients":{"get":{"tags":["Email"],"operationId":"email.getRecipientTrackingPreference","parameters":[{"name":"email","in":"query","schema":{"$ref":"#/components/schemas/TrackingRecipientEmail"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"EmailRecipientTrackingPreference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRecipientTrackingPreference"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the organization-scoped tracking opt-out for a normalized recipient email. A missing preference reads as opted in and is not created.","summary":"Get a recipient tracking preference"},"patch":{"tags":["Email"],"operationId":"email.updateRecipientTrackingPreference","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"EmailRecipientTrackingPreference","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRecipientTrackingPreference"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Opts a normalized recipient email in or out of open and click tracking. Opt-out takes precedence over per-send overrides and organization defaults without changing suppression or send eligibility.","summary":"Update a recipient tracking preference","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"$ref":"#/components/schemas/TrackingRecipientEmail"},"optedOut":{"type":"boolean"}},"required":["email","optedOut"],"additionalProperties":false}}},"required":true}}},"/v1/email/domains":{"post":{"tags":["Email"],"operationId":"email.addDomain","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDomain"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"EmailChannelError | BillingProviderError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/EmailChannelErrorEncoded"},{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}]}}}}},"description":"Registers a domain for sending and returns it with the DNS records required to verify ownership and configure DKIM. Responds with 201.","summary":"Add a sending domain","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string"}},"required":["domain"],"additionalProperties":false}}},"required":true}},"get":{"tags":["Email"],"operationId":"email.listDomains","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/EmailDomainId"},"domain":{"type":"string"},"phase":{"type":"string","enum":["dns-setup","provider-setup","provider-verification","ready","degraded","failed"]},"dkimSelector":{"anyOf":[{"type":"string"},{"type":"null"}]},"dkimPublicKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"type":"boolean"},"defaultSenderId":{"anyOf":[{"$ref":"#/components/schemas/EmailSenderId"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","domain","phase","isDefault","defaultSenderId","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of the organization's sending domains.","summary":"List sending domains"}},"/v1/email/domains/{id}/verification":{"get":{"tags":["Email"],"operationId":"email.getDomainVerification","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"EmailDomainVerification","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDomainVerification"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the stored DNS and provider lifecycle snapshot without calling a provider or mutating state.","summary":"Get domain verification"},"post":{"tags":["Email"],"operationId":"email.advanceDomainVerification","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"EmailDomainVerification","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDomainVerification"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"429":{"description":"RateLimitedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitedErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"EmailChannelError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelErrorEncoded"}}}}},"description":"Observes the required DNS records and, once they match, idempotently starts provider provisioning for the staged domain.","summary":"Advance domain verification"}},"/v1/email/domains/{id}":{"get":{"tags":["Email"],"operationId":"email.getDomainById","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"EmailDomain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDomain"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}}},"description":"Returns a single sending domain, including its DNS records and verification details.","summary":"Get a sending domain"},"delete":{"tags":["Email"],"operationId":"email.removeDomain","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"EmailChannelError | BillingProviderError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/EmailChannelErrorEncoded"},{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}]}}}}},"description":"Permanently deletes a sending domain from the organization.","summary":"Remove a sending domain"}},"/v1/email/domains/{id}/registrar":{"post":{"tags":["Email"],"operationId":"email.detectRegistrar","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string"},"name":{"type":"string"},"nameservers":{"type":"array","items":{"type":"string"}},"docsUrl":{"type":"string"}},"required":["provider","name","nameservers","docsUrl"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Looks up the domain's nameservers to detect its DNS registrar and returns the provider, nameservers, and a link to its setup docs.","summary":"Detect a domain's registrar","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string"}},"required":["domain"],"additionalProperties":false}}},"required":true}}},"/v1/email/domains/{id}/domain-connect":{"get":{"tags":["Email"],"operationId":"email.getDomainConnect","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true},{"name":"mode","in":"query","schema":{"type":"string","enum":["send-only","send-and-receive"]},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"DomainConnectEligibility","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainConnectEligibility"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Reports whether the domain's DNS provider supports Domain Connect one-click setup for Samva, and the provider's name when it does. Ineligible is a normal result — the manual DNS records remain the way to verify.","summary":"Check one-click DNS eligibility"}},"/v1/email/domains/{id}/domain-connect/apply-url":{"post":{"tags":["Email"],"operationId":"email.buildDomainConnectApplyUrl","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"DomainConnectApplyUrlResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainConnectApplyUrlResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"EmailChannelError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelErrorEncoded"}}}}},"description":"Builds the signed Domain Connect apply URL for the selected sending-only or sending-and-receiving service. Manual DNS remains available for either mode.","summary":"Build a one-click DNS apply URL","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["send-only","send-and-receive"]}},"required":["mode"],"additionalProperties":false}}},"required":true}}},"/v1/email/domains/{id}/domain-connect/complete":{"post":{"tags":["Email"],"operationId":"email.completeDomainConnect","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"DomainConnectCompleteResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainConnectCompleteResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"EmailChannelError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelErrorEncoded"}}}}},"description":"Consumes the Domain Connect provider's redirect. Validates the signed state and, when the records were applied, kicks verification. Returns applied, cancelled (the customer declined), or invalid (state failed validation).","summary":"Complete a one-click DNS return","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"state":{"type":"string"},"error":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["state"],"additionalProperties":false}}},"required":true}}},"/v1/email/domains/{id}/receiving":{"post":{"tags":["Email"],"operationId":"email.enableReceiving","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"ruleName":{"type":"string"},"recipients":{"type":"array","items":{"type":"string"}}},"required":["success","ruleName","recipients"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Enables inbound receiving for a verified domain by creating a receipt rule, and returns the rule name and its recipient addresses. Set `catchAll` to route every address on the domain; that requires a webhook endpoint, supplied as `endpointId` or already configured on the domain.","summary":"Enable inbound email for a domain","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string"},"catchAll":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"endpointId":{"anyOf":[{"$ref":"#/components/schemas/WebhookEndpointId"},{"type":"null"}]},"addresses":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]}},"required":["domain"],"additionalProperties":false}}},"required":true}}},"/v1/email/domains/{id}/default":{"post":{"tags":["Email"],"operationId":"email.setDefaultDomain","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Marks a verified domain as the organization's default sending domain, atomically clearing any previous default. Omitted-`from` sends resolve through the default domain's default sender.","summary":"Set the default sending domain"}},"/v1/email/domains/{id}/default-sender":{"put":{"tags":["Email"],"operationId":"email.setDomainDefaultSender","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Sets the default sender used for omitted-`from` sends from this domain. The sender must belong to the domain and be verified and active.","summary":"Set a domain's default sender","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"senderId":{"$ref":"#/components/schemas/EmailSenderId"}},"required":["senderId"],"additionalProperties":false}}},"required":true}},"delete":{"tags":["Email"],"operationId":"email.clearDomainDefaultSender","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Removes the domain's default sender so omitted-`from` sends fall through to the organization default sender.","summary":"Clear a domain's default sender"}},"/v1/email/domains/{id}/config":{"patch":{"tags":["Email"],"operationId":"email.updateDomainConfig","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/EmailDomainId"},"openTracking":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"clickTracking":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"replyTo":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"unsubscribeGroupId":{"anyOf":[{"$ref":"#/components/schemas/UnsubscribeId"},{"type":"null"}]},"footerEnabled":{"anyOf":[{"type":"boolean"},{"type":"null"}]}},"required":["id","openTracking","clickTracking","replyTo","unsubscribeGroupId","footerEnabled"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Overrides the domain's open/click tracking, reply-to, and unsubscribe-group defaults for the settings cascade. An omitted field is left unchanged; null clears it back to the organization default. Returns the saved config.","summary":"Update a domain's send-settings config","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"openTracking":{"anyOf":[{"anyOf":[{"type":"boolean"},{"type":"null"}]},{"type":"null"}]},"clickTracking":{"anyOf":[{"anyOf":[{"type":"boolean"},{"type":"null"}]},{"type":"null"}]},"replyTo":{"anyOf":[{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},{"type":"null"}]},"unsubscribeGroupId":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/UnsubscribeId"},{"type":"null"}]},{"type":"null"}]},"footerEnabled":{"anyOf":[{"anyOf":[{"type":"boolean"},{"type":"null"}]},{"type":"null"}]}},"additionalProperties":false}}},"required":true}}},"/v1/email/domains/{id}/custom-tracking":{"post":{"tags":["Email"],"operationId":"email.enableCustomTracking","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"CustomTrackingStatus","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomTrackingStatus"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}]}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"EmailChannelError | BillingProviderError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/EmailChannelErrorEncoded"},{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}]}}}}},"description":"Provisions a custom tracking domain (default label `track`) for a verified sending domain so open/click links redirect through the customer's own subdomain. Requires the custom_tracking_domain entitlement. Returns the resulting state including the two DNS records the customer must create.","summary":"Enable a custom tracking domain","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}}},"required":true}},"get":{"tags":["Email"],"operationId":"email.getCustomTracking","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"CustomTrackingStatus","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomTrackingStatus"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the custom tracking state for a sending domain: lifecycle status, the required DNS records, certificate and CAA readiness, and any scheduled teardown. `enabled` is false when no custom tracking domain is provisioned.","summary":"Get custom tracking status"},"delete":{"tags":["Email"],"operationId":"email.disableCustomTracking","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}]}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"EmailChannelError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelErrorEncoded"}}}}},"description":"Tears down a domain's custom tracking and its managed resources. Sends immediately revert to the shared tracking host. Existing custom links in already-delivered mail stop working.","summary":"Disable a custom tracking domain"}},"/v1/email/domains/{id}/custom-tracking/domain-connect":{"get":{"tags":["Email"],"operationId":"email.getCustomTrackingDomainConnect","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"DomainConnectEligibility","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainConnectEligibility"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Reports whether the domain's DNS provider supports Domain Connect for its current Custom Tracking Domain. Ineligible is a normal result and the exact manual CNAME records remain available.","summary":"Check automatic Custom Tracking Domain setup eligibility"}},"/v1/email/domains/{id}/custom-tracking/domain-connect/apply-url":{"post":{"tags":["Email"],"operationId":"email.buildCustomTrackingDomainConnectApplyUrl","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"DomainConnectApplyUrlResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainConnectApplyUrlResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"EmailChannelError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelErrorEncoded"}}}}},"description":"Builds the signed Domain Connect URL for the current customer-selected tracking host. The server derives the host and Cloudflare DCV UUID; exact manual CNAME records remain available.","summary":"Build an automatic Custom Tracking Domain apply URL"}},"/v1/email/domains/{id}/custom-tracking/domain-connect/complete":{"post":{"tags":["Email"],"operationId":"email.completeCustomTrackingDomainConnect","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"CustomTrackingDomainConnectCompleteResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomTrackingDomainConnectCompleteResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Validates the purpose- and revision-bound registrar state, then re-kicks the existing readiness reconciliation. The callback never declares the host ready or changes email tracking selection.","summary":"Complete an automatic Custom Tracking Domain return","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"state":{"type":"string"},"error":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["state"],"additionalProperties":false}}},"required":true}}},"/v1/email/senders":{"post":{"tags":["Email"],"operationId":"email.addSender","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/EmailSenderId"},"email":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed"]},"createdAt":{"type":"string"}},"required":["id","email","status","createdAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorEncoded"}}}}},"description":"Creates a sender identity for an email address and returns it. Responds with 201.","summary":"Add a sender identity","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"domainId":{"anyOf":[{"$ref":"#/components/schemas/EmailDomainId"},{"type":"null"}]},"name":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"replyToEmails":{"anyOf":[{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},{"type":"null"}]}},"required":["email"],"additionalProperties":false}}},"required":true}},"get":{"tags":["Email"],"operationId":"email.listSenders","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"verificationStatus","in":"query","schema":{"anyOf":[{"type":"string","enum":["pending","verified","failed"]},{"type":"null"}]},"required":false},{"name":"isActive","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"isDefault","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/EmailSenderId"},"organizationId":{"type":"string"},"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"domainId":{"anyOf":[{"$ref":"#/components/schemas/EmailDomainId"},{"type":"null"}]},"verificationStatus":{"type":"string","enum":["pending","verified","failed"]},"verifiedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"verificationToken":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"type":"boolean"},"replyToEmails":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"deliverability":{"$ref":"#/components/schemas/DeliverabilityFacts"},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","email","name","domainId","verificationStatus","verifiedAt","verificationToken","isDefault","replyToEmails","deliverability","isActive","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of sender identities, optionally filtered by verification status, active state, or default flag.","summary":"List sender identities"}},"/v1/email/senders/{id}/verification":{"get":{"tags":["Email"],"operationId":"email.checkSenderVerification","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailSenderId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/EmailSenderId"},"email":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed"]},"verifiedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","email","status","verifiedAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorEncoded"}}}}},"description":"Returns the current verification status of a sender identity.","summary":"Check sender verification status"}},"/v1/email/senders/{id}":{"delete":{"tags":["Email"],"operationId":"email.removeSender","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailSenderId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Permanently deletes a sender identity from the organization.","summary":"Remove a sender identity"}},"/v1/email/senders/{id}/default":{"post":{"tags":["Email"],"operationId":"email.setDefaultSender","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailSenderId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Marks a verified, active sender as the organization default, atomically clearing any previous default. Used for omitted-`from` sends when no default domain sender applies.","summary":"Set the organization default sender"}},"/v1/email/stats":{"get":{"tags":["Email"],"operationId":"email.getStats","parameters":[{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"totalSent":{"type":"integer","minimum":0},"totalDelivered":{"type":"integer","minimum":0},"totalBounced":{"type":"integer","minimum":0},"totalComplained":{"type":"integer","minimum":0},"deliveryRate":{"type":"number"},"bounceRate":{"type":"number"},"complaintRate":{"type":"number"}},"required":["totalSent","totalDelivered","totalBounced","totalComplained","deliveryRate","bounceRate","complaintRate"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns aggregate email statistics — sent, delivered, bounced, and complained counts with their rates — optionally scoped to a date range.","summary":"Get email statistics"}},"/v1/email/catch-all/enable":{"post":{"tags":["Email"],"operationId":"email.enableCatchAll","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"receiptRuleName":{"type":"string"}},"required":["success","receiptRuleName"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorEncoded"}}}}},"description":"Enables catch-all inbound receiving for a domain by creating a receipt rule, and returns the rule name. `endpointId` is one of the organization's webhook endpoints; every address on the domain delivers `message.received` to it. Responds with 201.","summary":"Enable catch-all receiving","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"domainId":{"$ref":"#/components/schemas/EmailDomainId"},"endpointId":{"$ref":"#/components/schemas/WebhookEndpointId"}},"required":["domainId","endpointId"],"additionalProperties":false}}},"required":true}}},"/v1/email/catch-all/disable":{"post":{"tags":["Email"],"operationId":"email.disableCatchAll","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorEncoded"}}}}},"description":"Disables catch-all inbound receiving for a domain.","summary":"Disable catch-all receiving","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"domainId":{"$ref":"#/components/schemas/EmailDomainId"}},"required":["domainId"],"additionalProperties":false}}},"required":true}}},"/v1/email/catch-all/config":{"patch":{"tags":["Email"],"operationId":"email.updateCatchAllConfig","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates a domain's catch-all receiving configuration: the webhook endpoint that receives its inbound mail.","summary":"Update catch-all configuration","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"domainId":{"$ref":"#/components/schemas/EmailDomainId"},"endpointId":{"anyOf":[{"$ref":"#/components/schemas/WebhookEndpointId"},{"type":"null"}]}},"required":["domainId"],"additionalProperties":false}}},"required":true}},"get":{"tags":["Email"],"operationId":"email.getCatchAllConfig","parameters":[{"name":"domainId","in":"query","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"endpointId":{"anyOf":[{"$ref":"#/components/schemas/WebhookEndpointId"},{"type":"null"}]},"receiptRuleName":{"anyOf":[{"type":"string"},{"type":"null"}]},"emailCount":{"type":"integer","minimum":0},"lastEmailAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["enabled","endpointId","receiptRuleName","emailCount","lastEmailAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the catch-all receiving configuration for a domain, including the webhook endpoint that receives its inbound mail and its email counts.","summary":"Get catch-all configuration"}},"/v1/email/catch-all/stats":{"get":{"tags":["Email"],"operationId":"email.getCatchAllStats","parameters":[{"name":"domainId","in":"query","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true},{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string"},"isCatchAllEnabled":{"type":"boolean"},"catchAllEmailCount":{"type":"integer","minimum":0},"catchAllLastEmailAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"timeRange":{"anyOf":[{"type":"object","properties":{"emailsReceived":{"type":"integer","minimum":0},"firstEmail":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastEmail":{"anyOf":[{"type":"string"},{"type":"null"}]},"avgPerDay":{"type":"number"}},"required":["emailsReceived","firstEmail","lastEmail","avgPerDay"],"additionalProperties":false},{"type":"null"}]}},"required":["domain","isCatchAllEnabled","catchAllEmailCount","catchAllLastEmailAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns catch-all receiving counters for a domain, adding an aggregated breakdown when a date range is supplied.","summary":"Get catch-all statistics"}},"/v1/email/suppressions":{"get":{"tags":["Email"],"operationId":"email.listSuppressions","parameters":[{"name":"type","in":"query","schema":{"anyOf":[{"type":"string","enum":["bounce","complaint","unsubscribe","manual"]},{"type":"null"}]},"required":false},{"name":"status","in":"query","schema":{"anyOf":[{"type":"string","enum":["active","expired"]},{"type":"null"}]},"required":false},{"name":"search","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"offset","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"suppressions":{"type":"array","items":{"$ref":"#/components/schemas/SuppressionEntry"}},"total":{"type":"integer","minimum":0}},"required":["suppressions","total"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the addresses this workspace will not send to, newest first, optionally filtered by suppression type, active or expired state, and an address substring, with limit and offset paging.","summary":"List suppressed addresses"}},"/v1/email/suppressions/{id}":{"delete":{"tags":["Email"],"operationId":"email.removeSuppression","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/SuppressionId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"EmailChannelError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelErrorEncoded"}}}}},"description":"Deletes a suppression so this workspace can send to the address again. When the engine mirrored the address into the sending provider's suppression list, that entry is lifted first, and the deletion fails rather than reporting success if the provider refuses, so the operation stays retryable. The provider entry is left in place when another workspace still reports the same address as bouncing or complaining, because that list is shared with every workspace; the response does not say which case applied. Deliverability caveat: a bounce or complaint suppression records a real delivery failure, and sending to the address again risks the reputation damage the suppression prevented.","summary":"Remove a suppressed address"}},"/v1/email/blocks":{"post":{"tags":["Email"],"operationId":"email.addBlock","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/BlockedEmailId"},"blockType":{"type":"string","enum":["email","domain"]},"blockValue":{"type":"string"},"reason":{"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"isActive":{"type":"boolean"},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","blockType","blockValue","reason","notes","isActive","expiresAt","createdAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}}},"description":"Blocks an email address or domain from inbound receiving and returns the created block entry. Responds with 201.","summary":"Add a block entry","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"blockType":{"type":"string","enum":["email","domain"]},"blockValue":{"type":"string"},"reason":{"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["blockType","blockValue","reason"],"additionalProperties":false}}},"required":true}},"get":{"tags":["Email"],"operationId":"email.listBlocks","parameters":[{"name":"blockType","in":"query","schema":{"anyOf":[{"type":"string","enum":["email","domain"]},{"type":"null"}]},"required":false},{"name":"isActive","in":"query","schema":{"anyOf":[{"type":"string","contentMediaType":"application/json"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"offset","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/BlockedEmailId"},"blockType":{"type":"string","enum":["email","domain"]},"blockValue":{"type":"string"},"reason":{"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"isActive":{"type":"boolean"},"blockCount":{"type":"integer","minimum":0},"lastBlockedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","blockType","blockValue","reason","notes","isActive","blockCount","lastBlockedAt","expiresAt","createdAt"],"additionalProperties":false}},"total":{"type":"integer","minimum":0}},"required":["blocks","total"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns block entries, optionally filtered by block type and active state, with limit and offset paging.","summary":"List block entries"}},"/v1/email/blocks/{id}":{"delete":{"tags":["Email"],"operationId":"email.removeBlock","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/BlockedEmailId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Permanently deletes a block entry, unblocking the associated address or domain.","summary":"Remove a block entry"},"patch":{"tags":["Email"],"operationId":"email.updateBlock","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/BlockedEmailId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/BlockedEmailId"},"blockType":{"type":"string","enum":["email","domain"]},"blockValue":{"type":"string"},"reason":{"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"isActive":{"type":"boolean"},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"type":"string"}},"required":["id","blockType","blockValue","reason","notes","isActive","expiresAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates a block entry's reason, notes, active state, or expiry.","summary":"Update a block entry","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"isActive":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"expiresAt":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]}},"additionalProperties":false}}},"required":true}}},"/v1/email/blocks/logs":{"get":{"tags":["Email"],"operationId":"email.getBlockLogs","parameters":[{"name":"blockedEmailId","in":"query","schema":{"anyOf":[{"$ref":"#/components/schemas/BlockedEmailId"},{"type":"null"}]},"required":false},{"name":"fromAddress","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"offset","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"logs":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/BlockedEmailLogId"},"fromAddress":{"type":"string"},"toAddress":{"type":"string"},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"blockType":{"type":"string","enum":["email","domain"]},"blockValue":{"type":"string"},"blockReason":{"type":"string"},"spfResult":{"anyOf":[{"type":"string"},{"type":"null"}]},"dkimResult":{"anyOf":[{"type":"string"},{"type":"null"}]},"dmarcResult":{"anyOf":[{"type":"string"},{"type":"null"}]},"spamScore":{"anyOf":[{"type":"number"},{"type":"null"}]},"blockedAt":{"type":"string"}},"required":["id","fromAddress","toAddress","subject","blockType","blockValue","blockReason","spfResult","dkimResult","dmarcResult","spamScore","blockedAt"],"additionalProperties":false}},"total":{"type":"number"}},"required":["logs","total"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a log of inbound emails that were blocked, optionally filtered by block entry, sender, or date range.","summary":"List blocked email logs"}},"/v1/email/blocks/check":{"post":{"tags":["Email"],"operationId":"email.checkBlocked","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"isBlocked":{"type":"boolean"},"blockingRule":{"anyOf":[{"type":"object","properties":{"id":{"$ref":"#/components/schemas/BlockedEmailId"},"blockType":{"type":"string","enum":["email","domain"]},"blockValue":{"type":"string"},"reason":{"type":"string"},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","blockType","blockValue","reason","expiresAt"],"additionalProperties":false},{"type":"null"}]},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["isBlocked","blockingRule","reason"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Checks whether an email address is currently blocked and returns the matching block rule when one applies.","summary":"Check whether an address is blocked","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"emailAddress":{"type":"string"}},"required":["emailAddress"],"additionalProperties":false}}},"required":true}}},"/v1/email/forwarding":{"post":{"tags":["Email"],"operationId":"email.createForwardingRule","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/EmailForwardingRuleId"},"name":{"type":"string"},"forwardTo":{"type":"array","items":{"type":"string"}},"priority":{"type":"integer","minimum":0},"isActive":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","name","forwardTo","priority","isActive","createdAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Creates an inbound email forwarding rule and returns it. Responds with 201.","summary":"Create a forwarding rule","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"domainId":{"anyOf":[{"$ref":"#/components/schemas/EmailDomainId"},{"type":"null"}]},"sourcePattern":{"anyOf":[{"type":"string"},{"type":"null"}]},"forwardTo":{"type":"array","items":{"type":"string"}},"preserveHeaders":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"appendNote":{"anyOf":[{"type":"string"},{"type":"null"}]},"conditions":{"anyOf":[{"$ref":"#/components/schemas/ForwardingConditions"},{"type":"null"}]},"priority":{"anyOf":[{"type":"number"},{"type":"null"}]},"isActive":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"metadata":{"anyOf":[{"anyOf":[{"type":"object"},{"type":"null"}]},{"type":"null"}]}},"required":["name","forwardTo"],"additionalProperties":false}}},"required":true}},"get":{"tags":["Email"],"operationId":"email.listForwardingRules","parameters":[{"name":"domainId","in":"query","schema":{"anyOf":[{"$ref":"#/components/schemas/EmailDomainId"},{"type":"null"}]},"required":false},{"name":"isActive","in":"query","schema":{"anyOf":[{"type":"string","contentMediaType":"application/json"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"offset","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"rules":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/EmailForwardingRuleId"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"sourcePattern":{"anyOf":[{"type":"string"},{"type":"null"}]},"forwardTo":{"type":"array","items":{"type":"string"}},"preserveHeaders":{"type":"boolean"},"priority":{"type":"integer","minimum":0},"isActive":{"type":"boolean"},"forwardCount":{"type":"integer","minimum":0},"failureCount":{"type":"integer","minimum":0},"lastForwardedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","name","description","sourcePattern","forwardTo","preserveHeaders","priority","isActive","forwardCount","failureCount","lastForwardedAt","createdAt"],"additionalProperties":false}},"total":{"type":"number"}},"required":["rules","total"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns inbound email forwarding rules, optionally filtered by domain and active state, with limit and offset paging.","summary":"List forwarding rules"}},"/v1/email/forwarding/{id}":{"patch":{"tags":["Email"],"operationId":"email.updateForwardingRule","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailForwardingRuleId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/EmailForwardingRuleId"},"name":{"type":"string"},"forwardTo":{"type":"array","items":{"type":"string"}},"priority":{"type":"integer","minimum":0},"isActive":{"type":"boolean"},"updatedAt":{"type":"string"}},"required":["id","name","forwardTo","priority","isActive","updatedAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates an inbound email forwarding rule and returns its current summary.","summary":"Update a forwarding rule","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"domainId":{"anyOf":[{"$ref":"#/components/schemas/EmailDomainId"},{"type":"null"}]},"sourcePattern":{"anyOf":[{"type":"string"},{"type":"null"}]},"forwardTo":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"preserveHeaders":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"appendNote":{"anyOf":[{"type":"string"},{"type":"null"}]},"conditions":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ForwardingConditions"},{"type":"null"}]},{"type":"null"}]},"priority":{"anyOf":[{"type":"number"},{"type":"null"}]},"isActive":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"metadata":{"anyOf":[{"anyOf":[{"type":"object"},{"type":"null"}]},{"type":"null"}]}},"additionalProperties":false}}},"required":true}},"delete":{"tags":["Email"],"operationId":"email.deleteForwardingRule","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailForwardingRuleId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Permanently deletes an inbound email forwarding rule.","summary":"Delete a forwarding rule"}},"/v1/email/forwarding/logs":{"get":{"tags":["Email"],"operationId":"email.getForwardingLog","parameters":[{"name":"forwardingRuleId","in":"query","schema":{"anyOf":[{"$ref":"#/components/schemas/EmailForwardingRuleId"},{"type":"null"}]},"required":false},{"name":"status","in":"query","schema":{"anyOf":[{"type":"string","enum":["pending","forwarded","failed"]},{"type":"null"}]},"required":false},{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"offset","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"logs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"forwardingRuleId":{"anyOf":[{"$ref":"#/components/schemas/EmailForwardingRuleId"},{"type":"null"}]},"originalFromAddress":{"type":"string"},"originalToAddress":{"type":"string"},"originalSubject":{"anyOf":[{"type":"string"},{"type":"null"}]},"forwardedTo":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["pending","forwarded","failed"]},"errorMessage":{"anyOf":[{"type":"string"},{"type":"null"}]},"forwardedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","forwardingRuleId","originalFromAddress","originalToAddress","originalSubject","forwardedTo","status","errorMessage","forwardedAt","createdAt"],"additionalProperties":false}},"total":{"type":"integer","minimum":0},"hasMore":{"type":"boolean"},"stats":{"anyOf":[{"type":"object","properties":{"totalForwarded":{"type":"integer","minimum":0},"successRate":{"type":"number"},"failureRate":{"type":"number"}},"required":["totalForwarded","successRate","failureRate"],"additionalProperties":false},{"type":"null"}]}},"required":["logs","total","hasMore"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a log of forwarded inbound emails with their delivery outcomes, optionally filtered by rule, status, or date range.","summary":"List email forwarding logs"}},"/v1/conversations":{"get":{"tags":["Conversations"],"operationId":"conversations.list","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"status","in":"query","schema":{"anyOf":[{"type":"string","enum":["active","waiting","resolved","escalated","archived"]},{"type":"null"}]},"required":false},{"name":"channel","in":"query","schema":{"anyOf":[{"type":"string","enum":["email"]},{"type":"null"}]},"required":false},{"name":"contactId","in":"query","schema":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"required":false},{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of conversations for the organization, filterable by status, channel, contact, and date range.","summary":"List conversations"},"post":{"tags":["Conversations"],"operationId":"conversations.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Conversation"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Creates a new conversation with its initial contacts and returns it with a 201 status.","summary":"Create a conversation","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentConversationId":{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]},"channels":{"type":"array","items":{"type":"string","enum":["email"]}},"primaryChannel":{"type":"string","enum":["email"]},"status":{"anyOf":[{"type":"string","enum":["active","waiting","resolved","escalated","archived"]},{"type":"null"}]},"statusReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"priority":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"urgency":{"anyOf":[{"type":"string","enum":["low","medium","high","critical"]},{"type":"null"}]},"complexity":{"anyOf":[{"type":"string","enum":["simple","moderate","complex"]},{"type":"null"}]},"metadata":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ConversationMetadata"},{"type":"null"}]},{"type":"null"}]},"actorTracking":{"anyOf":[{"$ref":"#/components/schemas/ActorTracking"},{"type":"null"}]},"metrics":{"anyOf":[{"$ref":"#/components/schemas/ConversationMetrics"},{"type":"null"}]},"context":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ConversationContext"},{"type":"null"}]},{"type":"null"}]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"categories":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"isTest":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"isInternal":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"isPrivate":{"anyOf":[{"type":"boolean"},{"type":"null"}]}},"required":["channels","primaryChannel"],"additionalProperties":false}}},"required":true}}},"/v1/conversations/{id}":{"get":{"tags":["Conversations"],"operationId":"conversations.getById","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ConversationId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"ConversationDetail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationDetail"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a single conversation by its ID.","summary":"Get a conversation"},"patch":{"tags":["Conversations"],"operationId":"conversations.update","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ConversationId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Conversation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Conversation"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates an existing conversation's fields and returns the updated conversation.","summary":"Update a conversation","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"externalId":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"parentConversationId":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]},{"type":"null"}]},"primaryChannel":{"anyOf":[{"type":"string","enum":["email"]},{"type":"null"}]},"status":{"anyOf":[{"type":"string","enum":["active","waiting","resolved","escalated","archived"]},{"type":"null"}]},"statusReason":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"priority":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]},"urgency":{"anyOf":[{"type":"string","enum":["low","medium","high","critical"]},{"type":"null"}]},"complexity":{"anyOf":[{"type":"string","enum":["simple","moderate","complex"]},{"type":"null"}]},"context":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ConversationContext"},{"type":"null"}]},{"type":"null"}]},"metadata":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ConversationMetadata"},{"type":"null"}]},{"type":"null"}]},"metrics":{"anyOf":[{"$ref":"#/components/schemas/ConversationMetrics"},{"type":"null"}]},"actorTracking":{"anyOf":[{"$ref":"#/components/schemas/ActorTracking"},{"type":"null"}]},"channels":{"anyOf":[{"type":"array","items":{"type":"string","enum":["email"]}},{"type":"null"}]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"categories":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"isTest":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"isInternal":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"isPrivate":{"anyOf":[{"type":"boolean"},{"type":"null"}]}},"additionalProperties":false}}},"required":true}}},"/v1/conversations/{id}/messages":{"get":{"tags":["Conversations"],"operationId":"conversations.listMessages","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ConversationId"},"required":true},{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the messages in a conversation using the canonical message schema and page-based pagination.","summary":"List conversation messages"}},"/v1/conversations/{id}/contacts":{"post":{"tags":["Conversations"],"operationId":"conversations.addContacts","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ConversationId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Conversation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Conversation"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Attaches one or more contacts to a conversation and returns the updated conversation.","summary":"Add contacts to a conversation","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationContacts"}}},"required":true}},"delete":{"tags":["Conversations"],"operationId":"conversations.removeContacts","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ConversationId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Conversation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Conversation"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Detaches one or more contacts from a conversation and returns the updated conversation.","summary":"Remove contacts from a conversation","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationContacts"}}},"required":true}}},"/v1/contacts":{"get":{"tags":["Contacts"],"operationId":"contacts.list","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"search","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"type","in":"query","schema":{"anyOf":[{"type":"string","enum":["human","system"]},{"type":"null"}]},"required":false},{"name":"status","in":"query","schema":{"anyOf":[{"type":"string","enum":["active","paused","blocked","archived"]},{"type":"null"}]},"required":false},{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ContactListItem"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of contacts for the organization, filterable by search term, type, status, and date range.","summary":"List contacts"},"post":{"tags":["Contacts"],"operationId":"contacts.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Creates a new contact and returns it with a 201 status.","summary":"Create a contact","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["human","system"]},"name":{"type":"string"},"displayName":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"avatar":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"identities":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ContactIdentity"}},{"type":"null"}]},"humanProfile":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/HumanProfile"},{"type":"null"}]},{"type":"null"}]},"capabilities":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"accessLevel":{"anyOf":[{"type":"string","enum":["public","authenticated","vip","internal"]},{"type":"null"}]},"accessConfig":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ContactAccessConfig"},{"type":"null"}]},{"type":"null"}]},"preferences":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ContactPreferences"},{"type":"null"}]},{"type":"null"}]},"status":{"anyOf":[{"type":"string","enum":["active","paused","blocked","archived"]},{"type":"null"}]},"statusReason":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"externalId":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"metadata":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/JsonObject"},{"type":"null"}]},{"type":"null"}]},"createdBy":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},{"type":"null"}]},"lastModifiedBy":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},{"type":"null"}]}},"required":["type","name"],"additionalProperties":false}}},"required":true}}},"/v1/contacts/find":{"post":{"tags":["Contacts"],"operationId":"contacts.find","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Contact"},{"type":"null"}]}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Samva API operation.","summary":"Find a contact","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}}},"required":true}}},"/v1/contacts/find-or-create":{"post":{"tags":["Contacts"],"operationId":"contacts.findOrCreate","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Returns an existing contact matching the given identifiers, or creates a new one when none exists.","summary":"Find or create a contact","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayName":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]}},"additionalProperties":false}}},"required":true}}},"/v1/contacts/{id}":{"get":{"tags":["Contacts"],"operationId":"contacts.get","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ContactId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a single contact by its ID.","summary":"Get a contact"},"patch":{"tags":["Contacts"],"operationId":"contacts.update","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ContactId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Contact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Updates an existing contact's fields and returns the updated contact.","summary":"Update a contact","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"anyOf":[{"type":"string","enum":["human","system"]},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayName":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"avatar":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"identities":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ContactIdentity"}},{"type":"null"}]},"humanProfile":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/HumanProfile"},{"type":"null"}]},{"type":"null"}]},"capabilities":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"accessLevel":{"anyOf":[{"type":"string","enum":["public","authenticated","vip","internal"]},{"type":"null"}]},"accessConfig":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ContactAccessConfig"},{"type":"null"}]},{"type":"null"}]},"preferences":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ContactPreferences"},{"type":"null"}]},{"type":"null"}]},"status":{"anyOf":[{"type":"string","enum":["active","paused","blocked","archived"]},{"type":"null"}]},"statusReason":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"externalId":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"metadata":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/JsonObject"},{"type":"null"}]},{"type":"null"}]},"createdBy":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},{"type":"null"}]},"lastModifiedBy":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},{"type":"null"}]}},"additionalProperties":false}}},"required":true}},"delete":{"tags":["Contacts"],"operationId":"contacts.remove","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ContactId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Permanently deletes a contact by its ID.","summary":"Delete a contact"}},"/v1/contacts/{id}/engagement":{"get":{"tags":["Contacts"],"operationId":"contacts.getEngagement","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ContactId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"totalMessages":{"type":"integer","minimum":0},"messagesSent":{"type":"integer","minimum":0},"messagesReceived":{"type":"integer","minimum":0},"activeConversations":{"type":"integer","minimum":0},"lastActivityAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"channelsUsed":{"type":"object","additionalProperties":{"type":"integer","minimum":0}}},"required":["totalMessages","messagesSent","messagesReceived","activeConversations","lastActivityAt","channelsUsed"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns aggregated engagement metrics for a contact, including message counts and active conversation totals.","summary":"Get contact engagement metrics"}},"/v1/contacts/bulk-import":{"post":{"tags":["Contacts"],"operationId":"contacts.bulkImport","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"created":{"type":"integer","minimum":0},"updated":{"type":"integer","minimum":0},"skipped":{"type":"integer","minimum":0},"errors":{"type":"integer","minimum":0},"results":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","minimum":0},"status":{"type":"string","enum":["created","updated","skipped","error"]},"contactId":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["index","status"],"additionalProperties":false}}},"required":["total","created","updated","skipped","errors","results"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Creates or updates contacts in bulk from a list, returning per-entry results with created, updated, skipped, and error counts.","summary":"Bulk import contacts","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"contacts":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"firstName":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastName":{"anyOf":[{"type":"string"},{"type":"null"}]},"company":{"anyOf":[{"type":"string"},{"type":"null"}]},"jobTitle":{"anyOf":[{"type":"string"},{"type":"null"}]},"customFields":{"anyOf":[{"$ref":"#/components/schemas/UnknownRecord"},{"type":"null"}]}},"required":["name"],"additionalProperties":false}},"upsertByEmail":{"anyOf":[{"type":"boolean"},{"type":"null"}]}},"required":["contacts"],"additionalProperties":false}}},"required":true}}},"/v1/contacts/bulk-delete":{"post":{"tags":["Contacts"],"operationId":"contacts.bulkDelete","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0}},"required":["deleted","failed"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Permanently deletes multiple contacts by ID, returning counts of deleted and failed records.","summary":"Bulk delete contacts","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","prefixItems":[{"$ref":"#/components/schemas/ContactId"}],"minItems":1,"items":{"$ref":"#/components/schemas/ContactId"}}},"required":["ids"],"additionalProperties":false}}},"required":true}}},"/v1/contacts/bulk-update-tags":{"post":{"tags":["Contacts"],"operationId":"contacts.bulkUpdateTags","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"BulkUpdateResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Adds, removes, or replaces tags on multiple contacts in one request, returning counts of updated and failed records.","summary":"Bulk update contact tags","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","prefixItems":[{"$ref":"#/components/schemas/ContactId"}],"minItems":1,"items":{"$ref":"#/components/schemas/ContactId"}},"operation":{"type":"string","enum":["add","remove","set"]},"tags":{"type":"array","prefixItems":[{"type":"string"}],"minItems":1,"items":{"type":"string"}}},"required":["ids","operation","tags"],"additionalProperties":false}}},"required":true}}},"/v1/contacts/bulk-update-status":{"post":{"tags":["Contacts"],"operationId":"contacts.bulkUpdateStatus","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"BulkUpdateResult","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkUpdateResult"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Sets the status on multiple contacts in one request, returning counts of updated and failed records.","summary":"Bulk update contact status","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","prefixItems":[{"$ref":"#/components/schemas/ContactId"}],"minItems":1,"items":{"$ref":"#/components/schemas/ContactId"}},"status":{"type":"string","enum":["active","paused","blocked","archived"]}},"required":["ids","status"],"additionalProperties":false}}},"required":true}}},"/v1/contacts/export":{"post":{"tags":["Contacts"],"operationId":"contacts.export","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"string"},"format":{"type":"string","enum":["json","csv"]},"count":{"type":"integer","minimum":0}},"required":["data","format","count"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Exports contacts as JSON or CSV, returning the serialized data and a count of exported records.","summary":"Export contacts","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ContactId"}},{"type":"null"}]},"format":{"anyOf":[{"type":"string","enum":["json","csv"]},{"type":"null"}]},"filters":{"anyOf":[{"type":"object","properties":{"type":{"anyOf":[{"type":"string","enum":["human","system"]},{"type":"null"}]},"status":{"anyOf":[{"type":"string","enum":["active","paused","blocked","archived"]},{"type":"null"}]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]},"fields":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]}},"additionalProperties":false}}},"required":true}}},"/v1/contacts/{id}/activity":{"get":{"tags":["Contacts"],"operationId":"contacts.getActivityTimeline","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ContactId"},"required":true},{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"channel","in":"query","schema":{"anyOf":[{"type":"string","enum":["email"]},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/MessageId"},"channel":{"type":"string"},"direction":{"type":"string"},"status":{"type":"string"},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"snippet":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"conversationId":{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]}},"required":["id","channel","direction","status","subject","snippet","createdAt","conversationId"],"additionalProperties":false}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated timeline of a contact's message activity, optionally filtered by channel.","summary":"Get contact activity timeline"}},"/v1/contacts/{id}/groups":{"get":{"tags":["Contacts"],"operationId":"contacts.getGroupMemberships","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ContactId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"groups":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/ContactGroupId"},"name":{"type":"string"},"type":{"type":"string"},"role":{"type":"string"},"joinedAt":{"type":"string"}},"required":["id","name","type","role","joinedAt"],"additionalProperties":false}}},"required":["groups"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the contact groups that a contact currently belongs to.","summary":"List a contact's group memberships"}},"/v1/contact-groups":{"get":{"tags":["Contact Groups"],"operationId":"contactGroups.list","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"type","in":"query","schema":{"anyOf":[{"type":"string","enum":["static","dynamic","smart"]},{"type":"null"}]},"required":false},{"name":"isActive","in":"query","schema":{"anyOf":[{"type":"string","contentMediaType":"application/json"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/ContactGroupId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":{"type":"string","enum":["static","dynamic","smart"]},"criteria":{"anyOf":[{"type":"object"},{"type":"null"}]},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentGroupId":{"anyOf":[{"$ref":"#/components/schemas/ContactGroupId"},{"type":"null"}]},"contactCount":{"type":"integer","minimum":0},"lastCalculatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","type","criteria","color","icon","parentGroupId","contactCount","lastCalculatedAt","isActive","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of contact groups for the organization, filterable by type and active state.","summary":"List contact groups"},"post":{"tags":["Contact Groups"],"operationId":"contactGroups.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/ContactGroupId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":{"type":"string","enum":["static","dynamic","smart"]},"criteria":{"anyOf":[{"type":"object"},{"type":"null"}]},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentGroupId":{"anyOf":[{"$ref":"#/components/schemas/ContactGroupId"},{"type":"null"}]},"contactCount":{"type":"integer","minimum":0},"lastCalculatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","type","criteria","color","icon","parentGroupId","contactCount","lastCalculatedAt","isActive","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Creates a new contact group and returns it with a 201 status.","summary":"Create a contact group","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"type":{"anyOf":[{"type":"string","enum":["static","dynamic","smart"]},{"type":"null"}]},"criteria":{"anyOf":[{"anyOf":[{"type":"object"},{"type":"null"}]},{"type":"null"}]},"color":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"icon":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"parentGroupId":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ContactGroupId"},{"type":"null"}]},{"type":"null"}]},"isActive":{"anyOf":[{"type":"boolean"},{"type":"null"}]}},"required":["name"],"additionalProperties":false}}},"required":true}}},"/v1/contact-groups/{id}":{"get":{"tags":["Contact Groups"],"operationId":"contactGroups.getById","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ContactGroupId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/ContactGroupId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":{"type":"string","enum":["static","dynamic","smart"]},"criteria":{"anyOf":[{"type":"object"},{"type":"null"}]},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentGroupId":{"anyOf":[{"$ref":"#/components/schemas/ContactGroupId"},{"type":"null"}]},"contactCount":{"type":"integer","minimum":0},"lastCalculatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","type","criteria","color","icon","parentGroupId","contactCount","lastCalculatedAt","isActive","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a single contact group by its ID.","summary":"Get a contact group"},"patch":{"tags":["Contact Groups"],"operationId":"contactGroups.update","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ContactGroupId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/ContactGroupId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":{"type":"string","enum":["static","dynamic","smart"]},"criteria":{"anyOf":[{"type":"object"},{"type":"null"}]},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentGroupId":{"anyOf":[{"$ref":"#/components/schemas/ContactGroupId"},{"type":"null"}]},"contactCount":{"type":"integer","minimum":0},"lastCalculatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","type","criteria","color","icon","parentGroupId","contactCount","lastCalculatedAt","isActive","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates an existing contact group's fields and returns the updated group.","summary":"Update a contact group","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"type":{"anyOf":[{"type":"string","enum":["static","dynamic","smart"]},{"type":"null"}]},"criteria":{"anyOf":[{"anyOf":[{"type":"object"},{"type":"null"}]},{"type":"null"}]},"color":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"icon":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"parentGroupId":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ContactGroupId"},{"type":"null"}]},{"type":"null"}]},"isActive":{"anyOf":[{"type":"boolean"},{"type":"null"}]}},"additionalProperties":false}}},"required":true}},"delete":{"tags":["Contact Groups"],"operationId":"contactGroups.remove","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ContactGroupId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Permanently deletes a contact group by its ID.","summary":"Delete a contact group"}},"/v1/contact-groups/{groupId}/members":{"post":{"tags":["Contact Groups"],"operationId":"contactGroups.addMembers","parameters":[{"name":"groupId","in":"path","schema":{"$ref":"#/components/schemas/ContactGroupId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"added":{"type":"integer","minimum":0},"skipped":{"type":"integer","minimum":0}},"required":["added","skipped"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Adds one or more contacts to a contact group, returning counts of added and skipped members.","summary":"Add members to a contact group","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"contactIds":{"type":"array","prefixItems":[{"$ref":"#/components/schemas/ContactId"}],"minItems":1,"items":{"$ref":"#/components/schemas/ContactId"}},"role":{"anyOf":[{"type":"string","enum":["member","moderator","admin"]},{"type":"null"}]}},"required":["contactIds"],"additionalProperties":false}}},"required":true}},"delete":{"tags":["Contact Groups"],"operationId":"contactGroups.removeMembers","parameters":[{"name":"groupId","in":"path","schema":{"$ref":"#/components/schemas/ContactGroupId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"removed":{"type":"integer","minimum":0}},"required":["removed"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Removes one or more contacts from a contact group, returning the count of removed members.","summary":"Remove members from a contact group","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"contactIds":{"type":"array","prefixItems":[{"$ref":"#/components/schemas/ContactId"}],"minItems":1,"items":{"$ref":"#/components/schemas/ContactId"}}},"required":["contactIds"],"additionalProperties":false}}},"required":true}},"get":{"tags":["Contact Groups"],"operationId":"contactGroups.getMembers","parameters":[{"name":"groupId","in":"path","schema":{"$ref":"#/components/schemas/ContactGroupId"},"required":true},{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"groupId":{"$ref":"#/components/schemas/ContactGroupId"},"contactId":{"$ref":"#/components/schemas/ContactId"},"role":{"type":"string","enum":["member","moderator","admin"]},"joinedAt":{"type":"string"},"joinedBy":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"contact":{"anyOf":[{"type":"object","properties":{"id":{"$ref":"#/components/schemas/ContactId"},"name":{"type":"string"},"displayName":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":{"type":"string"},"identities":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ContactIdentity"}},{"type":"null"}]}},"required":["id","name","displayName","type"],"additionalProperties":false},{"type":"null"}]}},"required":["id","organizationId","groupId","contactId","role","joinedAt","joinedBy","expiresAt","contact"],"additionalProperties":false}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of contacts belonging to a contact group.","summary":"List members of a contact group"}},"/v1/contact-groups/{groupId}/evaluate":{"post":{"tags":["Contact Groups"],"operationId":"contactGroups.evaluateDynamic","parameters":[{"name":"groupId","in":"path","schema":{"$ref":"#/components/schemas/ContactGroupId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"added":{"type":"integer","minimum":0},"removed":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0}},"required":["added","removed","total"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Recomputes a dynamic contact group's membership from its criteria, returning counts of added, removed, and total members.","summary":"Evaluate a dynamic contact group"}},"/v1/contact-groups/preview":{"post":{"tags":["Contact Groups"],"operationId":"contactGroups.preview","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","minimum":0},"sample":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/ContactId"},"name":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"}},"required":["id","name","type","status"],"additionalProperties":false}}},"required":["count","sample"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Evaluates group criteria without persisting, returning the matching contact count and a sample of matches.","summary":"Preview contact group criteria","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"criteria":{"type":"object","properties":{"contactTypes":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"capabilities":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"channels":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"match":{"anyOf":[{"type":"string","enum":["all","any"]},{"type":"null"}]},"conditions":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"operator":{"type":"string"},"value":{}},"required":["field","operator","value"],"additionalProperties":false}},{"type":"null"}]}},"additionalProperties":false}},"required":["criteria"],"additionalProperties":false}}},"required":true}}},"/v1/custom-fields":{"get":{"tags":["Custom Fields"],"operationId":"customFields.list","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/CustomFieldDefinitionId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","number","boolean","date","select"]},"options":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"defaultValue":{"anyOf":[{"type":"string"},{"type":"null"}]},"isRequired":{"type":"boolean"},"sortOrder":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","label","type","options","defaultValue","isRequired","sortOrder","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of custom field definitions for the organization.","summary":"List custom fields"},"post":{"tags":["Custom Fields"],"operationId":"customFields.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/CustomFieldDefinitionId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","number","boolean","date","select"]},"options":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"defaultValue":{"anyOf":[{"type":"string"},{"type":"null"}]},"isRequired":{"type":"boolean"},"sortOrder":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","label","type","options","defaultValue","isRequired","sortOrder","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Creates a new custom field definition and returns it with a 201 status; the field key must be unique.","summary":"Create a custom field","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","number","boolean","date","select"]},"options":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"defaultValue":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"isRequired":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"sortOrder":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]}},"required":["key","label","type"],"additionalProperties":false}}},"required":true}}},"/v1/custom-fields/{id}":{"patch":{"tags":["Custom Fields"],"operationId":"customFields.update","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/CustomFieldDefinitionId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/CustomFieldDefinitionId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["text","number","boolean","date","select"]},"options":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"defaultValue":{"anyOf":[{"type":"string"},{"type":"null"}]},"isRequired":{"type":"boolean"},"sortOrder":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","label","type","options","defaultValue","isRequired","sortOrder","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates an existing custom field definition and returns the updated field.","summary":"Update a custom field","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"options":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"defaultValue":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"isRequired":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"sortOrder":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}]}},"additionalProperties":false}}},"required":true}},"delete":{"tags":["Custom Fields"],"operationId":"customFields.remove","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/CustomFieldDefinitionId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Permanently deletes a custom field definition by its ID.","summary":"Delete a custom field"}},"/v1/templates":{"get":{"tags":["Templates"],"operationId":"templates.list","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"category","in":"query","schema":{"anyOf":[{"type":"string","enum":["transactional","marketing","support","notification","verification","reminder","alert"]},{"type":"null"}]},"required":false},{"name":"channel","in":"query","schema":{"anyOf":[{"type":"string","enum":["email"]},{"type":"null"}]},"required":false},{"name":"status","in":"query","schema":{"anyOf":[{"type":"string","enum":["draft","pending","approved","published","rejected","archived"]},{"type":"null"}]},"required":false},{"name":"search","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"sortBy","in":"query","schema":{"anyOf":[{"type":"string","enum":["name","createdAt","updatedAt","usageCount","lastUsedAt"]},{"type":"null"}]},"required":false},{"name":"sortOrder","in":"query","schema":{"anyOf":[{"type":"string","enum":["asc","desc"]},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Template"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of the organization's templates, filterable by category, channel, status, and search, with configurable sorting.","summary":"List templates"},"post":{"tags":["Templates"],"operationId":"templates.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Creates a template from SML source; the source's root tag determines the template's channel. Returns the created template with status 201.","summary":"Create a template","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTemplatePayload"}}},"required":true}}},"/v1/templates/dashboard":{"get":{"tags":["Templates"],"operationId":"templates.listDashboard","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"allowedChannels","in":"query","schema":{"anyOf":[{"type":"string","enum":["email"]},{"type":"array","items":{"type":"string","enum":["email"]}}]},"required":true},{"name":"category","in":"query","schema":{"anyOf":[{"type":"string","enum":["transactional","marketing","support","notification","verification","reminder","alert"]},{"type":"null"}]},"required":false},{"name":"channel","in":"query","schema":{"anyOf":[{"type":"string","enum":["email"]},{"type":"null"}]},"required":false},{"name":"status","in":"query","schema":{"anyOf":[{"type":"string","enum":["draft","pending","approved","published","rejected","archived"]},{"type":"null"}]},"required":false},{"name":"search","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"sortBy","in":"query","schema":{"anyOf":[{"type":"string","enum":["name","createdAt","updatedAt","usageCount","lastUsedAt"]},{"type":"null"}]},"required":false},{"name":"sortOrder","in":"query","schema":{"anyOf":[{"type":"string","enum":["asc","desc"]},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["family"]},"id":{"$ref":"#/components/schemas/TemplateFamilyId"},"name":{"type":"string"},"members":{"type":"array","items":{"$ref":"#/components/schemas/TemplateSummary"}},"usageCount":{"type":"integer","minimum":0},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["kind","id","name","members","usageCount","lastUsedAt","createdAt","updatedAt"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["template"]},"template":{"$ref":"#/components/schemas/TemplateSummary"}},"required":["kind","template"],"additionalProperties":false}]}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated dashboard view that groups related channel templates into families and leaves standalone templates ungrouped.","summary":"List templates for the dashboard"}},"/v1/templates/families":{"get":{"tags":["Templates"],"operationId":"templates.listFamilies","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/TemplateFamily"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of the organization's template families and members.","summary":"List template families"},"post":{"tags":["Templates"],"operationId":"templates.createFamily","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateFamily"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Creates an empty template family with the supplied name and returns it with status 201.","summary":"Create a template family","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateFamilyName"}}},"required":true}}},"/v1/templates/families/{familyId}":{"get":{"tags":["Templates"],"operationId":"templates.getFamily","parameters":[{"name":"familyId","in":"path","schema":{"$ref":"#/components/schemas/TemplateFamilyId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"TemplateFamily","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateFamily"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a template family and its channel-specific member templates.","summary":"Get a template family"},"patch":{"tags":["Templates"],"operationId":"templates.renameFamily","parameters":[{"name":"familyId","in":"path","schema":{"$ref":"#/components/schemas/TemplateFamilyId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"TemplateFamily","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateFamily"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Changes a template family's name and returns the updated family.","summary":"Rename a template family","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateFamilyName"}}},"required":true}},"delete":{"tags":["Templates"],"operationId":"templates.deleteFamily","parameters":[{"name":"familyId","in":"path","schema":{"$ref":"#/components/schemas/TemplateFamilyId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Deletes a template family without deleting its member templates.","summary":"Delete a template family"}},"/v1/templates/families/from-template/{templateId}":{"post":{"tags":["Templates"],"operationId":"templates.createFamilyFromTemplate","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateFamily"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Creates a template family containing the specified template and returns the new family with status 201.","summary":"Create a family from a template","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateFamilyName"}}},"required":true}}},"/v1/templates/families/{familyId}/members/{templateId}":{"post":{"tags":["Templates"],"operationId":"templates.attachFamilyMember","parameters":[{"name":"familyId","in":"path","schema":{"$ref":"#/components/schemas/TemplateFamilyId"},"required":true},{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"TemplateFamily","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateFamily"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Adds an existing template as a channel member of the family and returns the updated family.","summary":"Attach a template to a family"},"delete":{"tags":["Templates"],"operationId":"templates.detachFamilyMember","parameters":[{"name":"familyId","in":"path","schema":{"$ref":"#/components/schemas/TemplateFamilyId"},"required":true},{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"TemplateFamily","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateFamily"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Removes a member template from the family without deleting the template.","summary":"Detach a template from a family"}},"/v1/templates/families/{familyId}/channels/{channel}":{"post":{"tags":["Templates"],"operationId":"templates.addFamilyChannel","parameters":[{"name":"familyId","in":"path","schema":{"$ref":"#/components/schemas/TemplateFamilyId"},"required":true},{"name":"channel","in":"path","schema":{"type":"string","enum":["email"]},"required":true}],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateFamily"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Creates a template for the requested channel in the family and returns the updated family with status 201.","summary":"Add a channel to a template family"}},"/v1/templates/{id}":{"get":{"tags":["Templates"],"operationId":"templates.getById","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns template metadata and compiled channel content. Read live SML through the template-document API.","summary":"Get a template"},"patch":{"tags":["Templates"],"operationId":"templates.update","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates template metadata. Source changes use the template-document revision API.","summary":"Update a template","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTemplatePayload"}}},"required":true}},"delete":{"tags":["Templates"],"operationId":"templates.remove","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Deletes a template from the organization and returns a success flag.","summary":"Delete a template"}},"/v1/templates/{id}/approve":{"post":{"tags":["Templates"],"operationId":"templates.approve","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Records compliance approval for a template with optional notes and moves its status to approved unless it is already published or archived.","summary":"Approve a template","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"notes":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}},"required":["data"],"additionalProperties":false}}},"required":true}}},"/v1/template-documents/bootstrap":{"post":{"tags":["Template Documents"],"operationId":"templateDocuments.bootstrap","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"$ref":"#/components/schemas/TemplateId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"channel":{"type":"string","enum":["email"]},"source":{"type":"string"},"revision":{"type":"string"},"sourceDigest":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"createdBy":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"via":{"type":"string","enum":["api","mcp","agent"]}},"required":["userId","via"],"additionalProperties":false},"updatedBy":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"via":{"type":"string","enum":["api","mcp","agent"]}},"required":["userId","via"],"additionalProperties":false}},"required":["templateId","organizationId","channel","source","revision","sourceDigest","createdAt","updatedAt","createdBy","updatedBy"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Creates or loads the authoritative editable document for a template and returns its current snapshot.","summary":"Bootstrap a template document","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"$ref":"#/components/schemas/TemplateId"}},"required":["templateId"],"additionalProperties":false}}},"required":true}}},"/v1/template-documents/{templateId}":{"get":{"tags":["Template Documents"],"operationId":"templateDocuments.get","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"$ref":"#/components/schemas/TemplateId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"channel":{"type":"string","enum":["email"]},"source":{"type":"string"},"revision":{"type":"string"},"sourceDigest":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"createdBy":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"via":{"type":"string","enum":["api","mcp","agent"]}},"required":["userId","via"],"additionalProperties":false},"updatedBy":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"via":{"type":"string","enum":["api","mcp","agent"]}},"required":["userId","via"],"additionalProperties":false}},"required":["templateId","organizationId","channel","source","revision","sourceDigest","createdAt","updatedAt","createdBy","updatedBy"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the current authoritative source, revision, and metadata for a template document.","summary":"Get a template document"}},"/v1/template-documents/{templateId}/agent-admission":{"post":{"tags":["Template Documents"],"operationId":"templateDocuments.issueAgentAdmission","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"conversationId":{"type":"string"},"snapshot":{"type":"object","properties":{"templateId":{"$ref":"#/components/schemas/TemplateId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"channel":{"type":"string","enum":["email"]},"source":{"type":"string"},"revision":{"type":"string"},"sourceDigest":{"type":"string"}},"required":["templateId","organizationId","channel","source","revision","sourceDigest"],"additionalProperties":false},"reference":{"anyOf":[{"type":"object","properties":{"version":{"type":"number","enum":[1]},"referenceId":{"type":"string","minLength":1,"maxLength":128},"name":{"type":"string","minLength":1,"maxLength":256},"description":{"type":"string","minLength":1,"maxLength":2000},"galleryPath":{"type":"string","minLength":2,"maxLength":512,"pattern":"^\\/templates\\/[a-z0-9]+(?:-[a-z0-9]+)*$"},"digest":{"type":"string","pattern":"^[a-f0-9]{64}$"},"citation":{"type":"object","properties":{"kind":{"type":"string"},"digest":{"type":"string"},"locator":{"type":"string"}},"required":["kind","digest"],"additionalProperties":false},"policy":{"type":"string","enum":["samva-owned-source"]},"source":{"type":"string","maxLength":500000}},"required":["version","referenceId","name","description","galleryPath","digest","citation","policy","source"],"additionalProperties":false},{"type":"object","properties":{"version":{"type":"number","enum":[1]},"referenceId":{"type":"string","minLength":1,"maxLength":128},"name":{"type":"string","minLength":1,"maxLength":256},"description":{"type":"string","minLength":1,"maxLength":2000},"galleryPath":{"type":"string","minLength":2,"maxLength":512,"pattern":"^\\/templates\\/[a-z0-9]+(?:-[a-z0-9]+)*$"},"digest":{"type":"string","pattern":"^[a-f0-9]{64}$"},"citation":{"type":"object","properties":{"kind":{"type":"string"},"digest":{"type":"string"},"locator":{"type":"string"}},"required":["kind","digest"],"additionalProperties":false},"policy":{"type":"string","enum":["reviewed-public-structure"]},"structure":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","properties":{"tag":{"type":"string"},"depth":{"type":"integer","minimum":0},"childIndex":{"type":"integer","minimum":0}},"required":["tag","depth","childIndex"],"additionalProperties":false},"maxItems":200},"components":{"type":"array","items":{"type":"object","properties":{"tag":{"type":"string"},"count":{"type":"integer","exclusiveMinimum":0}},"required":["tag","count"],"additionalProperties":false},"maxItems":64},"palette":{"type":"array","items":{"type":"string"},"maxItems":24}},"required":["nodes","components","palette"],"additionalProperties":false}},"required":["version","referenceId","name","description","galleryPath","digest","citation","policy","structure"],"additionalProperties":false},{"type":"object","properties":{"version":{"type":"number","enum":[1]},"policy":{"type":"string","enum":["authorized-message-structure"]},"referenceId":{"type":"string","minLength":1,"maxLength":128},"name":{"type":"string","minLength":1,"maxLength":256},"description":{"type":"string","minLength":1,"maxLength":2000},"digest":{"type":"string","pattern":"^[a-f0-9]{64}$"},"citation":{"type":"object","properties":{"kind":{"type":"string"},"digest":{"type":"string"},"locator":{"type":"string"}},"required":["kind","digest"],"additionalProperties":false},"structure":{"type":"object","properties":{"sections":{"type":"integer","minimum":0},"headings":{"type":"integer","minimum":0},"images":{"type":"integer","minimum":0},"links":{"type":"integer","minimum":0},"buttons":{"type":"integer","minimum":0},"textLength":{"type":"integer","minimum":0},"subjectLength":{"type":"integer","minimum":0},"palette":{"type":"array","items":{"type":"string"},"maxItems":24}},"required":["sections","headings","images","links","buttons","textLength","subjectLength","palette"],"additionalProperties":false}},"required":["version","policy","referenceId","name","description","digest","citation","structure"],"additionalProperties":false},{"type":"object","properties":{"version":{"type":"number","enum":[1]},"policy":{"type":"string","enum":["public-research"]},"request":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["query"]},"query":{"type":"string","minLength":3,"maxLength":500}},"required":["kind","query"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["url"]},"url":{"type":"string","minLength":8,"maxLength":2048}},"required":["kind","url"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["styleguide"]},"domain":{"type":"string","minLength":3,"maxLength":253}},"required":["kind","domain"],"additionalProperties":false}]},"digest":{"type":"string","pattern":"^[a-f0-9]{64}$"},"citations":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":300},"url":{"type":"string","minLength":8,"maxLength":2048},"excerpts":{"type":"array","items":{"type":"string","minLength":1,"maxLength":1200},"maxItems":4}},"required":["title","url","excerpts"],"additionalProperties":false},"minItems":1,"maxItems":4},"citation":{"type":"object","properties":{"kind":{"type":"string"},"digest":{"type":"string"},"locator":{"type":"string"}},"required":["kind","digest"],"additionalProperties":false}},"required":["version","policy","request","digest","citations","citation"],"additionalProperties":false}]},"proposalBinding":{"type":"string","maxLength":8192}},"required":["token","conversationId","snapshot"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Authorizes a bounded template-agent operation against the current document and returns the admission context.","summary":"Issue an agent admission","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"method":{"type":"string","enum":["GET","HEAD","POST"]},"route":{"type":"string","enum":["prompt","read","abort","clear"]},"referenceDigest":{"type":"string","pattern":"^[a-f0-9]{64}$"},"research":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["query"]},"query":{"type":"string","minLength":3,"maxLength":500}},"required":["kind","query"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["url"]},"url":{"type":"string","minLength":8,"maxLength":2048}},"required":["kind","url"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["styleguide"]},"domain":{"type":"string","minLength":3,"maxLength":253}},"required":["kind","domain"],"additionalProperties":false}]},"competitorMessage":{"type":"object","properties":{"watchId":{"$ref":"#/components/schemas/MailboxExtensionId"},"messageId":{"$ref":"#/components/schemas/MessageId"}},"required":["watchId","messageId"],"additionalProperties":false}},"required":["method","route"],"additionalProperties":false}}},"required":true}}},"/v1/template-documents/{templateId}/agent-conversation/clear-completion":{"post":{"tags":["Template Documents"],"operationId":"templateDocuments.completeAgentConversationClear","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"<No Content>"},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Records completion of an admitted agent conversation-clear operation for the template document.","summary":"Complete an agent conversation clear","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"conversationId":{"type":"string"}},"required":["conversationId"],"additionalProperties":false}}},"required":true}}},"/v1/template-documents/{templateId}/agent-proposals/apply":{"post":{"tags":["Template Documents"],"operationId":"templateDocuments.applyAgentProposal","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"$ref":"#/components/schemas/TemplateId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"channel":{"type":"string","enum":["email"]},"source":{"type":"string"},"revision":{"type":"string"},"sourceDigest":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"createdBy":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"via":{"type":"string","enum":["api","mcp","agent"]}},"required":["userId","via"],"additionalProperties":false},"updatedBy":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"via":{"type":"string","enum":["api","mcp","agent"]}},"required":["userId","via"],"additionalProperties":false}},"required":["templateId","organizationId","channel","source","revision","sourceDigest","createdAt","updatedAt","createdBy","updatedBy"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Applies an admitted agent-authored source proposal when its revision and source digest still match the document.","summary":"Apply an agent proposal","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"string"},"sourceDigest":{"type":"string"},"idempotencyKey":{"type":"string"},"source":{"type":"string"},"references":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"digest":{"type":"string"},"locator":{"type":"string"}},"required":["kind","digest"],"additionalProperties":false},"maxItems":1},"proposalBinding":{"type":"string","maxLength":8192}},"required":["expectedRevision","sourceDigest","idempotencyKey","source","references"],"additionalProperties":false}}},"required":true}}},"/v1/template-documents/{templateId}/source":{"post":{"tags":["Template Documents"],"operationId":"templateDocuments.replace","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"$ref":"#/components/schemas/TemplateId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"channel":{"type":"string","enum":["email"]},"source":{"type":"string"},"revision":{"type":"string"},"sourceDigest":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"createdBy":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"via":{"type":"string","enum":["api","mcp","agent"]}},"required":["userId","via"],"additionalProperties":false},"updatedBy":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"via":{"type":"string","enum":["api","mcp","agent"]}},"required":["userId","via"],"additionalProperties":false}},"required":["templateId","organizationId","channel","source","revision","sourceDigest","createdAt","updatedAt","createdBy","updatedBy"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Replaces the editable SML source when the expected revision matches and returns the updated document snapshot.","summary":"Replace template source","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"string"},"source":{"type":"string"}},"required":["expectedRevision","source"],"additionalProperties":false}}},"required":true}}},"/v1/template-documents/{templateId}/save":{"post":{"tags":["Template Documents"],"operationId":"templateDocuments.save","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"templateId":{"$ref":"#/components/schemas/TemplateId"},"documentRevision":{"type":"string"},"sourceDigest":{"type":"string"},"compilerVersion":{"type":"string"},"createdAt":{"type":"string"},"versionId":{"type":"string"}},"required":["id","templateId","documentRevision","sourceDigest","compilerVersion","createdAt","versionId"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Materializes the specified document revision as a durable template source version and returns its receipt.","summary":"Save a template document","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"string"}},"required":["revision"],"additionalProperties":false}}},"required":true}}},"/v1/template-documents/{templateId}/render":{"post":{"tags":["Template Documents"],"operationId":"templateDocuments.render","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"channel":{"type":"string","enum":["email"]},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"type":"string"},"missingVariables":{"type":"array","items":{"type":"string"}}},"required":["channel","text","missingVariables"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Renders the specified document revision with optional variables and reports any missing variables.","summary":"Render a template document","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"string"},"variables":{"anyOf":[{"type":"object"},{"type":"null"}]}},"required":["revision"],"additionalProperties":false}}},"required":true}}},"/v1/template-documents/{templateId}/spam-check":{"post":{"tags":["Template Documents"],"operationId":"templateDocuments.spamCheck","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"score":{"type":"number","minimum":0},"severity":{"type":"string","enum":["low","medium","high"]},"issues":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"string"},"description":{"type":"string"},"severity":{"type":"string","enum":["low","medium","high"]},"score":{"type":"number","minimum":0}},"required":["rule","description","severity","score"],"additionalProperties":false}},"recommendations":{"type":"array","items":{"type":"string"}}},"required":["score","severity","issues","recommendations"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Renders and analyzes the specified document revision for spam risks, returning issues and recommendations.","summary":"Check a template document for spam","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"string"},"variables":{"anyOf":[{"type":"object"},{"type":"null"}]}},"required":["revision"],"additionalProperties":false}}},"required":true}}},"/v1/template-documents/{templateId}/send-test":{"post":{"tags":["Template Documents"],"operationId":"templateDocuments.testSend","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"messageId":{"type":"string"},"status":{"type":"string"},"rendered":{"type":"object","properties":{"channel":{"type":"string","enum":["email"]},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"type":"string"},"missingVariables":{"type":"array","items":{"type":"string"}}},"required":["channel","text","missingVariables"],"additionalProperties":false}},"required":["messageId","status","rendered"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"429":{"description":"RateLimitedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitedErrorEncoded"}}}},"500":{"description":"InternalError | WebhookEnqueueError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/InternalErrorEncoded"},{"$ref":"#/components/schemas/WebhookEnqueueErrorEncoded"}]}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Renders the specified document revision and sends a test message to one recipient without publishing it.","summary":"Send a template test","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"string"},"to":{"type":"string"},"variables":{"anyOf":[{"type":"object"},{"type":"null"}]}},"required":["revision","to"],"additionalProperties":false}}},"required":true}}},"/v1/template-documents/{templateId}/send":{"post":{"tags":["Template Documents"],"operationId":"templateDocuments.send","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["sent"]},"messageId":{"type":"string"},"acceptedAt":{"type":"string"}},"required":["kind","messageId","acceptedAt"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["scheduled"]},"scheduledMessageId":{"type":"string"},"scheduledFor":{"type":"string"}},"required":["kind","scheduledMessageId","scheduledFor"],"additionalProperties":false}]}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorEncoded"}}}},"403":{"description":"ForbiddenError | FlagDisabledError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/FlagDisabledErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"429":{"description":"RateLimitedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitedErrorEncoded"}}}},"500":{"description":"InternalError | WebhookEnqueueError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/InternalErrorEncoded"},{"$ref":"#/components/schemas/WebhookEnqueueErrorEncoded"}]}}}},"502":{"description":"ExternalServiceError | BillingProviderError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ExternalServiceErrorEncoded"},{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}]}}}}},"description":"Sends or schedules the specified document revision for one or more recipients with optional variables.","summary":"Send a template document","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"string"},"to":{"type":"array","items":{"type":"object","properties":{"address":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["address"],"additionalProperties":false},"minItems":1},"variables":{"anyOf":[{"type":"object"},{"type":"null"}]},"schedule":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]}},"required":["revision","to"],"additionalProperties":false}}},"required":true}}},"/v1/template-documents/{templateId}/versions":{"get":{"tags":["Template Documents"],"operationId":"templateDocuments.versions","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"versions":{"type":"array","items":{"type":"object","properties":{"versionId":{"$ref":"#/components/schemas/TemplateSourceVersionId"},"version":{"type":"number"},"status":{"type":"string"},"isCurrent":{"type":"boolean"},"materializationId":{"type":"string"},"documentRevision":{"type":"string"},"sourceDigest":{"type":"string"},"compilerVersion":{"type":"string"},"publishedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"archivedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["versionId","version","status","isCurrent","materializationId","documentRevision","sourceDigest","compilerVersion","publishedAt","archivedAt","createdAt"],"additionalProperties":false}}},"required":["versions"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the saved source-version history for a template document.","summary":"List template document versions"}},"/v1/template-documents/{templateId}/publish":{"post":{"tags":["Template Documents"],"operationId":"templateDocuments.publish","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"versionId":{"type":"string"}},"required":["versionId"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Publishes the current saved template source version and returns its lifecycle receipt.","summary":"Publish a template document"}},"/v1/template-documents/{templateId}/unpublish":{"post":{"tags":["Template Documents"],"operationId":"templateDocuments.unpublish","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"versionId":{"type":"string"}},"required":["versionId"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Unpublishes the current template source version and returns its lifecycle receipt.","summary":"Unpublish a template document"}},"/v1/template-documents/{templateId}/versions/{versionId}/restore":{"post":{"tags":["Template Documents"],"operationId":"templateDocuments.restore","parameters":[{"name":"templateId","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true},{"name":"versionId","in":"path","schema":{"$ref":"#/components/schemas/TemplateSourceVersionId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"$ref":"#/components/schemas/TemplateId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"channel":{"type":"string","enum":["email"]},"source":{"type":"string"},"revision":{"type":"string"},"sourceDigest":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"createdBy":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"via":{"type":"string","enum":["api","mcp","agent"]}},"required":["userId","via"],"additionalProperties":false},"updatedBy":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserId"},"via":{"type":"string","enum":["api","mcp","agent"]}},"required":["userId","via"],"additionalProperties":false}},"required":["templateId","organizationId","channel","source","revision","sourceDigest","createdAt","updatedAt","createdBy","updatedBy"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Restores a saved source version into the editable document when the expected revision matches.","summary":"Restore a template document version","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"string"}},"required":["expectedRevision"],"additionalProperties":false}}},"required":true}}},"/v1/presets":{"get":{"tags":["Presets"],"operationId":"presets.list","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"channel":{"type":"string","enum":["email"]},"category":{"type":"string","enum":["transactional","digest","marketing","lifecycle"]},"name":{"type":"string"},"description":{"type":"string"},"variables":{"type":"array","items":{"type":"string"}}},"required":["id","channel","category","name","description","variables"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns metadata for the Samva-authored SML starter presets shown in the template gallery.","summary":"List starter presets"}},"/v1/presets/{id}/preview":{"get":{"tags":["Presets"],"operationId":"presets.preview","parameters":[{"name":"id","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"html":{"type":"string"}},"required":["id","html"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Compiles the requested preset with the organization's theme and returns the rendered HTML.","summary":"Preview a preset"}},"/v1/presets/{id}/source":{"get":{"tags":["Presets"],"operationId":"presets.source","parameters":[{"name":"id","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string"}},"required":["id","source"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}}},"description":"Returns the raw SML source of the requested preset for the dashboard to open in the editor.","summary":"Get a preset's source"}},"/v1/fonts/host":{"post":{"tags":["Fonts"],"operationId":"fonts.host","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","enum":["google"]},"family":{"type":"string"},"fallback":{"type":"string"},"faces":{"type":"array","items":{"type":"object","properties":{"weight":{"type":"number"},"style":{"type":"string","enum":["normal","italic"]},"src":{"type":"string"},"unicodeRange":{"type":"string"}},"required":["weight","style","src","unicodeRange"],"additionalProperties":false}}},"required":["source","family","fallback","faces"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorEncoded"}}}}},"description":"Hosts a Google Fonts family's woff2 faces on Samva's public asset origin and returns the font token. Idempotent and deduplicated by content hash.","summary":"Host a Google webfont","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"family":{"type":"string","minLength":1},"weights":{"type":"array","items":{"type":"number","minimum":100,"maximum":900},"minItems":1}},"required":["family","weights"],"additionalProperties":false}}},"required":true}}},"/v1/fonts/tokens":{"post":{"tags":["Fonts"],"operationId":"fonts.setToken","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"font":{"type":"object","properties":{"source":{"type":"string","enum":["system","google","custom"]},"family":{"type":"string","minLength":1},"fallback":{"type":"string","minLength":1},"faces":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"weight":{"type":"number","minimum":100,"maximum":900},"style":{"type":"string","enum":["normal","italic"]},"src":{"type":"string","minLength":1},"unicodeRange":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["weight","style","src"],"additionalProperties":false},"minItems":1},{"type":"null"}]}},"required":["source","family","fallback"],"additionalProperties":false},"hostedFaces":{"type":"number"},"next":{"type":"string"}},"required":["token","font","hostedFaces","next"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorEncoded"}}}}},"description":"Defines or replaces one font token in the organization's theme, hosting the family's faces first when the source demands it, and returns the written token.","summary":"Set a brand font token","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","pattern":"^[a-z][a-z0-9-]*$","maxLength":64,"description":"Theme token to define, e.g. 'body', 'heading', or any lowercase name. Nodes reference it as the `font-{token}` class."},"source":{"type":"string","enum":["google","custom","system"],"description":"'google' lazy-self-hosts a Google Fonts family; 'custom' reuses a family already uploaded in the theme editor; 'system' assigns a web-safe stack."},"family":{"type":"string","minLength":1,"description":"The family name. For 'google' it must be an exact Google Fonts catalog family; for 'custom' a family already uploaded to this org's theme; for 'system' a web-safe family (e.g. Arial, Georgia)."},"weights":{"anyOf":[{"type":"array","items":{"type":"number","minimum":100,"maximum":900},"minItems":1},{"type":"null"}],"description":"Google-only: weights to self-host (100–900). Defaults to [400, 700]. Ignored for custom/system."}},"required":["token","source","family"],"additionalProperties":false}}},"required":true}}},"/v1/fonts/uploads":{"post":{"tags":["Fonts"],"operationId":"fonts.authorizeUpload","parameters":[],"security":[{"apiKey":[]}],"responses":{"204":{"description":"<No Content>"},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Checks the caller's template permission before the web Worker accepts woff2 bytes.","summary":"Authorize a custom font upload","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"contentType":{"type":"string","enum":["font/woff2"]},"contentLength":{"type":"number","minimum":1,"maximum":2097152}},"required":["contentType","contentLength"],"additionalProperties":false}}},"required":true}}},"/v1/template-assets/uploads":{"post":{"tags":["Template Assets"],"operationId":"templateAssets.authorizeUpload","parameters":[],"security":[{"apiKey":[]}],"responses":{"204":{"description":"<No Content>"},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Checks the caller's template permission before the web Worker accepts image bytes.","summary":"Authorize a template asset upload","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"contentType":{"type":"string","enum":["image/png","image/jpeg","image/webp"]},"contentLength":{"type":"number","minimum":1,"maximum":5242880}},"required":["contentType","contentLength"],"additionalProperties":false}}},"required":true}}},"/v1/design":{"get":{"tags":["Design"],"operationId":"design.get","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"DesignSettings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DesignSettings"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the organization's configured email design kit (theme, assets, footer), or null when none is set.","summary":"Get the organization design"},"put":{"tags":["Design"],"operationId":"design.update","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"DesignSettings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DesignSettings"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Validates and saves the organization's email design kit; a null body clears the design back to the base design floor.","summary":"Update the organization design","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"design":{"anyOf":[{"$ref":"#/components/schemas/Design"},{"type":"null"}]}},"required":["design"],"additionalProperties":false}}},"required":true}}},"/v1/drafts":{"get":{"tags":["Drafts"],"operationId":"drafts.list","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"channel","in":"query","schema":{"anyOf":[{"type":"string","enum":["email"]},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/DraftId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"channel":{"type":"string"},"recipients":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"contactId":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}},{"type":"null"}]},"content":{"type":"object","properties":{"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"ast":{"anyOf":[{"type":"object"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"templateId":{"anyOf":[{"$ref":"#/components/schemas/TemplateId"},{"type":"null"}]},"templateName":{"anyOf":[{"type":"string"},{"type":"null"}]},"variables":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]},"attachmentIds":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/AttachmentId"}},{"type":"null"}]}},"additionalProperties":false},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastEditedAt":{"type":"string"},"createdAt":{"type":"string"},"createdBy":{"$ref":"#/components/schemas/UserId"}},"required":["id","organizationId","channel","recipients","content","title","lastEditedAt","createdAt","createdBy"],"additionalProperties":false}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of the current user's drafts in the organization, optionally filtered by channel.","summary":"List drafts"},"post":{"tags":["Drafts"],"operationId":"drafts.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/DraftId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"channel":{"type":"string"},"recipients":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"contactId":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}},{"type":"null"}]},"content":{"type":"object","properties":{"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"ast":{"anyOf":[{"type":"object"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"templateId":{"anyOf":[{"$ref":"#/components/schemas/TemplateId"},{"type":"null"}]},"templateName":{"anyOf":[{"type":"string"},{"type":"null"}]},"variables":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]},"attachmentIds":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/AttachmentId"}},{"type":"null"}]}},"additionalProperties":false},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastEditedAt":{"type":"string"},"createdAt":{"type":"string"},"createdBy":{"$ref":"#/components/schemas/UserId"}},"required":["id","organizationId","channel","recipients","content","title","lastEditedAt","createdAt","createdBy"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Creates a draft for the current user on the given channel. Returns the created draft with status 201.","summary":"Create a draft","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"channel":{"type":"string","enum":["email"]},"recipients":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"contactId":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}},{"type":"null"}]},"content":{"anyOf":[{"type":"object","properties":{"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"ast":{"anyOf":[{"type":"object"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"templateId":{"anyOf":[{"$ref":"#/components/schemas/TemplateId"},{"type":"null"}]},"templateName":{"anyOf":[{"type":"string"},{"type":"null"}]},"variables":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]},"attachmentIds":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/AttachmentId"}},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]},"title":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["channel"],"additionalProperties":false}}},"required":true}}},"/v1/drafts/{id}":{"get":{"tags":["Drafts"],"operationId":"drafts.getById","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/DraftId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/DraftId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"channel":{"type":"string"},"recipients":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"contactId":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}},{"type":"null"}]},"content":{"type":"object","properties":{"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"ast":{"anyOf":[{"type":"object"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"templateId":{"anyOf":[{"$ref":"#/components/schemas/TemplateId"},{"type":"null"}]},"templateName":{"anyOf":[{"type":"string"},{"type":"null"}]},"variables":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]},"attachmentIds":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/AttachmentId"}},{"type":"null"}]}},"additionalProperties":false},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastEditedAt":{"type":"string"},"createdAt":{"type":"string"},"createdBy":{"$ref":"#/components/schemas/UserId"}},"required":["id","organizationId","channel","recipients","content","title","lastEditedAt","createdAt","createdBy"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a single draft by ID, including its recipients and content.","summary":"Get a draft"},"patch":{"tags":["Drafts"],"operationId":"drafts.update","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/DraftId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/DraftId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"channel":{"type":"string"},"recipients":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"contactId":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}},{"type":"null"}]},"content":{"type":"object","properties":{"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"ast":{"anyOf":[{"type":"object"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"templateId":{"anyOf":[{"$ref":"#/components/schemas/TemplateId"},{"type":"null"}]},"templateName":{"anyOf":[{"type":"string"},{"type":"null"}]},"variables":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]},"attachmentIds":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/AttachmentId"}},{"type":"null"}]}},"additionalProperties":false},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastEditedAt":{"type":"string"},"createdAt":{"type":"string"},"createdBy":{"$ref":"#/components/schemas/UserId"}},"required":["id","organizationId","channel","recipients","content","title","lastEditedAt","createdAt","createdBy"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates a draft's recipients, content, or title and returns the updated draft.","summary":"Update a draft","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"recipients":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"contactId":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}},{"type":"null"}]},"content":{"anyOf":[{"type":"object","properties":{"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"ast":{"anyOf":[{"type":"object"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"templateId":{"anyOf":[{"$ref":"#/components/schemas/TemplateId"},{"type":"null"}]},"templateName":{"anyOf":[{"type":"string"},{"type":"null"}]},"variables":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]},"attachmentIds":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/AttachmentId"}},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]},"title":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}}},"required":true}},"delete":{"tags":["Drafts"],"operationId":"drafts.remove","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/DraftId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Deletes a draft belonging to the current user and returns a success flag.","summary":"Delete a draft"}},"/v1/attachments/{id}":{"get":{"tags":["Attachments"],"operationId":"attachments.getById","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/AttachmentId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/AttachmentId"},"messageId":{"$ref":"#/components/schemas/MessageId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer","minimum":0},"contentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"isInline":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","messageId","organizationId","filename","contentType","size","contentId","isInline","createdAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns metadata for a single attachment, including filename, content type, and size.","summary":"Get an attachment"},"delete":{"tags":["Attachments"],"operationId":"attachments.remove","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/AttachmentId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"deletedId":{"$ref":"#/components/schemas/AttachmentId"}},"required":["success","deletedId"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Deletes an attachment and returns the deleted attachment's ID.","summary":"Delete an attachment"}},"/v1/attachments":{"get":{"tags":["Attachments"],"operationId":"attachments.list","parameters":[{"name":"messageId","in":"query","schema":{"$ref":"#/components/schemas/MessageId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/AttachmentId"},"messageId":{"$ref":"#/components/schemas/MessageId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer","minimum":0},"contentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"isInline":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","messageId","organizationId","filename","contentType","size","contentId","isInline","createdAt"],"additionalProperties":false}},"total":{"type":"integer","minimum":0}},"required":["attachments","total"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns all attachments for the given message, along with a total count.","summary":"List message attachments"}},"/v1/attachments/{id}/download-url":{"get":{"tags":["Attachments"],"operationId":"attachments.downloadUrl","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/AttachmentId"},"required":true},{"name":"expiresIn","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"expiresAt":{"type":"string"},"attachment":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/AttachmentId"},"messageId":{"$ref":"#/components/schemas/MessageId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer","minimum":0},"contentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"isInline":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","messageId","organizationId","filename","contentType","size","contentId","isInline","createdAt"],"additionalProperties":false}},"required":["url","expiresAt","attachment"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Generates a presigned, time-limited download URL for the attachment; expiry is configurable via the expiresIn query parameter.","summary":"Get an attachment download URL"}},"/v1/media":{"post":{"tags":["Media"],"operationId":"media.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"CreatedMedia","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedMedia"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Creates the media object in the pending state and returns it with the upload instruction — URL, method, and headers — for putting its bytes into storage.","summary":"Create a media object","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMediaPayload"}}},"required":true}}},"/v1/media/{mediaId}/complete":{"post":{"tags":["Media"],"operationId":"media.complete","parameters":[{"name":"mediaId","in":"path","schema":{"$ref":"#/components/schemas/MediaId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"CompletedMedia","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompletedMedia"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Verifies the uploaded object exists in storage, marks the media object ready, and returns it with a download URL.","summary":"Complete a media upload"}},"/v1/media/{mediaId}":{"delete":{"tags":["Media"],"operationId":"media.remove","parameters":[{"name":"mediaId","in":"path","schema":{"$ref":"#/components/schemas/MediaId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Deletes a pending media object and the bytes stored for it. Fails if the media object is already ready.","summary":"Delete a media object"},"get":{"tags":["Media"],"operationId":"media.getById","parameters":[{"name":"mediaId","in":"path","schema":{"$ref":"#/components/schemas/MediaId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Media","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Media"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the media object's metadata, including status, dimensions, and confirmation timestamps.","summary":"Get a media object"}},"/v1/media/{mediaId}/url":{"get":{"tags":["Media"],"operationId":"media.downloadUrl","parameters":[{"name":"mediaId","in":"path","schema":{"$ref":"#/components/schemas/MediaId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"MediaDownloadUrl","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaDownloadUrl"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Generates a presigned, time-limited download URL for a ready media object.","summary":"Get a media download URL"}},"/v1/organizations":{"post":{"tags":["Organizations"],"operationId":"organizations.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Creates a new workspace organization under the current billing account and returns it.","summary":"Create a workspace","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":false}}},"required":true}}},"/v1/organizations/current":{"get":{"tags":["Organizations"],"operationId":"organizations.get","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the organization for the current billing account.","summary":"Get the current organization"},"patch":{"tags":["Organizations"],"operationId":"organizations.update","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates the current organization's profile, billing, locale, design, default reply-to, and default unsubscribe-group fields and returns the saved organization.","summary":"Update the current organization","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"slug":{"anyOf":[{"type":"string"},{"type":"null"}]},"billingEmail":{"anyOf":[{"type":"string"},{"type":"null"}]},"countryCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"type":"string"},{"type":"null"}]},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}]},"isActive":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}]},"design":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/Design"},{"type":"null"}]},{"type":"null"}]},"replyToDefault":{"anyOf":[{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},{"type":"null"}]},"defaultUnsubscribeGroupId":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/UnsubscribeId"},{"type":"null"}]},{"type":"null"}]},"emailFooterEnabledDefault":{"anyOf":[{"anyOf":[{"type":"boolean"},{"type":"null"}]},{"type":"null"}]}},"additionalProperties":false}}},"required":true}}},"/v1/organizations/usage":{"get":{"tags":["Organizations"],"operationId":"organizations.getUsage","parameters":[{"name":"period","in":"query","schema":{"anyOf":[{"type":"string","enum":["current","last_30_days","last_90_days","last_year"]},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"usage":{"type":"object","properties":{"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"emailCount":{"type":"number"},"totalMessages":{"type":"number"}},"required":["periodStart","periodEnd","emailCount","totalMessages"],"additionalProperties":false},"billing":{"type":"object","properties":{"currency":{"type":"string"},"includedEmails":{"anyOf":[{"type":"number"},{"type":"null"}]},"usedEmails":{"anyOf":[{"type":"number"},{"type":"null"}]},"overageEmails":{"anyOf":[{"type":"number"},{"type":"null"}]},"overageCost":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["currency","includedEmails","usedEmails","overageEmails","overageCost"],"additionalProperties":false}},"required":["usage","billing"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns usage statistics for the current organization over the selected reporting period.","summary":"Get organization usage"}},"/v1/organizations/deletion-operations":{"post":{"tags":["Organizations"],"operationId":"organizations.delete","parameters":[{"name":"idempotency-key","in":"header","schema":{"type":"string","minLength":1,"maxLength":255},"required":true}],"security":[{"apiKey":[]}],"responses":{"202":{"description":"OperationAccepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationAccepted"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}]}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Accepts owner-authorized durable workspace deletion. Repeating the same request with the same Idempotency-Key returns the existing organization-scoped operation.","summary":"Delete the current workspace","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"confirmationName":{"type":"string"}},"required":["confirmationName"],"additionalProperties":false}}},"required":true}}},"/v1/organizations/bootstrap":{"post":{"tags":["Organizations"],"operationId":"organizations.bootstrap","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}]}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Creates a replacement first workspace under the signed-in user's billing account when no workspace membership remains.","summary":"Create the first workspace","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":false}}},"required":true}}},"/v1/operations":{"get":{"tags":["Operations"],"operationId":"operations.list","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"kind","in":"query","schema":{"anyOf":[{"type":"string","enum":["email-domain-provisioning","organization-deletion"]},{"type":"null"}]},"required":false},{"name":"status","in":"query","schema":{"anyOf":[{"type":"string","enum":["pending","running","succeeded","failed"]},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Operation"}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"}},"required":["page","limit","total"],"additionalProperties":false}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Lists durable asynchronous operation state for the active organization.","summary":"List asynchronous operations"}},"/v1/operations/{operationId}":{"get":{"tags":["Operations"],"operationId":"operations.get","parameters":[{"name":"operationId","in":"path","schema":{"$ref":"#/components/schemas/OperationId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Operation"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns one durable asynchronous operation from the active organization.","summary":"Get an asynchronous operation"}},"/v1/operations/{operationId}/retry":{"post":{"tags":["Operations"],"operationId":"operations.retry","parameters":[{"name":"operationId","in":"path","schema":{"$ref":"#/components/schemas/OperationId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"202":{"description":"OperationAccepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationAccepted"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Retries the same durable execution identity when its failure is explicitly retryable. Retrying a workspace deletion additionally requires `organization:delete`.","summary":"Retry an asynchronous operation"}},"/v1/api-keys":{"post":{"tags":["API Keys"],"operationId":"apiKeys.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyWithSecret"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Creates a new API key for the organization and returns the created key, including the plaintext secret, with a 201 response.","summary":"Create an API key","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":32},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"permissions":{"$ref":"#/components/schemas/ApiKeyPermissions"}},"required":["name"],"additionalProperties":false}}},"required":true}},"get":{"tags":["API Keys"],"operationId":"apiKeys.list","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"status","in":"query","schema":{"anyOf":[{"type":"string","enum":["active","revoked"]},{"type":"null"}]},"required":false},{"name":"search","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of the organization's API keys, filterable by status and search term.","summary":"List API keys"}},"/v1/api-keys/{id}":{"get":{"tags":["API Keys"],"operationId":"apiKeys.get","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ApiKeyId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"ApiKey","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKey"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the API key with the given ID, including its metadata and permissions.","summary":"Get an API key"},"patch":{"tags":["API Keys"],"operationId":"apiKeys.update","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ApiKeyId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"ApiKey","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKey"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates the name or description of an API key and returns the updated key.","summary":"Update an API key","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"anyOf":[{"type":"string","minLength":1,"maxLength":32},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}}},"required":true}},"delete":{"tags":["API Keys"],"operationId":"apiKeys.revoke","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ApiKeyId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Deactivates an API key so it can no longer authenticate requests. The key record is retained and remains listable.","summary":"Revoke an API key"}},"/v1/api-keys/{id}/rotate":{"post":{"tags":["API Keys"],"operationId":"apiKeys.rotate","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ApiKeyId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"ApiKeyWithSecret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyWithSecret"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorEncoded"},{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Issues a replacement with the same owner, name, and permissions, then deactivates the existing key. Returns the new key, including the plaintext secret.","summary":"Rotate an API key"}},"/v1/api-keys/{id}/remove":{"delete":{"tags":["API Keys"],"operationId":"apiKeys.remove","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ApiKeyId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Permanently deletes an API key record. Unlike revocation, the key row is removed rather than deactivated.","summary":"Delete an API key"}},"/v1/api-keys/{id}/stats":{"get":{"tags":["API Keys"],"operationId":"apiKeys.getStats","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ApiKeyId"},"required":true},{"name":"period","in":"query","schema":{"anyOf":[{"type":"string","enum":["7d","30d","90d"]},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"totalRequests":{"type":"integer","minimum":0},"successfulRequests":{"type":"integer","minimum":0},"failedRequests":{"type":"integer","minimum":0},"dailyVolume":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"requests":{"type":"integer","minimum":0}},"required":["date","requests"],"additionalProperties":false}}},"required":["totalRequests","successfulRequests","failedRequests","dailyVolume"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns aggregate send counts and daily volume attributed to an API key over the selected period of 7, 30, or 90 days.","summary":"Get API key send statistics"}},"/v1/api-keys/{id}/activity":{"get":{"tags":["API Keys"],"operationId":"apiKeys.getActivity","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/ApiKeyId"},"required":true},{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"timestamp":{"type":"string"},"method":{"type":"string"},"endpoint":{"type":"string"},"statusCode":{"type":"integer","minimum":100,"maximum":599},"latency":{"type":"number","minimum":0}},"required":["id","timestamp","method","endpoint","statusCode","latency"],"additionalProperties":false}},"total":{"type":"integer","minimum":0},"hasMore":{"type":"boolean"}},"required":["data","total","hasMore"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of recent request activity recorded for an API key.","summary":"List API key activity"}},"/v1/webhooks":{"post":{"tags":["Webhooks"],"operationId":"webhooks.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"endpoint":{"$ref":"#/components/schemas/WebhookEndpoint"},"secret":{"$ref":"#/components/schemas/SensitiveString"}},"required":["endpoint","secret"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Creates a webhook endpoint subscribed to the given event types and returns it with a 201 response.","summary":"Create a webhook","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhookPayload"}}},"required":true}},"get":{"tags":["Webhooks"],"operationId":"webhooks.list","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"search","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEndpoint"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of the organization's webhook endpoints, optionally filtered by a name search.","summary":"List webhooks"}},"/v1/webhooks/{id}":{"get":{"tags":["Webhooks"],"operationId":"webhooks.get","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/WebhookEndpointId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"WebhookEndpoint","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the configuration of the webhook endpoint with the given ID.","summary":"Get a webhook"},"patch":{"tags":["Webhooks"],"operationId":"webhooks.update","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/WebhookEndpointId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"WebhookEndpoint","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates a webhook's name, URL, subscribed events, channels, custom headers, or status and returns the updated endpoint.","summary":"Update a webhook","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWebhookPayload"}}},"required":true}},"delete":{"tags":["Webhooks"],"operationId":"webhooks.remove","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/WebhookEndpointId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SuccessResponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorEncoded"}}}}},"description":"Deletes a webhook endpoint so it no longer receives event deliveries.","summary":"Delete a webhook"}},"/v1/webhooks/{id}/test":{"post":{"tags":["Webhooks"],"operationId":"webhooks.test","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/WebhookEndpointId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"202":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean","enum":[true]},"eventId":{"$ref":"#/components/schemas/WebhookEventId"},"deliveryId":{"$ref":"#/components/schemas/WebhookDeliveryId"}},"required":["accepted","eventId","deliveryId"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Queues a signed webhook.test event through the normal delivery and retry lifecycle.","summary":"Send a test webhook delivery","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestWebhookPayload"}}},"required":true}}},"/v1/webhooks/{webhookId}/logs":{"get":{"tags":["Webhooks"],"operationId":"webhooks.getLogs","parameters":[{"name":"webhookId","in":"path","schema":{"$ref":"#/components/schemas/WebhookEndpointId"},"required":true},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/WebhookDeliveryId"},"eventId":{"$ref":"#/components/schemas/WebhookEventId"},"endpointId":{"$ref":"#/components/schemas/WebhookEndpointId"},"status":{"type":"string","enum":["pending","delivered","exhausted","cancelled"]},"automaticAttempts":{"type":"integer","minimum":0},"nextAttemptAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"completedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"attempts":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/WebhookAttemptId"},"deliveryId":{"$ref":"#/components/schemas/WebhookDeliveryId"},"kind":{"type":"string","enum":["automatic","manual"]},"attemptNumber":{"type":"integer","exclusiveMinimum":0},"classification":{"type":"string","enum":["success","http-error","network-error","timeout","cancelled"]},"attemptedAt":{"type":"string"},"responseStatus":{"anyOf":[{"type":"integer"},{"type":"null"}]},"responseHeaders":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]},"durationMs":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"errorCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"errorMessage":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","deliveryId","kind","attemptNumber","classification","attemptedAt","responseStatus","responseHeaders","durationMs","errorCode","errorMessage","createdAt"],"additionalProperties":false}}},"required":["id","eventId","endpointId","status","automaticAttempts","nextAttemptAt","completedAt","createdAt","updatedAt","attempts"],"additionalProperties":false}},"hasMore":{"type":"boolean"}},"required":["data","hasMore"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns recent deliveries and their nested attempt diagnostics for a webhook endpoint.","summary":"List webhook delivery logs"}},"/v1/webhooks/{webhookId}/stats":{"get":{"tags":["Webhooks"],"operationId":"webhooks.getStats","parameters":[{"name":"webhookId","in":"path","schema":{"$ref":"#/components/schemas/WebhookEndpointId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"pending":{"type":"integer","minimum":0},"delivered":{"type":"integer","minimum":0},"exhausted":{"type":"integer","minimum":0},"cancelled":{"type":"integer","minimum":0}},"required":["total","pending","delivered","exhausted","cancelled"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns aggregate pending, delivered, exhausted, and cancelled delivery counts for a webhook endpoint.","summary":"Get webhook delivery statistics"}},"/v1/webhooks/{webhookId}/deliveries/{deliveryId}/redeliver":{"post":{"tags":["Webhooks"],"operationId":"webhooks.retryDelivery","parameters":[{"name":"webhookId","in":"path","schema":{"$ref":"#/components/schemas/WebhookEndpointId"},"required":true},{"name":"deliveryId","in":"path","schema":{"$ref":"#/components/schemas/WebhookDeliveryId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean","enum":[true]},"deliveryId":{"$ref":"#/components/schemas/WebhookDeliveryId"},"attemptId":{"$ref":"#/components/schemas/WebhookAttemptId"},"outcome":{"type":"string","enum":["succeeded","failed"]}},"required":["accepted","deliveryId","attemptId","outcome"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Performs one immediate manual redelivery attempt and returns that attempt's identity and outcome without changing the automatic retry lifecycle.","summary":"Retry a webhook delivery"}},"/v1/webhooks/{webhookId}/rotate-secret":{"post":{"tags":["Webhooks"],"operationId":"webhooks.regenerateSecret","parameters":[{"name":"webhookId","in":"path","schema":{"$ref":"#/components/schemas/WebhookEndpointId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"$ref":"#/components/schemas/SensitiveString"}},"required":["secret"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Generates and returns a new signing secret. The previous secret remains valid for a 24-hour rotation overlap.","summary":"Rotate a webhook signing secret"}},"/v1/analytics/stats":{"get":{"tags":["Analytics"],"operationId":"analytics.getStats","parameters":[{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"groupBy","in":"query","schema":{"anyOf":[{"type":"string","enum":["day","week","month"]},{"type":"null"}]},"required":false},{"name":"channel","in":"query","schema":{"anyOf":[{"type":"string","enum":["email"]},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"volumeHistory":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"email":{"type":"integer","minimum":0}},"required":["date","email"],"additionalProperties":false}}},"required":["volumeHistory"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns outbound message counts over the half-open selected instant range, grouped by organization-local calendar day, week, or month.","summary":"Get message volume analytics"}},"/v1/analytics/channel-stats":{"get":{"tags":["Analytics"],"operationId":"analytics.getChannelStats","parameters":[{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"object","properties":{"sent":{"type":"integer","minimum":0},"deliveryRate":{"type":"number"},"uniqueOpenedMessages":{"type":"integer","minimum":0},"openTrackingEligibleDeliveredMessages":{"type":"integer","minimum":0},"uniqueMessageOpenRate":{"type":"number"},"uniqueClickedMessages":{"type":"integer","minimum":0},"clickTrackingEligibleDeliveredMessages":{"type":"integer","minimum":0},"uniqueMessageClickRate":{"type":"number"},"bounceRate":{"type":"number"}},"required":["sent","deliveryRate","uniqueOpenedMessages","openTrackingEligibleDeliveredMessages","uniqueMessageOpenRate","uniqueClickedMessages","clickTrackingEligibleDeliveredMessages","uniqueMessageClickRate","bounceRate"],"additionalProperties":false}},"required":["email"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns aggregate delivery metrics plus unique-message email Open and Click rates over the selected date range. Each engagement rate uses the corresponding tracking-eligible delivered-message cohort; repeated provider observations do not inflate the numerator.","summary":"Get channel performance analytics"}},"/v1/analytics/top-contacts":{"get":{"tags":["Analytics"],"operationId":"analytics.getTopContacts","parameters":[{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"sortBy","in":"query","schema":{"anyOf":[{"type":"string","enum":["sent","received","total"]},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"messageCount":{"type":"integer","minimum":0}},"required":["id","name","email","phone","messageCount"],"additionalProperties":false}}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the contacts with the highest message counts over the selected date range, up to the requested limit.","summary":"List top contacts by message volume"}},"/v1/analytics/hourly-distribution":{"get":{"tags":["Analytics"],"operationId":"analytics.getHourlyDistribution","parameters":[{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"hour":{"type":"string"},"count":{"type":"integer","minimum":0}},"required":["hour","count"],"additionalProperties":false}}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns outbound message counts over the half-open selected instant range, bucketed by organization-local hour. Empty ranges return no rows; non-empty ranges include all 24 hours.","summary":"Get hourly message distribution"}},"/v1/analytics/delivery-metrics":{"get":{"tags":["Analytics"],"operationId":"analytics.getDeliveryMetrics","parameters":[{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"channel","in":"query","schema":{"anyOf":[{"type":"string","enum":["email"]},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"deliveredRate":{"type":"number"},"failedRate":{"type":"number"},"pendingRate":{"type":"number"},"avgDeliveryTimeMs":{"type":"number"}},"required":["deliveredRate","failedRate","pendingRate","avgDeliveryTimeMs"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns delivered, failed, and pending rates plus average delivery time over the selected date range, optionally filtered by channel.","summary":"Get message delivery metrics"}},"/v1/analytics/geographic-distribution":{"get":{"tags":["Analytics"],"operationId":"analytics.getGeographicDistribution","parameters":[{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"country":{"type":"string"},"region":{"type":"string"},"count":{"type":"integer","minimum":0}},"required":["country","region","count"],"additionalProperties":false}}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Samva API operation.","summary":"Get geographic message distribution"}},"/v1/analytics/export":{"post":{"tags":["Analytics"],"operationId":"analytics.exportData","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string"},"mimeType":{"type":"string"},"filename":{"type":"string"}},"required":["content","mimeType","filename"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Exports per-message records for the given date range as CSV or JSON and returns the file content inline.","summary":"Export messaging analytics data","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"startDate":{"type":"string"},"endDate":{"type":"string"},"format":{"anyOf":[{"type":"string","enum":["csv","json"]},{"type":"null"}]},"includeChannels":{"anyOf":[{"type":"array","items":{"type":"string","enum":["email"]}},{"type":"null"}]}},"required":["startDate","endDate"],"additionalProperties":false}}},"required":true}}},"/v1/developers/logs":{"get":{"tags":["Logs"],"operationId":"developers.listLogs","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"apiKeyId","in":"query","schema":{"anyOf":[{"$ref":"#/components/schemas/ApiKeyId"},{"type":"null"}]},"required":false},{"name":"status","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"channel","in":"query","schema":{"anyOf":[{"type":"string","enum":["email"]},{"type":"null"}]},"required":false},{"name":"startDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"endDate","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"search","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"LogListResponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogListResponse"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated log of accepted outbound sends, filterable by API key, delivery status, channel, message id, and date range. Facet counts are included on the first page. Webhook delivery diagnostics are exposed by the dedicated webhook delivery-log API.","summary":"List logs"}},"/v1/developers/logs/{messageId}":{"get":{"tags":["Logs"],"operationId":"developers.getLogEntry","parameters":[{"name":"messageId","in":"path","schema":{"$ref":"#/components/schemas/MessageId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"LogEntryDetail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogEntryDetail"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns one log entry by message id, including the message content, its status history, and the sanitized API request Samva recorded when it accepted the send.","summary":"Get a log entry"}},"/v1/search":{"get":{"tags":["Search"],"operationId":"search.query","parameters":[{"name":"q","in":"query","schema":{"type":"string"},"required":true},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"contacts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"sublabel":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","label","sublabel"],"additionalProperties":false}},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"sublabel":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","label","sublabel"],"additionalProperties":false}},"templates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"sublabel":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","label","sublabel"],"additionalProperties":false}},"domains":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"sublabel":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","label","sublabel"],"additionalProperties":false}}},"required":["contacts","messages","templates","domains"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Searches the organization's contacts, messages, templates, and domains for the command palette and returns matching hits.","summary":"Search across resources"}},"/v1/settings/effective":{"get":{"tags":["Settings"],"operationId":"settings.getEffectiveConfig","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"design":{"type":"object","properties":{"theme":{"type":"object","properties":{"origins":{"type":"array","items":{"type":"string","enum":["base","organization","domain","template","request"]}}},"required":["origins"],"additionalProperties":false},"assets":{"type":"object","properties":{"value":{"type":"object","properties":{"logoUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"logoDarkUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"iconUrl":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false},"origins":{"type":"object","properties":{"logoUrl":{"type":"string","enum":["base","organization","domain","template","request"]},"logoDarkUrl":{"type":"string","enum":["base","organization","domain","template","request"]},"iconUrl":{"type":"string","enum":["base","organization","domain","template","request"]}},"required":["logoUrl","logoDarkUrl","iconUrl"],"additionalProperties":false}},"required":["value","origins"],"additionalProperties":false},"footer":{"type":"object","properties":{"value":{"type":"object","properties":{"companyName":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"street1":{"type":"string"},"street2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"region":{"type":"string"},"postalCode":{"type":"string"},"country":{"type":"string"}},"required":["street1","city","region","postalCode","country"],"additionalProperties":false},{"type":"null"}]},"socialLinks":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"url":{"type":"string"}},"required":["label","url"],"additionalProperties":false}},{"type":"null"}]},"customHtml":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false},"origins":{"type":"object","properties":{"companyName":{"type":"string","enum":["base","organization","domain","template","request"]},"address":{"type":"string","enum":["base","organization","domain","template","request"]},"socialLinks":{"type":"string","enum":["base","organization","domain","template","request"]},"customHtml":{"type":"string","enum":["base","organization","domain","template","request"]}},"required":["companyName","address","socialLinks","customHtml"],"additionalProperties":false}},"required":["value","origins"],"additionalProperties":false}},"required":["theme","assets","footer"],"additionalProperties":false},"tracking":{"type":"object","properties":{"value":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"}},"required":["opens","clicks"],"additionalProperties":false},"origins":{"type":"object","properties":{"opens":{"type":"string","enum":["base","organization","domain","template","request"]},"clicks":{"type":"string","enum":["base","organization","domain","template","request"]}},"required":["opens","clicks"],"additionalProperties":false}},"required":["value","origins"],"additionalProperties":false},"replyTo":{"type":"object","properties":{"value":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"origin":{"type":"string","enum":["base","organization","domain","template","request"]}},"required":["value","origin"],"additionalProperties":false},"unsubscribeGroupId":{"type":"object","properties":{"value":{"anyOf":[{"$ref":"#/components/schemas/UnsubscribeId"},{"type":"null"}]},"origin":{"type":"string","enum":["base","organization","domain","template","request"]}},"required":["value","origin"],"additionalProperties":false},"footerEnabled":{"type":"object","properties":{"value":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"origin":{"type":"string","enum":["base","organization","domain","template","request"]}},"required":["value","origin"],"additionalProperties":false},"footerCompleteness":{"type":"object","properties":{"missingAddress":{"type":"boolean"}},"required":["missingAddress"],"additionalProperties":false}},"required":["design","tracking","replyTo","unsubscribeGroupId","footerEnabled","footerCompleteness"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the organization-scope effective send configuration: design (theme, assets, footer), tracking, reply-to, unsubscribe-group default, and the injected-footer toggle, with the origin each field resolves from.","summary":"Get the organization effective configuration"}},"/v1/settings/domains/{id}/effective":{"get":{"tags":["Settings"],"operationId":"settings.getDomainEffectiveConfig","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"design":{"type":"object","properties":{"theme":{"type":"object","properties":{"origins":{"type":"array","items":{"type":"string","enum":["base","organization","domain","template","request"]}}},"required":["origins"],"additionalProperties":false},"assets":{"type":"object","properties":{"value":{"type":"object","properties":{"logoUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"logoDarkUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"iconUrl":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false},"origins":{"type":"object","properties":{"logoUrl":{"type":"string","enum":["base","organization","domain","template","request"]},"logoDarkUrl":{"type":"string","enum":["base","organization","domain","template","request"]},"iconUrl":{"type":"string","enum":["base","organization","domain","template","request"]}},"required":["logoUrl","logoDarkUrl","iconUrl"],"additionalProperties":false}},"required":["value","origins"],"additionalProperties":false},"footer":{"type":"object","properties":{"value":{"type":"object","properties":{"companyName":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"street1":{"type":"string"},"street2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"region":{"type":"string"},"postalCode":{"type":"string"},"country":{"type":"string"}},"required":["street1","city","region","postalCode","country"],"additionalProperties":false},{"type":"null"}]},"socialLinks":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"url":{"type":"string"}},"required":["label","url"],"additionalProperties":false}},{"type":"null"}]},"customHtml":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false},"origins":{"type":"object","properties":{"companyName":{"type":"string","enum":["base","organization","domain","template","request"]},"address":{"type":"string","enum":["base","organization","domain","template","request"]},"socialLinks":{"type":"string","enum":["base","organization","domain","template","request"]},"customHtml":{"type":"string","enum":["base","organization","domain","template","request"]}},"required":["companyName","address","socialLinks","customHtml"],"additionalProperties":false}},"required":["value","origins"],"additionalProperties":false}},"required":["theme","assets","footer"],"additionalProperties":false},"tracking":{"type":"object","properties":{"value":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"}},"required":["opens","clicks"],"additionalProperties":false},"origins":{"type":"object","properties":{"opens":{"type":"string","enum":["base","organization","domain","template","request"]},"clicks":{"type":"string","enum":["base","organization","domain","template","request"]}},"required":["opens","clicks"],"additionalProperties":false}},"required":["value","origins"],"additionalProperties":false},"replyTo":{"type":"object","properties":{"value":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"origin":{"type":"string","enum":["base","organization","domain","template","request"]}},"required":["value","origin"],"additionalProperties":false},"unsubscribeGroupId":{"type":"object","properties":{"value":{"anyOf":[{"$ref":"#/components/schemas/UnsubscribeId"},{"type":"null"}]},"origin":{"type":"string","enum":["base","organization","domain","template","request"]}},"required":["value","origin"],"additionalProperties":false},"footerEnabled":{"type":"object","properties":{"value":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"origin":{"type":"string","enum":["base","organization","domain","template","request"]}},"required":["value","origin"],"additionalProperties":false},"defaultSender":{"type":"object","properties":{"value":{"anyOf":[{"$ref":"#/components/schemas/EmailSenderId"},{"type":"null"}]},"origin":{"type":"string","enum":["base","organization","domain","template","request"]}},"required":["value","origin"],"additionalProperties":false},"footerCompleteness":{"type":"object","properties":{"missingAddress":{"type":"boolean"}},"required":["missingAddress"],"additionalProperties":false}},"required":["design","tracking","replyTo","unsubscribeGroupId","footerEnabled","defaultSender","footerCompleteness"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the domain-scope effective send configuration: the same fields as the organization endpoint plus the resolved default sender, with the origin each field resolves from (domain, organization, or base).","summary":"Get a domain's effective configuration"}},"/v1/billing/overage":{"get":{"tags":["Billing"],"operationId":"billing.getOverageSettings","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"overageSupported":{"type":"boolean"},"includedEmails":{"type":"number"},"usedEmails":{"type":"number"},"extraEmails":{"type":"number"},"extraEmailCostDollars":{"type":"number"},"spendLimitDollars":{"anyOf":[{"type":"number"},{"type":"null"}]},"spendLimitSource":{"type":"string","enum":["workspace","account","plan","none"]},"overageAllowed":{"type":"boolean"},"overageAllowedSource":{"type":"string","enum":["workspace","account","plan","none"]}},"required":["overageSupported","includedEmails","usedEmails","extraEmails","extraEmailCostDollars","spendLimitDollars","spendLimitSource","overageAllowed","overageAllowedSource"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the included email allowance, what has been used, the extra emails billed past it, and the spend limit and pause switch that bound them, each with the level it resolves from.","summary":"Get the workspace's overage usage and limits"},"patch":{"tags":["Billing"],"operationId":"billing.updateOverageSettings","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"overageSupported":{"type":"boolean"},"includedEmails":{"type":"number"},"usedEmails":{"type":"number"},"extraEmails":{"type":"number"},"extraEmailCostDollars":{"type":"number"},"spendLimitDollars":{"anyOf":[{"type":"number"},{"type":"null"}]},"spendLimitSource":{"type":"string","enum":["workspace","account","plan","none"]},"overageAllowed":{"type":"boolean"},"overageAllowedSource":{"type":"string","enum":["workspace","account","plan","none"]}},"required":["overageSupported","includedEmails","usedEmails","extraEmails","extraEmailCostDollars","spendLimitDollars","spendLimitSource","overageAllowed","overageAllowedSource"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Replaces this workspace's spend limit and overage switch. Both are sent together because the underlying write replaces the workspace's controls rather than merging into them.","summary":"Set the workspace's overage limits","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"spendLimitDollars":{"anyOf":[{"type":"number"},{"type":"null"}]},"overageAllowed":{"type":"boolean"}},"required":["spendLimitDollars","overageAllowed"],"additionalProperties":false}}},"required":true}}},"/v1/unsubscribe-groups":{"get":{"tags":["Unsubscribe Groups"],"operationId":"unsubscribe.list","parameters":[{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/UnsubscribeId"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"memberCount":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","memberCount","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of the organization's unsubscribe groups.","summary":"List unsubscribe groups"},"post":{"tags":["Unsubscribe Groups"],"operationId":"unsubscribe.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/UnsubscribeId"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"memberCount":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","memberCount","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Creates a new unsubscribe group and returns it with a 201 Created status.","summary":"Create an unsubscribe group","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]}},"required":["name"],"additionalProperties":false}}},"required":true}}},"/v1/unsubscribe-groups/{id}":{"patch":{"tags":["Unsubscribe Groups"],"operationId":"unsubscribe.update","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/UnsubscribeId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/UnsubscribeId"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"memberCount":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","memberCount","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Updates the name or description of an unsubscribe group.","summary":"Update an unsubscribe group","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"description":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]}},"additionalProperties":false}}},"required":true}},"delete":{"tags":["Unsubscribe Groups"],"operationId":"unsubscribe.remove","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/UnsubscribeId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Permanently deletes an unsubscribe group by its ID.","summary":"Delete an unsubscribe group"}},"/v1/unsubscribe-groups/{groupId}/members":{"post":{"tags":["Unsubscribe Groups"],"operationId":"unsubscribe.addEmails","parameters":[{"name":"groupId","in":"path","schema":{"$ref":"#/components/schemas/UnsubscribeId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"added":{"type":"integer","minimum":0},"skipped":{"type":"integer","minimum":0}},"required":["added","skipped"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Adds one or more email addresses to an unsubscribe group and returns the number added and the number skipped.","summary":"Add contacts to an unsubscribe group","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"emails":{"type":"array","items":{"type":"string"},"minItems":1},"source":{"anyOf":[{"type":"string","enum":["link","api","manual","complaint"]},{"type":"null"}]}},"required":["emails"],"additionalProperties":false}}},"required":true}},"delete":{"tags":["Unsubscribe Groups"],"operationId":"unsubscribe.removeEmails","parameters":[{"name":"groupId","in":"path","schema":{"$ref":"#/components/schemas/UnsubscribeId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"removed":{"type":"integer","minimum":0}},"required":["removed"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Removes one or more email addresses from an unsubscribe group and returns the number removed.","summary":"Remove contacts from an unsubscribe group","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"emails":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["emails"],"additionalProperties":false}}},"required":true}},"get":{"tags":["Unsubscribe Groups"],"operationId":"unsubscribe.listMembers","parameters":[{"name":"groupId","in":"path","schema":{"$ref":"#/components/schemas/UnsubscribeId"},"required":true},{"name":"page","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false},{"name":"limit","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"contactId":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"string","enum":["link","api","manual","complaint"]},"unsubscribedAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","email","contactId","source","unsubscribedAt","createdAt"],"additionalProperties":false}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns a paginated list of the email addresses in an unsubscribe group.","summary":"List unsubscribe group members"}},"/v1/unsubscribe-groups/check":{"get":{"tags":["Unsubscribe Groups"],"operationId":"unsubscribe.checkSubscription","parameters":[{"name":"email","in":"query","schema":{"type":"string"},"required":true},{"name":"groupIds","in":"query","schema":{"anyOf":[{"type":"string"},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"unsubscribedGroups":{"type":"array","items":{"type":"object","properties":{"groupId":{"type":"string"},"groupName":{"type":"string"},"unsubscribedAt":{"type":"string"}},"required":["groupId","groupName","unsubscribedAt"],"additionalProperties":false}}},"required":["email","unsubscribedGroups"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorEncoded"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorEncoded"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorEncoded"}}}}},"description":"Returns the unsubscribe groups that an email address has unsubscribed from, optionally limited to a specified set of groups.","summary":"Check unsubscribe group membership"}}},"components":{"schemas":{"ConversationId":{"type":"string","pattern":"^conv_[0-9a-hjkmnp-tv-z]{16,24}$"},"ContactId":{"type":"string","pattern":"^contact_[0-9a-hjkmnp-tv-z]{16,24}$"},"MessageContact":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":{"type":"string"},"identities":{"type":"array","items":{"type":"object","properties":{"channel":{"type":"string","enum":["email"]},"identifier":{"type":"string"},"verified":{"type":"boolean"}},"required":["channel","identifier","verified"],"additionalProperties":false}}},"required":["id","name","displayName","type","identities"],"additionalProperties":false},"JsonObject":{"type":"object"},"Message":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"type":"string"},"conversationId":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentMessageId":{"anyOf":[{"type":"string"},{"type":"null"}]},"fromActorId":{"type":"string"},"actorMetadata":{"anyOf":[{"type":"object"},{"type":"null"}]},"channel":{"type":"string","enum":["email"]},"direction":{"type":"string","enum":["outbound","inbound"]},"content":{},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}]},"status":{"type":"string","enum":["pending","scheduled","queued","processing","sent","delivered","read","failed","bounced","complained"]},"scheduledAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"categories":{"type":"array","items":{"type":"string"}},"isTest":{"type":"boolean"},"isInternal":{"type":"boolean"},"isAutomated":{"type":"boolean"},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"referenceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"apiKeyId":{"anyOf":[{"type":"string"},{"type":"null"}]},"httpMethod":{"anyOf":[{"type":"string"},{"type":"null"}]},"apiRequestMetadata":{"anyOf":[{},{"type":"null"}]},"apiResponseMetadata":{"anyOf":[{},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"createdBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"fromContact":{"anyOf":[{"$ref":"#/components/schemas/MessageContact"},{"type":"null"}]},"toContacts":{"type":"array","items":{"$ref":"#/components/schemas/MessageContact"}},"recipients":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"messageId":{"type":"string"},"actorId":{"anyOf":[{"type":"string"},{"type":"null"}]},"contactId":{"anyOf":[{"type":"string"},{"type":"null"}]},"identityId":{"anyOf":[{"type":"string"},{"type":"null"}]},"kind":{"type":"string","enum":["to","cc","bcc"]},"address":{"type":"string"},"status":{"type":"string","enum":["pending","scheduled","queued","processing","sent","delivered","read","failed","bounced","complained"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"contact":{"anyOf":[{"$ref":"#/components/schemas/MessageContact"},{"type":"null"}]}},"required":["id","messageId","actorId","contactId","identityId","kind","address","status","createdAt","updatedAt","contact"],"additionalProperties":false}},"deliveries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"messageId":{"type":"string"},"recipientId":{"anyOf":[{"type":"string"},{"type":"null"}]},"channel":{"type":"string","enum":["email"]},"status":{"type":"string","enum":["pending","scheduled","queued","processing","sent","delivered","read","failed","bounced","complained"]},"attemptCount":{"type":"number"},"maxAttempts":{"type":"number"},"queuedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"claimedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastAttemptAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"nextRetryAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"sentAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"deliveredAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"readAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"failedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"terminalAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"errorCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"errorMessage":{"anyOf":[{"type":"string"},{"type":"null"}]},"errorDetails":{"anyOf":[{},{"type":"null"}]},"cost":{"type":"string"},"currency":{"type":"string"},"idempotencyKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"metadata":{"anyOf":[{},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","messageId","recipientId","channel","status","attemptCount","maxAttempts","queuedAt","claimedAt","lastAttemptAt","nextRetryAt","sentAt","deliveredAt","readAt","failedAt","terminalAt","errorCode","errorMessage","errorDetails","cost","currency","idempotencyKey","metadata","createdAt","updatedAt"],"additionalProperties":false}},"emailDeliveryDetails":{"type":"array","items":{"type":"object","properties":{"deliveryId":{"type":"string"},"messageIdHeader":{"anyOf":[{"type":"string"},{"type":"null"}]},"inReplyTo":{"anyOf":[{"type":"string"},{"type":"null"}]},"references":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"subject":{"type":"string"},"fromEmail":{"type":"string"},"fromName":{"anyOf":[{"type":"string"},{"type":"null"}]},"toEmails":{"type":"array","items":{"type":"string"}},"toName":{"anyOf":[{"type":"string"},{"type":"null"}]},"ccEmails":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"bccEmails":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"replyToEmails":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"hasAttachments":{"type":"boolean"},"attachmentCount":{"type":"number"},"listUnsubscribeUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"listUnsubscribeEmail":{"anyOf":[{"type":"string"},{"type":"null"}]},"threadPosition":{"anyOf":[{"type":"number"},{"type":"null"}]},"newContent":{"anyOf":[{"type":"string"},{"type":"null"}]},"quotedContent":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasQuotedContent":{"type":"boolean"},"dkimVerdict":{"anyOf":[{"type":"string"},{"type":"null"}]},"spfVerdict":{"anyOf":[{"type":"string"},{"type":"null"}]},"dmarcVerdict":{"anyOf":[{"type":"string"},{"type":"null"}]},"isAutoReply":{"type":"boolean"},"autoReplyReason":{"anyOf":[{"type":"string","enum":["out-of-office","auto-response","delivery-status","read-receipt"]},{"type":"null"}]},"priority":{"anyOf":[{"type":"string"},{"type":"null"}]},"parsingErrors":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"parsingDuration":{"anyOf":[{"type":"number"},{"type":"null"}]},"receivedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"processedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["deliveryId","messageIdHeader","inReplyTo","references","subject","fromEmail","fromName","toEmails","toName","ccEmails","bccEmails","replyToEmails","hasAttachments","attachmentCount","listUnsubscribeUrl","listUnsubscribeEmail","threadPosition","newContent","quotedContent","hasQuotedContent","dkimVerdict","spfVerdict","dmarcVerdict","isAutoReply","autoReplyReason","priority","parsingErrors","parsingDuration","receivedAt","processedAt","createdAt","updatedAt"],"additionalProperties":false}}},"required":["id","organizationId","conversationId","parentMessageId","fromActorId","actorMetadata","channel","direction","content","metadata","status","scheduledAt","tags","categories","isTest","isInternal","isAutomated","externalId","referenceId","apiKeyId","httpMethod","apiRequestMetadata","apiResponseMetadata","createdAt","updatedAt","createdBy","fromContact","toContacts","recipients","deliveries","emailDeliveryDetails"],"additionalProperties":false},"PaginationMeta":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false},"InternalErrorEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["InternalError"]},"operation":{"type":"string"},"message":{"type":"string"}},"required":["_tag","operation","message"],"additionalProperties":false},"ForbiddenErrorEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["ForbiddenError"]},"operation":{"type":"string"},"message":{"type":"string"}},"required":["_tag","operation","message"],"additionalProperties":false},"UnauthorizedErrorEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["UnauthorizedError"]},"operation":{"type":"string"},"message":{"type":"string"}},"required":["_tag","operation","message"],"additionalProperties":false},"MessageId":{"type":"string","pattern":"^msg_[0-9a-hjkmnp-tv-z]{16,24}$"},"ResourceNotFoundErrorEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["ResourceNotFoundError"]},"operation":{"type":"string"},"resource":{"type":"string"},"id":{"type":"string"}},"required":["_tag","operation","resource","id"],"additionalProperties":false},"EmailAddress":{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","name"],"additionalProperties":false},"AttachmentId":{"type":"string","pattern":"^att_[0-9a-hjkmnp-tv-z]{16,24}$"},"MessageMetadata":{"anyOf":[{"type":"object"},{"type":"null"}]},"EmailRecipient":{"anyOf":[{"type":"object","properties":{"contactId":{"$ref":"#/components/schemas/ContactId"}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayName":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]}},"required":["email"],"additionalProperties":false}]},"EmailRecipients":{"type":"array","items":{"$ref":"#/components/schemas/EmailRecipient"},"minItems":1},"EmailCcRecipients":{"anyOf":[{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/EmailRecipient"}},{"type":"null"}]},{"type":"null"}]},"EmailBccRecipients":{"anyOf":[{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/EmailRecipient"}},{"type":"null"}]},{"type":"null"}]},"EmailSender":{"anyOf":[{"type":"object","properties":{"email":{"type":"string","minLength":1},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email"],"additionalProperties":false},{"type":"null"}]},"MediaId":{"type":"string","pattern":"^media_[0-9a-hjkmnp-tv-z]{16,24}$"},"EmailAttachment":{"type":"object","properties":{"filename":{"type":"string"},"content":{"anyOf":[{"type":"string","pattern":"^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$"},{"type":"null"}]},"mediaId":{"anyOf":[{"$ref":"#/components/schemas/MediaId"},{"type":"null"}]},"contentType":{"type":"string"},"size":{"type":"integer","exclusiveMinimum":0,"maximum":26214400}},"required":["filename","contentType","size"],"additionalProperties":false},"EmailAttachments":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/EmailAttachment"},"maxItems":10},{"type":"null"}]},"TemplateId":{"type":"string","pattern":"^tmpl_[0-9a-hjkmnp-tv-z]{16,24}$"},"TemplateData":{"anyOf":[{"$ref":"#/components/schemas/JsonObject"},{"type":"null"}]},"ReplyToAddresses":{"anyOf":[{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},{"type":"null"}]},"UnsubscribeId":{"type":"string","pattern":"^unsub_[0-9a-hjkmnp-tv-z]{16,24}$"},"EmailTrackingOverrideV1":{"type":"object","properties":{"opens":{"type":"boolean","description":"Override open tracking for this send. Omit to inherit the organization default. A recipient tracking opt-out always disables tracking."},"clicks":{"type":"boolean","description":"Override click tracking for this send. Omit to inherit the organization default. A recipient tracking opt-out always disables tracking."}},"additionalProperties":false,"description":"Requested per-send engagement tracking policy. Recipient opt-out takes precedence, then explicit fields, organization defaults, and product defaults."},"EmailFooterOverride":{"type":"object","properties":{"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}]}},"additionalProperties":false},"EmailContent":{"type":"object","properties":{"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"attachments":{"$ref":"#/components/schemas/EmailAttachments"},"templateId":{"anyOf":[{"$ref":"#/components/schemas/TemplateId"},{"type":"null"}]},"templateSlug":{"anyOf":[{"type":"string","pattern":"^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$"},{"type":"null"}]},"templateData":{"$ref":"#/components/schemas/TemplateData"},"inReplyToMessageId":{"anyOf":[{"$ref":"#/components/schemas/MessageId"},{"type":"null"}]},"replyTo":{"$ref":"#/components/schemas/ReplyToAddresses"},"unsubscribeGroupId":{"anyOf":[{"$ref":"#/components/schemas/UnsubscribeId"},{"type":"null"}]},"tracking":{"$ref":"#/components/schemas/EmailTrackingOverrideV1"},"footer":{"$ref":"#/components/schemas/EmailFooterOverride"}},"additionalProperties":false},"EmailSendMessagePayload":{"type":"object","properties":{"conversationId":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]},{"type":"null"}]},"metadata":{"$ref":"#/components/schemas/MessageMetadata"},"channel":{"type":"string","enum":["email"]},"to":{"$ref":"#/components/schemas/EmailRecipients"},"cc":{"$ref":"#/components/schemas/EmailCcRecipients"},"bcc":{"$ref":"#/components/schemas/EmailBccRecipients"},"from":{"$ref":"#/components/schemas/EmailSender"},"email":{"$ref":"#/components/schemas/EmailContent"}},"required":["channel","to","email"],"additionalProperties":false},"SendMessagePayload":{"anyOf":[{"$ref":"#/components/schemas/EmailSendMessagePayload"}]},"ConflictErrorEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["ConflictError"]},"operation":{"type":"string"},"message":{"type":"string"},"resource":{"type":"string"},"id":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["_tag","operation","message","resource"],"additionalProperties":false},"RateLimitedErrorEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["RateLimitedError"]},"operation":{"type":"string"},"retryAfterSeconds":{"type":"number"}},"required":["_tag","operation","retryAfterSeconds"],"additionalProperties":false},"PaymentRequiredErrorEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["PaymentRequiredError"]},"operation":{"type":"string"},"resource":{"type":"string"},"currentUsage":{"type":"number"},"limit":{"type":"number"}},"required":["_tag","operation","resource","currentUsage","limit"],"additionalProperties":false},"BillingProviderErrorEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["BillingProviderError"]},"operation":{"type":"string"},"message":{"type":"string"}},"required":["_tag","operation","message"],"additionalProperties":false},"ExternalServiceErrorEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["ExternalServiceError"]},"operation":{"type":"string"},"message":{"type":"string"}},"required":["_tag","operation","message"],"additionalProperties":false},"ValidationErrorEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["ValidationError"]},"operation":{"type":"string"},"message":{"type":"string"},"fields":{"anyOf":[{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},{"type":"null"}]}},"required":["_tag","operation","message"],"additionalProperties":false},"FlagDisabledErrorEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["FlagDisabledError"]},"operation":{"type":"string"},"flag":{"type":"string"}},"required":["_tag","operation","flag"],"additionalProperties":false},"WebhookEnqueueErrorEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["WebhookEnqueueError"]},"operation":{"type":"string"},"reason":{"type":"string"},"details":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["_tag","operation","reason"],"additionalProperties":false},"MessageEventId":{"type":"string","pattern":"^mevt_[0-9a-hjkmnp-tv-z]{16,24}$"},"EmailDispatchContent":{"type":"object","properties":{"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"attachments":{"$ref":"#/components/schemas/EmailAttachments"},"templateId":{"anyOf":[{"$ref":"#/components/schemas/TemplateId"},{"type":"null"}]},"templateSlug":{"anyOf":[{"type":"string","pattern":"^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$"},{"type":"null"}]},"templateData":{"$ref":"#/components/schemas/TemplateData"},"inReplyToMessageId":{"anyOf":[{"$ref":"#/components/schemas/MessageId"},{"type":"null"}]},"replyTo":{"$ref":"#/components/schemas/ReplyToAddresses"},"unsubscribeGroupId":{"anyOf":[{"$ref":"#/components/schemas/UnsubscribeId"},{"type":"null"}]},"tracking":{"$ref":"#/components/schemas/EmailTrackingOverrideV1"},"footer":{"$ref":"#/components/schemas/EmailFooterOverride"}},"additionalProperties":false},"EmailDispatchSendMessagePayload":{"type":"object","properties":{"conversationId":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]},{"type":"null"}]},"metadata":{"$ref":"#/components/schemas/MessageMetadata"},"channel":{"type":"string","enum":["email"]},"to":{"$ref":"#/components/schemas/EmailRecipients"},"cc":{"$ref":"#/components/schemas/EmailCcRecipients"},"bcc":{"$ref":"#/components/schemas/EmailBccRecipients"},"from":{"$ref":"#/components/schemas/EmailSender"},"email":{"$ref":"#/components/schemas/EmailDispatchContent"}},"required":["channel","to","email"],"additionalProperties":false},"DispatchSendMessagePayload":{"anyOf":[{"$ref":"#/components/schemas/EmailDispatchSendMessagePayload"}]},"AbsoluteInstantEncoded":{"type":"string","pattern":"^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d{1,9}))?)?(Z|([+-])(\\d{2}):(\\d{2}))$"},"ScheduledMessageId":{"type":"string","pattern":"^sched_[0-9a-hjkmnp-tv-z]{16,24}$"},"ScheduledMessage":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/ScheduledMessageId"},"status":{"type":"string","enum":["pending","dispatching","dispatched","cancelled","failed"]},"scheduledFor":{"type":"string"},"timezone":{"type":"string"},"send":{"$ref":"#/components/schemas/SendMessagePayload"},"messageId":{"anyOf":[{"$ref":"#/components/schemas/MessageId"},{"type":"null"}]},"idempotencyKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"referenceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"failureReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"attempts":{"type":"number"},"createdBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"actorEmail":{"type":"string"},"memberRole":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","status","scheduledFor","timezone","send","messageId","idempotencyKey","referenceId","failureReason","attempts","createdBy","actorEmail","memberRole","createdAt","updatedAt"],"additionalProperties":false},"CampaignConversationRef":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]},{"type":"null"}]},"CampaignContentMetadata":{"anyOf":[{"type":"object"},{"type":"null"}]},"EmailCampaignContentInput":{"type":"object","properties":{"channel":{"type":"string","enum":["email"]},"email":{"$ref":"#/components/schemas/EmailDispatchContent"},"conversationId":{"$ref":"#/components/schemas/CampaignConversationRef"},"metadata":{"$ref":"#/components/schemas/CampaignContentMetadata"}},"required":["channel","email"],"additionalProperties":false},"CampaignContentInput":{"anyOf":[{"$ref":"#/components/schemas/EmailCampaignContentInput"}]},"ContactGroupId":{"type":"string","pattern":"^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$"},"CampaignAudience":{"type":"object","properties":{"includeTags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"excludeTags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"contactIds":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ContactId"},"maxItems":25000},{"type":"null"}]},"groupIds":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ContactGroupId"},"maxItems":100},{"type":"null"}]}},"additionalProperties":false},"CampaignPolicy":{"type":"object","properties":{"unsubscribeGroupId":{"anyOf":[{"$ref":"#/components/schemas/UnsubscribeId"},{"type":"null"}]},"pageSize":{"anyOf":[{"type":"integer","minimum":100,"maximum":1000},{"type":"null"}]}},"additionalProperties":false},"CampaignId":{"type":"string","pattern":"^camp_[0-9a-hjkmnp-tv-z]{16,24}$"},"EmailCampaignContent":{"type":"object","properties":{"channel":{"type":"string","enum":["email"]},"email":{"$ref":"#/components/schemas/EmailContent"},"conversationId":{"$ref":"#/components/schemas/CampaignConversationRef"},"metadata":{"$ref":"#/components/schemas/CampaignContentMetadata"}},"required":["channel","email"],"additionalProperties":false},"CampaignContent":{"anyOf":[{"$ref":"#/components/schemas/EmailCampaignContent"}]},"CampaignDefinitionSummary":{"type":"object","properties":{"state":{"type":"string","enum":["editable","frozen","archived"]},"frozenAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["state","frozenAt"],"additionalProperties":false},"CampaignRunId":{"type":"string","pattern":"^crun_[0-9a-hjkmnp-tv-z]{16,24}$"},"CampaignLatestRun":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/CampaignRunId"},"status":{"type":"string","enum":["scheduled","resolving","dispatching","paused","completed","cancelled","failed"]},"scheduledFor":{"type":"string"},"completedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"totalRecipients":{"type":"number"},"dispatchedCount":{"type":"number"},"failedCount":{"type":"number"},"skippedCount":{"type":"number"}},"required":["id","status","scheduledFor","completedAt","totalRecipients","dispatchedCount","failedCount","skippedCount"],"additionalProperties":false},"Campaign":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/CampaignId"},"name":{"type":"string"},"channel":{"type":"string","enum":["email"]},"content":{"$ref":"#/components/schemas/CampaignContent"},"audience":{"$ref":"#/components/schemas/CampaignAudience"},"policy":{"$ref":"#/components/schemas/CampaignPolicy"},"definition":{"$ref":"#/components/schemas/CampaignDefinitionSummary"},"latestRun":{"anyOf":[{"$ref":"#/components/schemas/CampaignLatestRun"},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"actorEmail":{"type":"string"},"memberRole":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","channel","content","audience","policy","definition","latestRun","createdBy","actorEmail","memberRole","createdAt","updatedAt"],"additionalProperties":false},"CampaignRun":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/CampaignRunId"},"campaignId":{"$ref":"#/components/schemas/CampaignId"},"status":{"type":"string","enum":["scheduled","resolving","dispatching","paused","completed","cancelled","failed"]},"scheduledFor":{"type":"string"},"idempotencyKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"startedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"completedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"contentSnapshot":{"$ref":"#/components/schemas/CampaignContent"},"audienceSnapshot":{"$ref":"#/components/schemas/CampaignAudience"},"policySnapshot":{"$ref":"#/components/schemas/CampaignPolicy"},"totalRecipients":{"type":"number"},"dispatchedCount":{"type":"number"},"failedCount":{"type":"number"},"skippedCount":{"type":"number"},"failureReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastContactId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"actorEmail":{"type":"string"},"memberRole":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","campaignId","status","scheduledFor","idempotencyKey","startedAt","completedAt","contentSnapshot","audienceSnapshot","policySnapshot","totalRecipients","dispatchedCount","failedCount","skippedCount","failureReason","lastContactId","createdBy","actorEmail","memberRole","createdAt","updatedAt"],"additionalProperties":false},"CampaignRunAction":{"type":"object","properties":{"success":{"type":"boolean"},"item":{"$ref":"#/components/schemas/CampaignRun"}},"required":["success","item"],"additionalProperties":false},"CampaignRecipientId":{"type":"string","pattern":"^crcpt_[0-9a-hjkmnp-tv-z]{16,24}$"},"EmailTrackingDefaults":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"}},"required":["opens","clicks"],"additionalProperties":false},"TrackingRecipientEmail":{"type":"string","pattern":"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$"},"EmailRecipientTrackingPreference":{"type":"object","properties":{"email":{"$ref":"#/components/schemas/TrackingRecipientEmail"},"optedOut":{"type":"boolean"},"trackingOptedOutAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","optedOut","trackingOptedOutAt","createdAt","updatedAt"],"additionalProperties":false},"EmailDomainId":{"type":"string","pattern":"^dom_[0-9a-hjkmnp-tv-z]{16,24}$"},"EmailSenderId":{"type":"string","pattern":"^sender_[0-9a-hjkmnp-tv-z]{16,24}$"},"DeliverabilityFacts":{"type":"object","properties":{"bounceRate":{"type":"number","minimum":0,"maximum":1},"complaintRate":{"type":"number","minimum":0,"maximum":1},"sendingStatus":{"type":"string","enum":["enabled","disabled","reinstated","unknown"]}},"required":["bounceRate","complaintRate","sendingStatus"],"additionalProperties":false},"EmailDomain":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/EmailDomainId"},"domain":{"type":"string"},"phase":{"type":"string","enum":["dns-setup","provider-setup","provider-verification","ready","degraded","failed"]},"dkimSelector":{"anyOf":[{"type":"string"},{"type":"null"}]},"dkimPublicKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"dnsRecords":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"name":{"type":"string"},"value":{"type":"string"},"ttl":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"priority":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}]}},"required":["type","name","value"],"additionalProperties":false}},"verifiedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"isDefault":{"type":"boolean"},"defaultSenderId":{"anyOf":[{"$ref":"#/components/schemas/EmailSenderId"},{"type":"null"}]},"deliverability":{"$ref":"#/components/schemas/DeliverabilityFacts"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","domain","phase","dnsRecords","verifiedAt","isDefault","defaultSenderId","deliverability","createdAt","updatedAt"],"additionalProperties":false},"EmailChannelErrorEncoded":{"type":"object","properties":{"_tag":{"type":"string","enum":["EmailChannelError"]},"operation":{"type":"string"},"reason":{"type":"string","enum":["transport","rejected","rate_limited","auth"]},"message":{"type":"string"},"statusCode":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["_tag","operation","reason","message"],"additionalProperties":false},"OperationId":{"type":"string","pattern":"^op_[0-9a-hjkmnp-tv-z]{16,24}$"},"EmailDomainVerification":{"type":"object","properties":{"domainId":{"$ref":"#/components/schemas/EmailDomainId"},"domain":{"type":"string"},"phase":{"type":"string","enum":["dns-setup","provider-setup","provider-verification","ready","degraded","failed"]},"records":{"type":"array","items":{"type":"object","properties":{"record":{"type":"object","properties":{"type":{"type":"string","enum":["A","AAAA","CNAME","MX","NS","SOA","PTR","SRV","TXT","CAA"]},"name":{"type":"string"},"value":{"type":"string"},"ttl":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"priority":{"anyOf":[{"type":"integer"},{"type":"null"}]}},"required":["type","name","value"],"additionalProperties":false},"status":{"type":"string","enum":["unchecked","missing","mismatch","found"]},"observedValues":{"type":"array","items":{"type":"string"}},"checkedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"resolutionFailure":{"anyOf":[{"type":"object","properties":{"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"message":{"type":"string"}},"required":["message"],"additionalProperties":false},{"type":"null"}]}},"required":["record","status","observedValues"],"additionalProperties":false}},"provider":{"anyOf":[{"type":"object","properties":{"identity":{"type":"string","enum":["pending","verified","failed","unknown"]},"dkim":{"anyOf":[{"type":"string","enum":["pending","verified","failed","unknown"]},{"type":"null"}]},"mailFrom":{"anyOf":[{"type":"string","enum":["pending","verified","failed","unknown"]},{"type":"null"}]}},"required":["identity"],"additionalProperties":false},{"type":"null"}]},"operationId":{"anyOf":[{"$ref":"#/components/schemas/OperationId"},{"type":"null"}]},"checkedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"nextCheckAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"failure":{"anyOf":[{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"failedAt":{"type":"string"}},"required":["code","message","failedAt"],"additionalProperties":false},{"type":"null"}]}},"required":["domainId","domain","phase","records","provider","operationId","checkedAt","nextCheckAt","failure"],"additionalProperties":false},"DomainConnectEligibility":{"anyOf":[{"type":"object","properties":{"eligible":{"type":"boolean","enum":[false]},"reason":{"type":"string","enum":["no-record","no-settings","no-sync","no-template","unavailable"]}},"required":["eligible","reason"],"additionalProperties":false},{"type":"object","properties":{"eligible":{"type":"boolean","enum":[true]},"providerName":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["eligible"],"additionalProperties":false}]},"DomainConnectApplyUrlResult":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"],"additionalProperties":false},"DomainConnectCompleteResult":{"type":"object","properties":{"status":{"type":"string","enum":["applied","cancelled","invalid"]}},"required":["status"],"additionalProperties":false},"SuccessResult":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"],"additionalProperties":false},"WebhookEndpointId":{"type":"string","pattern":"^wep_[0-9a-hjkmnp-tv-z]{16,24}$"},"CustomTrackingDnsRecord":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"value":{"type":"string"}},"required":["name","type","value"],"additionalProperties":false},"CustomTrackingStatus":{"type":"object","properties":{"enabled":{"type":"boolean"},"customTracking":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["pending","caa-blocked","active","teardown-scheduled","disabled"]},"label":{"type":"string"},"hostname":{"type":"string"},"region":{"type":"string"},"sslStatus":{"anyOf":[{"type":"string"},{"type":"null"}]},"dnsRecords":{"type":"object","properties":{"tracking":{"anyOf":[{"$ref":"#/components/schemas/CustomTrackingDnsRecord"},{"type":"null"}]},"dcvDelegation":{"anyOf":[{"$ref":"#/components/schemas/CustomTrackingDnsRecord"},{"type":"null"}]}},"required":["tracking","dcvDelegation"],"additionalProperties":false},"caaBlocked":{"type":"boolean"},"verificationErrors":{"type":"array","items":{"type":"string"}},"teardownScheduledAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["status","label","hostname","region","sslStatus","dnsRecords","caaBlocked","verificationErrors","teardownScheduledAt"],"additionalProperties":false},{"type":"null"}]}},"required":["enabled","customTracking"],"additionalProperties":false},"CustomTrackingDomainConnectCompleteResult":{"type":"object","properties":{"status":{"type":"string","enum":["applied","cancelled","stale","invalid"]}},"required":["status"],"additionalProperties":false},"SuppressionId":{"type":"string","pattern":"^supp_[0-9a-hjkmnp-tv-z]{16,24}$"},"SuppressionEntry":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/SuppressionId"},"email":{"type":"string"},"type":{"type":"string","enum":["bounce","complaint","unsubscribe","manual"]},"bounceType":{"anyOf":[{"type":"string"},{"type":"null"}]},"bounceSubType":{"anyOf":[{"type":"string"},{"type":"null"}]},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"messageId":{"anyOf":[{"$ref":"#/components/schemas/MessageId"},{"type":"null"}]},"isActive":{"type":"boolean"},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","email","type","bounceType","bounceSubType","reason","messageId","isActive","expiresAt","createdAt"],"additionalProperties":false},"BlockedEmailId":{"type":"string","pattern":"^blk_[0-9a-hjkmnp-tv-z]{16,24}$"},"BlockedEmailLogId":{"type":"string","pattern":"^blklog_[0-9a-hjkmnp-tv-z]{16,24}$"},"ForwardingConditions":{"type":"object","properties":{"subjectContains":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"fromContains":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"hasAttachments":{"anyOf":[{"type":"boolean"},{"type":"null"}]}},"additionalProperties":false},"EmailForwardingRuleId":{"type":"string","pattern":"^fwd_[0-9a-hjkmnp-tv-z]{16,24}$"},"OrganizationId":{"type":"string","pattern":"^org_[0-9a-hjkmnp-tv-z]{16,24}$"},"UnknownRecord":{"type":"object"},"ConversationMetadata":{"type":"object","properties":{"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"customFields":{"anyOf":[{"$ref":"#/components/schemas/UnknownRecord"},{"type":"null"}]}},"additionalProperties":false},"ActorId":{"type":"string","pattern":"^actor_[0-9a-hjkmnp-tv-z]{16,24}$"},"ActorTracking":{"type":"object","properties":{"allActorIds":{"type":"array","items":{"$ref":"#/components/schemas/ActorId"}},"activeActorIds":{"type":"array","items":{"$ref":"#/components/schemas/ActorId"}},"actorHistory":{"type":"array","items":{"type":"object","properties":{"actorId":{"$ref":"#/components/schemas/ActorId"},"actorType":{"type":"string","enum":["contact","system","sender_identity","agent","user"]},"joinedAt":{"type":"string"},"leftAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"type":"string","enum":["initiator","responder","observer"]},"addedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorId"},{"type":"null"}]},"removedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorId"},{"type":"null"}]},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["actorId","actorType","joinedAt","role"],"additionalProperties":false}},"primaryActorIds":{"type":"array","items":{"$ref":"#/components/schemas/ActorId"}}},"required":["allActorIds","activeActorIds","actorHistory","primaryActorIds"],"additionalProperties":false},"ConversationMetrics":{"type":"object","properties":{"messageCount":{"type":"integer","minimum":0},"messagesFromHuman":{"type":"integer","minimum":0},"totalActors":{"type":"integer","minimum":0},"contactCount":{"type":"integer","minimum":0},"channelSwitches":{"type":"integer","minimum":0},"channelDistribution":{"type":"object","additionalProperties":{"type":"integer","minimum":0}}},"required":["messageCount","messagesFromHuman","totalActors","contactCount","channelSwitches","channelDistribution"],"additionalProperties":false},"ConversationContext":{"type":"object","properties":{"customerData":{"anyOf":[{"$ref":"#/components/schemas/UnknownRecord"},{"type":"null"}]},"previousConversations":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"sessionVariables":{"anyOf":[{"$ref":"#/components/schemas/UnknownRecord"},{"type":"null"}]},"workflowState":{"anyOf":[{"type":"object","properties":{"currentStep":{"anyOf":[{"type":"string"},{"type":"null"}]},"completedSteps":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"pendingSteps":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"workflowData":{"anyOf":[{"$ref":"#/components/schemas/UnknownRecord"},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false},"Conversation":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/ConversationId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentConversationId":{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]},"channels":{"type":"array","items":{"type":"string","enum":["email"]}},"primaryChannel":{"type":"string","enum":["email"]},"status":{"type":"string","enum":["active","waiting","resolved","escalated","archived"]},"statusReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"priority":{"type":"integer","minimum":0},"urgency":{"type":"string","enum":["low","medium","high","critical"]},"complexity":{"type":"string","enum":["simple","moderate","complex"]},"metadata":{"anyOf":[{"$ref":"#/components/schemas/ConversationMetadata"},{"type":"null"}]},"actorTracking":{"$ref":"#/components/schemas/ActorTracking"},"metrics":{"$ref":"#/components/schemas/ConversationMetrics"},"context":{"anyOf":[{"$ref":"#/components/schemas/ConversationContext"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"categories":{"type":"array","items":{"type":"string"}},"isTest":{"type":"boolean"},"isInternal":{"type":"boolean"},"isPrivate":{"type":"boolean"},"startedAt":{"type":"string"},"lastActivityAt":{"type":"string"},"lastHumanActivityAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"resolvedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"archivedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"resolvedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorId"},{"type":"null"}]},"resolutionType":{"anyOf":[{"type":"string","enum":["automated","human_assisted","escalated","abandoned","timeout"]},{"type":"null"}]},"resolutionNotes":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"createdBy":{"anyOf":[{"$ref":"#/components/schemas/ActorId"},{"type":"null"}]}},"required":["id","organizationId","title","description","externalId","parentConversationId","channels","primaryChannel","status","statusReason","priority","urgency","complexity","metadata","actorTracking","metrics","context","tags","categories","isTest","isInternal","isPrivate","startedAt","lastActivityAt","lastHumanActivityAt","resolvedAt","archivedAt","resolvedBy","resolutionType","resolutionNotes","createdAt","updatedAt","createdBy"],"additionalProperties":false},"ConversationParticipant":{"type":"object","properties":{"actorId":{"$ref":"#/components/schemas/ActorId"},"actorType":{"type":"string","enum":["contact","system","sender_identity","agent","user"]},"contact":{"$ref":"#/components/schemas/MessageContact"}},"required":["actorId","actorType","contact"],"additionalProperties":false},"ConversationDetail":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/ConversationId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentConversationId":{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]},"channels":{"type":"array","items":{"type":"string","enum":["email"]}},"primaryChannel":{"type":"string","enum":["email"]},"status":{"type":"string","enum":["active","waiting","resolved","escalated","archived"]},"statusReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"priority":{"type":"integer","minimum":0},"urgency":{"type":"string","enum":["low","medium","high","critical"]},"complexity":{"type":"string","enum":["simple","moderate","complex"]},"metadata":{"anyOf":[{"$ref":"#/components/schemas/ConversationMetadata"},{"type":"null"}]},"actorTracking":{"$ref":"#/components/schemas/ActorTracking"},"metrics":{"$ref":"#/components/schemas/ConversationMetrics"},"context":{"anyOf":[{"$ref":"#/components/schemas/ConversationContext"},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"categories":{"type":"array","items":{"type":"string"}},"isTest":{"type":"boolean"},"isInternal":{"type":"boolean"},"isPrivate":{"type":"boolean"},"startedAt":{"type":"string"},"lastActivityAt":{"type":"string"},"lastHumanActivityAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"resolvedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"archivedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"resolvedBy":{"anyOf":[{"$ref":"#/components/schemas/ActorId"},{"type":"null"}]},"resolutionType":{"anyOf":[{"type":"string","enum":["automated","human_assisted","escalated","abandoned","timeout"]},{"type":"null"}]},"resolutionNotes":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"createdBy":{"anyOf":[{"$ref":"#/components/schemas/ActorId"},{"type":"null"}]},"participants":{"type":"array","items":{"$ref":"#/components/schemas/ConversationParticipant"}}},"required":["id","organizationId","title","description","externalId","parentConversationId","channels","primaryChannel","status","statusReason","priority","urgency","complexity","metadata","actorTracking","metrics","context","tags","categories","isTest","isInternal","isPrivate","startedAt","lastActivityAt","lastHumanActivityAt","resolvedAt","archivedAt","resolvedBy","resolutionType","resolutionNotes","createdAt","updatedAt","createdBy","participants"],"additionalProperties":false},"ConversationContacts":{"type":"object","properties":{"contactIds":{"type":"array","prefixItems":[{"$ref":"#/components/schemas/ContactId"}],"minItems":1,"items":{"$ref":"#/components/schemas/ContactId"}}},"required":["contactIds"],"additionalProperties":false},"ContactIdentity":{"type":"object","properties":{"channel":{"type":"string","enum":["email"]},"identifier":{"type":"string"},"verified":{"type":"boolean"}},"required":["channel","identifier","verified"],"additionalProperties":false},"HumanProfile":{"type":"object","properties":{"firstName":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastName":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"company":{"anyOf":[{"type":"string"},{"type":"null"}]},"jobTitle":{"anyOf":[{"type":"string"},{"type":"null"}]},"location":{"anyOf":[{"type":"object","properties":{"country":{"type":"string"},"state":{"type":"string"},"city":{"type":"string"},"timezone":{"type":"string"}},"required":["country","state","city","timezone"],"additionalProperties":false},{"type":"null"}]},"customFields":{"anyOf":[{"$ref":"#/components/schemas/UnknownRecord"},{"type":"null"}]},"source":{"anyOf":[{"type":"string","enum":["api","import","manual","form"]},{"type":"null"}]},"sourceDetails":{"anyOf":[{"$ref":"#/components/schemas/UnknownRecord"},{"type":"null"}]}},"additionalProperties":false},"ContactAccessConfig":{"type":"object","properties":{"paymentRequired":{"anyOf":[{"type":"object","properties":{"amount":{"type":"number","exclusiveMinimum":0},"currency":{"type":"string"},"validityHours":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}]},"message":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["amount","currency"],"additionalProperties":false},{"type":"null"}]},"rateLimit":{"anyOf":[{"type":"object","properties":{"messagesPerHour":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}]},"messagesPerDay":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}]},"cooldownMinutes":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]},"allowedContacts":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ContactId"}},{"type":"null"}]},"blockedContacts":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ContactId"}},{"type":"null"}]},"availability":{"anyOf":[{"type":"object","properties":{"timezone":{"type":"string"},"schedule":{"type":"array","items":{"type":"object","properties":{"days":{"type":"array","items":{"type":"integer","minimum":0,"maximum":6}},"startTime":{"type":"string"},"endTime":{"type":"string"}},"required":["days","startTime","endTime"],"additionalProperties":false}},"outOfOfficeMessage":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["timezone","schedule"],"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false},"ContactPreferences":{"type":"object","properties":{"preferredChannels":{"anyOf":[{"type":"array","items":{"type":"string","enum":["email"]}},{"type":"null"}]},"language":{"anyOf":[{"type":"string"},{"type":"null"}]},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}]},"notifications":{"anyOf":[{"type":"object","properties":{"email":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"quiet_hours":{"anyOf":[{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}},"required":["start","end"],"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]},"messageFormats":{"anyOf":[{"type":"object","properties":{"preferMarkdown":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"preferPlainText":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"maxMessageLength":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false},"ContactActivitySummary":{"type":"object","properties":{"totalInteractions":{"type":"integer","minimum":0},"lastActiveAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["totalInteractions","lastActiveAt"],"additionalProperties":false},"ContactListItem":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/ContactId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"type":{"type":"string","enum":["human","system"]},"name":{"type":"string"},"displayName":{"anyOf":[{"type":"string"},{"type":"null"}]},"avatar":{"anyOf":[{"type":"string"},{"type":"null"}]},"identities":{"type":"array","items":{"$ref":"#/components/schemas/ContactIdentity"}},"humanProfile":{"anyOf":[{"$ref":"#/components/schemas/HumanProfile"},{"type":"null"}]},"capabilities":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"accessLevel":{"type":"string","enum":["public","authenticated","vip","internal"]},"accessConfig":{"anyOf":[{"$ref":"#/components/schemas/ContactAccessConfig"},{"type":"null"}]},"preferences":{"anyOf":[{"$ref":"#/components/schemas/ContactPreferences"},{"type":"null"}]},"status":{"type":"string","enum":["active","paused","blocked","archived"]},"statusReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"metadata":{"anyOf":[{"$ref":"#/components/schemas/JsonObject"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"createdBy":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"lastModifiedBy":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"engagement":{"$ref":"#/components/schemas/ContactActivitySummary"}},"required":["id","organizationId","type","name","displayName","avatar","identities","humanProfile","capabilities","tags","accessLevel","accessConfig","preferences","status","statusReason","externalId","metadata","createdAt","updatedAt","createdBy","lastModifiedBy","engagement"],"additionalProperties":false},"Contact":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/ContactId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"type":{"type":"string","enum":["human","system"]},"name":{"type":"string"},"displayName":{"anyOf":[{"type":"string"},{"type":"null"}]},"avatar":{"anyOf":[{"type":"string"},{"type":"null"}]},"identities":{"type":"array","items":{"$ref":"#/components/schemas/ContactIdentity"}},"humanProfile":{"anyOf":[{"$ref":"#/components/schemas/HumanProfile"},{"type":"null"}]},"capabilities":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"accessLevel":{"type":"string","enum":["public","authenticated","vip","internal"]},"accessConfig":{"anyOf":[{"$ref":"#/components/schemas/ContactAccessConfig"},{"type":"null"}]},"preferences":{"anyOf":[{"$ref":"#/components/schemas/ContactPreferences"},{"type":"null"}]},"status":{"type":"string","enum":["active","paused","blocked","archived"]},"statusReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"metadata":{"anyOf":[{"$ref":"#/components/schemas/JsonObject"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"createdBy":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"lastModifiedBy":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]}},"required":["id","organizationId","type","name","displayName","avatar","identities","humanProfile","capabilities","tags","accessLevel","accessConfig","preferences","status","statusReason","externalId","metadata","createdAt","updatedAt","createdBy","lastModifiedBy"],"additionalProperties":false},"BulkUpdateResult":{"type":"object","properties":{"updated":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0}},"required":["updated","failed"],"additionalProperties":false},"CustomFieldDefinitionId":{"type":"string","pattern":"^cfield_[0-9a-hjkmnp-tv-z]{16,24}$"},"TemplateFamilyId":{"type":"string","pattern":"^tfam_[0-9a-hjkmnp-tv-z]{16,24}$"},"TemplateFromDefault":{"type":"object","properties":{"email":{"type":"string","minLength":1},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email"],"additionalProperties":false},"TemplateVariable":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","array","object"]},"required":{"type":"boolean"},"default":{"anyOf":[{},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"validation":{"anyOf":[{"type":"object","properties":{"pattern":{"anyOf":[{"type":"string"},{"type":"null"}]},"min":{"anyOf":[{"type":"number"},{"type":"null"}]},"max":{"anyOf":[{"type":"number"},{"type":"null"}]},"minLength":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"maxLength":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"enum":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"format":{"anyOf":[{"type":"string","enum":["email","url","date","date-time","uuid"]},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]}},"required":["name","type","required"],"additionalProperties":false},"UserId":{"type":"string","pattern":"^user_[0-9a-hjkmnp-tv-z]{16,24}$"},"TemplateCompliance":{"type":"object","properties":{"metaStatus":{"anyOf":[{"type":"string"},{"type":"null"}]},"submittedAt":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"qualityScore":{"anyOf":[{"type":"string"},{"type":"null"}]},"rejectedReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastSyncedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvalStatus":{"anyOf":[{"type":"string","enum":["draft","pending","approved","published","rejected","archived"]},{"type":"null"}]},"approvedBy":{"anyOf":[{"$ref":"#/components/schemas/UserId"},{"type":"null"}]},"approvedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"approvalNotes":{"anyOf":[{"type":"string"},{"type":"null"}]},"regulatoryRequirements":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"region":{"type":"string"},"requirement":{"type":"string"},"status":{"type":"string","enum":["compliant","non_compliant","pending"]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["region","requirement","status"],"additionalProperties":false}},{"type":"null"}]}},"additionalProperties":false},"ThemeColors":{"type":"object","additionalProperties":{"type":"string","pattern":"^#[0-9a-f]{6}$"}},"Design":{"type":"object","properties":{"theme":{"anyOf":[{"type":"object","properties":{"colors":{"anyOf":[{"$ref":"#/components/schemas/ThemeColors"},{"type":"null"}]},"colorsDark":{"anyOf":[{"$ref":"#/components/schemas/ThemeColors"},{"type":"null"}]},"radiusPx":{"anyOf":[{"type":"object","additionalProperties":{"type":"number","minimum":0}},{"type":"null"}]},"fontFamilies":{"anyOf":[{"type":"object","additionalProperties":{"type":"object","properties":{"source":{"type":"string","enum":["system","google","custom"]},"family":{"type":"string","minLength":1},"fallback":{"type":"string","minLength":1},"faces":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"weight":{"type":"number","minimum":100,"maximum":900},"style":{"type":"string","enum":["normal","italic"]},"src":{"type":"string","minLength":1},"unicodeRange":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["weight","style","src"],"additionalProperties":false},"minItems":1},{"type":"null"}]}},"required":["source","family","fallback"],"additionalProperties":false}},{"type":"null"}]},"fontWeights":{"anyOf":[{"type":"object","additionalProperties":{"type":"number","minimum":100,"maximum":900}},{"type":"null"}]},"text":{"anyOf":[{"type":"object","additionalProperties":{"type":"object","properties":{"sizePx":{"type":"number","exclusiveMinimum":0},"lineHeightPx":{"type":"number","exclusiveMinimum":0}},"required":["sizePx","lineHeightPx"],"additionalProperties":false}},{"type":"null"}]},"leading":{"anyOf":[{"type":"object","additionalProperties":{"type":"number"}},{"type":"null"}]},"spacingPx":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"containerPx":{"anyOf":[{"type":"object","additionalProperties":{"type":"number","exclusiveMinimum":0}},{"type":"null"}]},"tracking":{"anyOf":[{"type":"object","additionalProperties":{"type":"number"}},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]},"assets":{"anyOf":[{"type":"object","properties":{"logoUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"logoDarkUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"iconUrl":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]},"footer":{"anyOf":[{"type":"object","properties":{"companyName":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"anyOf":[{"type":"object","properties":{"street1":{"type":"string"},"street2":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"type":"string"},"region":{"type":"string"},"postalCode":{"type":"string"},"country":{"type":"string"}},"required":["street1","city","region","postalCode","country"],"additionalProperties":false},{"type":"null"}]},"socialLinks":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"url":{"type":"string"}},"required":["label","url"],"additionalProperties":false}},{"type":"null"}]},"customHtml":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false},"Template":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/TemplateId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"name":{"type":"string"},"slug":{"type":"string"},"familyId":{"anyOf":[{"$ref":"#/components/schemas/TemplateFamilyId"},{"type":"null"}]},"channel":{"type":"string","enum":["email"]},"origin":{"type":"string","enum":["dashboard","tsx"]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"category":{"anyOf":[{"type":"string"},{"type":"null"}]},"fromDefault":{"anyOf":[{"$ref":"#/components/schemas/TemplateFromDefault"},{"type":"null"}]},"replyToDefault":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"trackingDefault":{"anyOf":[{"type":"object","properties":{"opens":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"clicks":{"anyOf":[{"type":"boolean"},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]},"email":{"anyOf":[{"type":"object","properties":{"subject":{"type":"string"},"preheader":{"anyOf":[{"type":"string"},{"type":"null"}]},"headers":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]}},"required":["subject","preheader","headers"],"additionalProperties":false},{"type":"null"}]},"variableSchema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/TemplateVariable"}},{"type":"null"}]},"compliance":{"anyOf":[{"$ref":"#/components/schemas/TemplateCompliance"},{"type":"null"}]},"designOverrides":{"anyOf":[{"$ref":"#/components/schemas/Design"},{"type":"null"}]},"usageCount":{"type":"integer","minimum":0},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"isActive":{"type":"boolean"},"isDefault":{"type":"boolean"},"version":{"type":"integer","exclusiveMinimum":0},"publishedAt":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"publishedBy":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","slug","familyId","channel","origin","description","category","email","variableSchema","compliance","designOverrides","usageCount","lastUsedAt","status","isActive","isDefault","version","createdAt","updatedAt"],"additionalProperties":false},"TemplateSummary":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/TemplateId"},"name":{"type":"string"},"slug":{"type":"string"},"channel":{"type":"string","enum":["email"]},"origin":{"type":"string","enum":["dashboard","tsx"]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"category":{"anyOf":[{"type":"string","enum":["transactional","marketing","support","notification","verification","reminder","alert"]},{"type":"null"}]},"status":{"type":"string","enum":["draft","pending","approved","published","rejected","archived"]},"version":{"type":"integer","exclusiveMinimum":0},"usageCount":{"type":"integer","minimum":0},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","slug","channel","origin","description","category","status","version","usageCount","lastUsedAt","createdAt","updatedAt"],"additionalProperties":false},"TemplateFamily":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/TemplateFamilyId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"name":{"type":"string"},"members":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/TemplateId"},"name":{"type":"string"},"slug":{"type":"string"},"channel":{"type":"string","enum":["email"]},"variableSchema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/TemplateVariable"}},{"type":"null"}]},"status":{"type":"string","enum":["draft","pending","approved","published","rejected","archived"]},"isActive":{"type":"boolean"},"version":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","slug","channel","variableSchema","status","isActive","version","createdAt","updatedAt"],"additionalProperties":false}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","members","createdAt","updatedAt"],"additionalProperties":false},"TemplateFamilyName":{"type":"object","properties":{"name":{"type":"string","minLength":1}},"required":["name"],"additionalProperties":false},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false},"TemplatePerformance":{"type":"object","properties":{"deliveryRate":{"anyOf":[{"type":"number","minimum":0,"maximum":1},{"type":"null"}]},"openRate":{"anyOf":[{"type":"number","minimum":0,"maximum":1},{"type":"null"}]},"clickRate":{"anyOf":[{"type":"number","minimum":0,"maximum":1},{"type":"null"}]},"responseRate":{"anyOf":[{"type":"number","minimum":0,"maximum":1},{"type":"null"}]},"conversionRate":{"anyOf":[{"type":"number","minimum":0,"maximum":1},{"type":"null"}]},"averageSatisfaction":{"anyOf":[{"type":"number","minimum":1,"maximum":5},{"type":"null"}]},"totalSent":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"totalDelivered":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"totalOpened":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"totalClicked":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"totalResponses":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"totalConversions":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"usageCount":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]}},"additionalProperties":false},"CreateTemplatePayload":{"type":"object","properties":{"name":{"type":"string","minLength":1},"slug":{"anyOf":[{"type":"string","pattern":"^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$"},{"type":"null"}]},"origin":{"anyOf":[{"type":"string","enum":["dashboard","tsx"]},{"type":"null"}]},"description":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"category":{"anyOf":[{"anyOf":[{"type":"string","enum":["transactional","marketing","support","notification","verification","reminder","alert"]},{"type":"null"}]},{"type":"null"}]},"source":{"type":"string","minLength":1},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"headers":{"anyOf":[{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]},{"type":"null"}]},"variableSchema":{"anyOf":[{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/TemplateVariable"}},{"type":"null"}]},{"type":"null"}]},"compliance":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/TemplateCompliance"},{"type":"null"}]},{"type":"null"}]},"performance":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/TemplatePerformance"},{"type":"null"}]},{"type":"null"}]},"designOverrides":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/Design"},{"type":"null"}]},{"type":"null"}]},"isActive":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"isDefault":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"version":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}]}},"required":["name","source"],"additionalProperties":false},"UpdateTemplatePayload":{"type":"object","properties":{"data":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"slug":{"anyOf":[{"type":"string","pattern":"^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$"},{"type":"null"}]},"origin":{"anyOf":[{"type":"string","enum":["dashboard","tsx"]},{"type":"null"}]},"description":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"category":{"anyOf":[{"anyOf":[{"type":"string","enum":["transactional","marketing","support","notification","verification","reminder","alert"]},{"type":"null"}]},{"type":"null"}]},"fromDefault":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/TemplateFromDefault"},{"type":"null"}]},{"type":"null"}]},"replyToDefault":{"anyOf":[{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},{"type":"null"}]},"variableSchema":{"anyOf":[{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/TemplateVariable"}},{"type":"null"}]},{"type":"null"}]},"compliance":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/TemplateCompliance"},{"type":"null"}]},{"type":"null"}]},"performance":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/TemplatePerformance"},{"type":"null"}]},{"type":"null"}]},"designOverrides":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/Design"},{"type":"null"}]},{"type":"null"}]},"isActive":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"isDefault":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"version":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}]}},"additionalProperties":false}},"required":["data"],"additionalProperties":false},"MailboxExtensionId":{"type":"string","pattern":"^ext_[0-9a-hjkmnp-tv-z]{16,24}$"},"TemplateSourceVersionId":{"type":"string","pattern":"^src_[0-9a-hjkmnp-tv-z]{16,24}$"},"DesignSettings":{"type":"object","properties":{"design":{"anyOf":[{"$ref":"#/components/schemas/Design"},{"type":"null"}]},"footerCompleteness":{"type":"object","properties":{"missingAddress":{"type":"boolean"}},"required":["missingAddress"],"additionalProperties":false}},"required":["design","footerCompleteness"],"additionalProperties":false},"DraftId":{"type":"string","pattern":"^draft_[0-9a-hjkmnp-tv-z]{16,24}$"},"CreateMediaPayload":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":255},"contentType":{"type":"string","minLength":1,"maxLength":127},"sizeBytes":{"type":"integer","exclusiveMinimum":0,"maximum":26214400},"purpose":{"type":"string","enum":["attachment","avatar"]},"checksumSha256":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["filename","contentType","sizeBytes","purpose"],"additionalProperties":false},"MediaUploadInstruction":{"type":"object","properties":{"url":{"type":"string"},"method":{"type":"string","enum":["PUT"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"expiresAt":{"type":"string"}},"required":["url","method","headers","expiresAt"],"additionalProperties":false},"CreatedMedia":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/MediaId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"status":{"type":"string","enum":["pending","uploading","processing","ready","failed","deleted"]},"filename":{"type":"string"},"contentType":{"type":"string"},"sizeBytes":{"type":"number","minimum":0},"width":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"height":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"durationMs":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"purpose":{"type":"string","enum":["attachment","avatar"]},"checksumSha256":{"anyOf":[{"type":"string"},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"confirmedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"upload":{"$ref":"#/components/schemas/MediaUploadInstruction"}},"required":["id","organizationId","status","filename","contentType","sizeBytes","width","height","durationMs","purpose","checksumSha256","expiresAt","createdAt","confirmedAt","upload"],"additionalProperties":false},"Media":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/MediaId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"status":{"type":"string","enum":["pending","uploading","processing","ready","failed","deleted"]},"filename":{"type":"string"},"contentType":{"type":"string"},"sizeBytes":{"type":"number","minimum":0},"width":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"height":{"anyOf":[{"type":"number","exclusiveMinimum":0},{"type":"null"}]},"durationMs":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"purpose":{"type":"string","enum":["attachment","avatar"]},"checksumSha256":{"anyOf":[{"type":"string"},{"type":"null"}]},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"confirmedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","organizationId","status","filename","contentType","sizeBytes","width","height","durationMs","purpose","checksumSha256","expiresAt","createdAt","confirmedAt"],"additionalProperties":false},"CompletedMedia":{"type":"object","properties":{"media":{"$ref":"#/components/schemas/Media"},"downloadUrl":{"type":"string"}},"required":["media","downloadUrl"],"additionalProperties":false},"MediaDownloadUrl":{"type":"object","properties":{"url":{"type":"string"},"expiresAt":{"type":"string"}},"required":["url","expiresAt"],"additionalProperties":false},"Organization":{"type":"object","properties":{"id":{"type":"string"},"billingAccountId":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"defaultCurrency":{"type":"string"},"countryCode":{"type":"string"},"timezone":{"type":"string"},"billingEmail":{"anyOf":[{"type":"string"},{"type":"null"}]},"plan":{"type":"string"},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}]},"design":{"anyOf":[{"$ref":"#/components/schemas/Design"},{"type":"null"}]},"replyToDefault":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"defaultUnsubscribeGroupId":{"anyOf":[{"$ref":"#/components/schemas/UnsubscribeId"},{"type":"null"}]},"emailFooterEnabledDefault":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"messagesUsed":{"type":"number"},"messagesUsedThisMonth":{"type":"number"},"emailUsed":{"type":"number"},"emailUsedThisMonth":{"type":"number"},"contactsUsed":{"type":"number"},"conversationsUsed":{"type":"number"},"teamMembersUsed":{"type":"number"},"messagesResetAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","billingAccountId","name","slug","defaultCurrency","countryCode","timezone","billingEmail","plan","isActive","createdAt","updatedAt","metadata","design","replyToDefault","defaultUnsubscribeGroupId","emailFooterEnabledDefault","messagesUsed","messagesUsedThisMonth","emailUsed","emailUsedThisMonth","contactsUsed","conversationsUsed","teamMembersUsed","messagesResetAt"],"additionalProperties":false},"OperationResource":{"type":"object","properties":{"type":{"type":"string","minLength":1,"maxLength":80},"id":{"type":"string","minLength":1,"maxLength":255}},"required":["type","id"],"additionalProperties":false},"Operation":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/OperationId"},"organizationId":{"type":"string"},"kind":{"type":"string","enum":["email-domain-provisioning","organization-deletion"]},"subject":{"$ref":"#/components/schemas/OperationResource"},"actor":{"type":"object","properties":{"type":{"type":"string","enum":["user","api-key","system"]},"id":{"type":"string"}},"required":["type","id"],"additionalProperties":false},"status":{"type":"string","enum":["pending","running","succeeded","failed"]},"phase":{"type":"string","enum":["accepted","dispatching","provisioning","deleting","finalizing","completed"]},"error":{"anyOf":[{"type":"object","properties":{"code":{"type":"string","enum":["validation-failed","conflict","capacity-unavailable","provider-rejected","provider-unavailable","timed-out","internal"]},"message":{"type":"string","minLength":1,"maxLength":240}},"required":["code","message"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"startedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"completedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","organizationId","kind","subject","actor","status","phase","error","createdAt","updatedAt","startedAt","completedAt"],"additionalProperties":false},"OperationResourceLink":{"type":"object","properties":{"resource":{"$ref":"#/components/schemas/OperationResource"},"href":{"type":"string","pattern":"^\\/v1\\/","maxLength":500}},"required":["resource","href"],"additionalProperties":false},"OperationAccepted":{"type":"object","properties":{"operation":{"$ref":"#/components/schemas/Operation"},"links":{"type":"object","properties":{"self":{"type":"string","pattern":"^\\/v1\\/","maxLength":500},"resource":{"$ref":"#/components/schemas/OperationResourceLink"}},"required":["self","resource"],"additionalProperties":false}},"required":["operation","links"],"additionalProperties":false},"ApiKeyPermissions":{"anyOf":[{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},{"type":"null"}]},"SensitiveString":{"type":"string"},"ApiKeyWithSecret":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"key":{"$ref":"#/components/schemas/SensitiveString"},"start":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"isActive":{"type":"boolean"},"permissions":{"$ref":"#/components/schemas/ApiKeyPermissions"},"roleName":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","key","start","createdAt","expiresAt","lastUsedAt","isActive"],"additionalProperties":false},"ApiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"key":{"anyOf":[{"type":"string"},{"type":"null"}]},"start":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"expiresAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"isActive":{"type":"boolean"},"permissions":{"$ref":"#/components/schemas/ApiKeyPermissions"},"roleName":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","start","createdAt","expiresAt","lastUsedAt","isActive"],"additionalProperties":false},"ApiKeyId":{"type":"string","pattern":"^key_[0-9a-hjkmnp-tv-z]{16,24}$"},"CreateWebhookPayload":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"url":{"type":"string"},"eventTypes":{"type":"array","items":{"type":"string","enum":["message.sent","message.delivered","message.read","message.failed","message.bounced","message.complained","message.received","contact.created","contact.updated","contact.deleted","conversation.started","conversation.ended","conversation.created","conversation.updated","conversation.archived","template.created","template.updated","template.deleted","template.approved","template.rejected","webhook.created","webhook.updated","webhook.deleted","webhook.test","domain.updated"]},"minItems":1},"channels":{"anyOf":[{"type":"array","items":{"type":"string","enum":["email"]},"minItems":1},{"type":"null"}]},"headers":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]},"status":{"anyOf":[{"type":"string","enum":["active","disabled"]},{"type":"null"}]}},"required":["name","url","eventTypes"],"additionalProperties":false},"WebhookEndpoint":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/WebhookEndpointId"},"name":{"type":"string"},"url":{"type":"string"},"eventTypes":{"type":"array","items":{"type":"string","enum":["message.sent","message.delivered","message.read","message.failed","message.bounced","message.complained","message.received","contact.created","contact.updated","contact.deleted","conversation.started","conversation.ended","conversation.created","conversation.updated","conversation.archived","template.created","template.updated","template.deleted","template.approved","template.rejected","webhook.created","webhook.updated","webhook.deleted","webhook.test","domain.updated"]}},"channels":{"anyOf":[{"type":"array","items":{"type":"string","enum":["email"]}},{"type":"null"}]},"status":{"type":"string","enum":["active","disabled"]},"hasCustomHeaders":{"type":"boolean"},"failureStartedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastSucceededAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","url","eventTypes","channels","status","hasCustomHeaders","failureStartedAt","lastSucceededAt","createdAt","updatedAt"],"additionalProperties":false},"UpdateWebhookPayload":{"type":"object","properties":{"name":{"anyOf":[{"type":"string","minLength":1,"maxLength":100},{"type":"null"}]},"url":{"anyOf":[{"type":"string"},{"type":"null"}]},"eventTypes":{"anyOf":[{"type":"array","items":{"type":"string","enum":["message.sent","message.delivered","message.read","message.failed","message.bounced","message.complained","message.received","contact.created","contact.updated","contact.deleted","conversation.started","conversation.ended","conversation.created","conversation.updated","conversation.archived","template.created","template.updated","template.deleted","template.approved","template.rejected","webhook.created","webhook.updated","webhook.deleted","webhook.test","domain.updated"]},"minItems":1},{"type":"null"}]},"channels":{"anyOf":[{"anyOf":[{"type":"array","items":{"type":"string","enum":["email"]},"minItems":1},{"type":"null"}]},{"type":"null"}]},"headers":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]},"status":{"anyOf":[{"type":"string","enum":["active","disabled"]},{"type":"null"}]}},"additionalProperties":false},"TestWebhookPayload":{"type":"object","properties":{"data":{"anyOf":[{"type":"object"},{"type":"null"}]}},"additionalProperties":false},"WebhookEventId":{"type":"string","pattern":"^whevt_[0-9a-hjkmnp-tv-z]{16,24}$"},"WebhookDeliveryId":{"type":"string","pattern":"^whdel_[0-9a-hjkmnp-tv-z]{16,24}$"},"WebhookAttemptId":{"type":"string","pattern":"^whatt_[0-9a-hjkmnp-tv-z]{16,24}$"},"LogEntry":{"type":"object","properties":{"messageId":{"$ref":"#/components/schemas/MessageId"},"channel":{"type":"string","enum":["email"]},"status":{"type":"string","enum":["pending","scheduled","queued","processing","sent","delivered","read","failed","bounced","complained"]},"recipientCount":{"type":"integer","minimum":0},"acceptedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"apiKeyId":{"anyOf":[{"$ref":"#/components/schemas/ApiKeyId"},{"type":"null"}]},"apiKeyName":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["messageId","channel","status","recipientCount","acceptedAt","createdAt","updatedAt","apiKeyId","apiKeyName"],"additionalProperties":false},"LogFacetRow":{"type":"object","properties":{"value":{"type":"string"},"total":{"type":"integer","minimum":0}},"required":["value","total"],"additionalProperties":false},"LogApiKeyFacetRow":{"type":"object","properties":{"value":{"$ref":"#/components/schemas/ApiKeyId"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"integer","minimum":0}},"required":["value","label","total"],"additionalProperties":false},"LogFacets":{"type":"object","properties":{"status":{"type":"array","items":{"$ref":"#/components/schemas/LogFacetRow"}},"channel":{"type":"array","items":{"$ref":"#/components/schemas/LogFacetRow"}},"apiKey":{"type":"array","items":{"$ref":"#/components/schemas/LogApiKeyFacetRow"}}},"required":["status","channel","apiKey"],"additionalProperties":false},"LogListResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/LogEntry"}},"meta":{"type":"object","properties":{"page":{"type":"integer","exclusiveMinimum":0},"limit":{"type":"integer","exclusiveMinimum":0},"total":{"type":"integer","minimum":0},"hasMore":{"type":"boolean"},"facets":{"anyOf":[{"$ref":"#/components/schemas/LogFacets"},{"type":"null"}]}},"required":["page","limit","total","hasMore"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false},"LogApiRequest":{"type":"object","properties":{"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"endpoint":{"anyOf":[{"type":"string"},{"type":"null"}]},"headers":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]},"query":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]},"ipAddress":{"anyOf":[{"type":"string"},{"type":"null"}]},"userAgent":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false},"LogStatusTimeline":{"type":"object","properties":{"availability":{"type":"string","enum":["recorded","unavailable"]},"entries":{"type":"array","items":{"type":"object","properties":{"status":{"type":"string"},"at":{"type":"string"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["status","at","reason"],"additionalProperties":false}}},"required":["availability","entries"],"additionalProperties":false},"LogEntryDetail":{"type":"object","properties":{"messageId":{"$ref":"#/components/schemas/MessageId"},"channel":{"type":"string","enum":["email"]},"status":{"type":"string","enum":["pending","scheduled","queued","processing","sent","delivered","read","failed","bounced","complained"]},"recipientCount":{"type":"integer","minimum":0},"acceptedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"apiKeyId":{"anyOf":[{"$ref":"#/components/schemas/ApiKeyId"},{"type":"null"}]},"apiKeyName":{"anyOf":[{"type":"string"},{"type":"null"}]},"content":{},"apiRequest":{"anyOf":[{"$ref":"#/components/schemas/LogApiRequest"},{"type":"null"}]},"statusTimeline":{"$ref":"#/components/schemas/LogStatusTimeline"}},"required":["messageId","channel","status","recipientCount","acceptedAt","createdAt","updatedAt","apiKeyId","apiKeyName","content","apiRequest","statusTimeline"],"additionalProperties":false}},"securitySchemes":{"apiKey":{"type":"apiKey","name":"x-api-key","in":"header"}}},"security":[],"tags":[{"name":"Messages","description":"Samva API operation."},{"name":"Scheduled Messages","description":"One-off scheduled message timers"},{"name":"Campaigns","description":"Campaign drafts and scheduled campaign runs"},{"name":"Email","description":"Unified email domain for sending, domains, templates, threads, catch-all, blocking, forwarding, and onboarding"},{"name":"Conversations","description":"Samva API operation."},{"name":"Contacts","description":"Contact CRUD, bulk operations, engagement metrics, and activity timeline"},{"name":"Contact Groups","description":"Segment management — static and dynamic groups with membership operations"},{"name":"Custom Fields","description":"Custom field definitions for contact metadata"},{"name":"Templates","description":"Samva API operation."},{"name":"Template Documents","description":"Authenticated document-authoritative template drafting and explicit Save"},{"name":"Presets","description":"Samva-authored SML starter template gallery"},{"name":"Fonts","description":"Self-hosted Google webfont ingest for the template editor"},{"name":"Template Assets","description":"Image upload for the template editor's background-image controls"},{"name":"Design","description":"Organization email design kit (theme, assets, footer)"},{"name":"Drafts","description":"User-specific message draft management"},{"name":"Attachments","description":"Email attachment metadata and secure download URLs"},{"name":"Media","description":"Media objects and the presigned uploads that fill them"},{"name":"Organizations","description":"Organization management and usage statistics"},{"name":"Operations","description":"Durable status for accepted asynchronous mutations"},{"name":"API Keys","description":"API key management, rotation, and usage statistics"},{"name":"Webhooks","description":"Customer event webhook management, testing, and delivery logs"},{"name":"Analytics","description":"Messaging analytics, channel stats, and data export"},{"name":"Logs","description":"The log of outbound sends this organization has accepted"},{"name":"Search"},{"name":"Settings","description":"Organization effective configuration (cascade origins)"},{"name":"Billing","description":"Workspace overage usage and spend limits"},{"name":"Unsubscribe Groups","description":"Manage unsubscribe groups and members"}]}