{"openapi":"3.1.0","info":{"title":"Samva API","version":"1.0.0","description":"Multi-channel CPaaS platform"},"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":["sms","whatsapp","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError | FlagDisabledError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"},{"$ref":"#/components/schemas/FlagDisabledErrorJsonEncoding"},{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"429":{"description":"RateLimitedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitedErrorJsonEncoding"}}}},"500":{"description":"InternalError | WebhookEnqueueError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/InternalErrorJsonEncoding"},{"$ref":"#/components/schemas/WebhookEnqueueErrorJsonEncoding"}]}}}},"502":{"description":"BillingProviderError | ExternalServiceError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"},{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"}]}}}}},"description":"Sends a message on the requested channel and returns the created message with a 201 Created status. `channel` selects the payload variant. Email sends today; the SMS and WhatsApp variants are coming soon and answer 403 until the channel launches for your organization, so integrating against them now costs no rewrite later. 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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":["sms","whatsapp","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","allOf":[{"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","allOf":[{"minimum":0}]},{"type":"null"}]},"hasAttachments":{"type":"boolean"},"attachmentCount":{"type":"integer","allOf":[{"minimum":0}]},"attachments":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/AttachmentId"},"filename":{"type":"string"},"contentType":{"type":"string"},"size":{"type":"integer","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Returns the email projection of a message, optionally including signed S3 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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"FlagDisabledError | ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/FlagDisabledErrorJsonEncoding"},{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}]}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"}}}}},"description":"Schedules a message at the absolute ISO-8601 instant in scheduledFor. The send payload is the same channel union the immediate send accepts, with each channel's content checked at schedule time so a send that could never render fails now rather than hours later: email schedules today, and the SMS and WhatsApp variants are coming soon and answer 403 until the channel launches. 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/AbsoluteInstantJsonEncoding"},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"FlagDisabledError | ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/FlagDisabledErrorJsonEncoding"},{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}]}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":["sms","whatsapp","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"FlagDisabledError | ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/FlagDisabledErrorJsonEncoding"},{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"FlagDisabledError | ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/FlagDisabledErrorJsonEncoding"},{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"}}}}},"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/AbsoluteInstantJsonEncoding"},{"type":"null"}]},"idempotencyKey":{"anyOf":[{"type":"string","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"EmailChannelError | BillingProviderError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/EmailChannelErrorJsonEncoding"},{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}]}}}}},"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"},"status":{"type":"string","enum":["pending","verified","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","status","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Returns a paginated list of the organization's sending domains.","summary":"List sending domains"}},"/v1/email/domain-operations":{"post":{"tags":["Email"],"operationId":"email.provisionDomain","parameters":[{"name":"idempotency-key","in":"header","schema":{"type":"string","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"EmailChannelError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelErrorJsonEncoding"}}}}},"description":"Accepts durable provisioning for a sending domain. Repeating an identical request with the same Idempotency-Key returns the same organization-scoped operation.","summary":"Provision a sending domain","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string"}},"required":["domain"],"additionalProperties":false}}},"required":true}}},"/v1/email/domains/{id}/verify":{"post":{"tags":["Email"],"operationId":"email.verifyDomain","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]}},"required":["success"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"EmailChannelError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelErrorJsonEncoding"}}}}},"description":"Initiates verification of a sending domain with the email provider and stores the DNS records needed to complete it.","summary":"Verify a sending domain"}},"/v1/email/domains/{id}/verification":{"get":{"tags":["Email"],"operationId":"email.checkDomainVerification","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"EmailDomainVerificationStatusResponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDomainVerificationStatusResponseJsonEncoding"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"EmailChannelError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelErrorJsonEncoding"}}}}},"description":"Re-checks a sending domain's verification live with the email provider and updates the stored status once it is verified.","summary":"Check domain verification status"}},"/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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"EmailChannelError | BillingProviderError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/EmailChannelErrorJsonEncoding"},{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}]}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"eligible":{"type":"boolean"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"providerName":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["eligible"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"EmailChannelError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelErrorJsonEncoding"}}}}},"description":"Builds the signed Domain Connect apply URL that sends the customer to their DNS provider to apply Samva's sending records in one click. Pass inbound to also request the receiving MX records.","summary":"Build a one-click DNS apply URL","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"inbound":{"anyOf":[{"type":"boolean"},{"type":"null"}]}},"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":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["applied","cancelled","invalid"]}},"required":["status"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"EmailChannelError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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}/status":{"get":{"tags":["Email"],"operationId":"email.getDomainStatus","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":{"domain":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed"]}},"required":["domain","status"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}}},"description":"Returns the stored verification status of a sending domain without contacting the email provider.","summary":"Get sending domain status"}},"/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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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}/branded-tracking":{"post":{"tags":["Email"],"operationId":"email.enableBrandedTracking","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"BrandedTrackingStatus","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandedTrackingStatus"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"},{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}]}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"EmailChannelError | BillingProviderError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/EmailChannelErrorJsonEncoding"},{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}]}}}}},"description":"Provisions a branded tracking domain (default label `track`) for a verified sending domain so open/click links redirect through the customer's own subdomain. Requires the branded_tracking entitlement. Returns the resulting state including the two DNS records the customer must create.","summary":"Enable a branded 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.getBrandedTracking","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/EmailDomainId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"BrandedTrackingStatus","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandedTrackingStatus"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Returns the branded 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 branded tracking domain is provisioned.","summary":"Get branded tracking status"},"delete":{"tags":["Email"],"operationId":"email.disableBrandedTracking","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"},{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}]}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"EmailChannelError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelErrorJsonEncoding"}}}}},"description":"Tears down a domain's branded tracking and its managed resources. Sends immediately revert to the shared tracking host. Existing branded links in already-delivered mail stop working.","summary":"Disable a branded tracking domain"}},"/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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]},"totalDelivered":{"type":"integer","allOf":[{"minimum":0}]},"totalBounced":{"type":"integer","allOf":[{"minimum":0}]},"totalComplained":{"type":"integer","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]},"catchAllLastEmailAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"timeRange":{"anyOf":[{"type":"object","properties":{"emailsReceived":{"type":"integer","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]}},"required":["suppressions","total"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"EmailChannelError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}}},"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","allOf":[{"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","allOf":[{"minimum":0}]}},"required":["blocks","total"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]},"isActive":{"type":"boolean"},"forwardCount":{"type":"integer","allOf":[{"minimum":0}]},"failureCount":{"type":"integer","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]},"hasMore":{"type":"boolean"},"stats":{"anyOf":[{"type":"object","properties":{"totalForwarded":{"type":"integer","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":["sms","whatsapp","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":["sms","whatsapp","email"]}},"primaryChannel":{"type":"string","enum":["sms","whatsapp","email"]},"status":{"anyOf":[{"type":"string","enum":["active","waiting","resolved","escalated","archived"]},{"type":"null"}]},"statusReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"priority":{"anyOf":[{"type":"integer","allOf":[{"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":"Conversation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Conversation"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":["sms","whatsapp","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","allOf":[{"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":["sms","whatsapp","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/Contact"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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"}]},"engagement":{"anyOf":[{"type":"object","properties":{"totalInteractions":{"type":"integer","allOf":[{"minimum":0}]},"lastActiveAt":{"type":"string"},"averageResponseTime":{"type":"number","allOf":[{"minimum":0}]},"satisfactionScore":{"anyOf":[{"type":"number"},{"type":"null"}]},"channels":{"type":"object","properties":{"sms":{"anyOf":[{"type":"object","properties":{"sent":{"type":"integer","allOf":[{"minimum":0}]},"received":{"type":"integer","allOf":[{"minimum":0}]},"failed":{"type":"integer","allOf":[{"minimum":0}]},"lastAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["sent","received","failed"],"additionalProperties":false},{"type":"null"}]},"whatsapp":{"anyOf":[{"type":"object","properties":{"sent":{"type":"integer","allOf":[{"minimum":0}]},"received":{"type":"integer","allOf":[{"minimum":0}]},"failed":{"type":"integer","allOf":[{"minimum":0}]},"lastAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["sent","received","failed"],"additionalProperties":false},{"type":"null"}]},"email":{"anyOf":[{"type":"object","properties":{"sent":{"type":"integer","allOf":[{"minimum":0}]},"received":{"type":"integer","allOf":[{"minimum":0}]},"failed":{"type":"integer","allOf":[{"minimum":0}]},"bounced":{"type":"integer","allOf":[{"minimum":0}]},"lastAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["sent","received","failed","bounced"],"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false},"performance":{"anyOf":[{"type":"object","properties":{"successRate":{"type":"number"},"escalationRate":{"type":"number"},"resolutionRate":{"type":"number"},"averageHandlingTime":{"type":"number","allOf":[{"minimum":0}]}},"required":["successRate","escalationRate","resolutionRate","averageHandlingTime"],"additionalProperties":false},{"type":"null"}]}},"required":["totalInteractions","lastActiveAt","averageResponseTime","channels"],"additionalProperties":false},{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Looks up a single contact by email, phone, WhatsApp, or external ID, returning null when no contact matches.","summary":"Find a contact","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"whatsapp":{"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/UnauthorizedErrorJsonEncoding"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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"}]},"whatsapp":{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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"}]},"engagement":{"anyOf":[{"type":"object","properties":{"totalInteractions":{"type":"integer","allOf":[{"minimum":0}]},"lastActiveAt":{"type":"string"},"averageResponseTime":{"type":"number","allOf":[{"minimum":0}]},"satisfactionScore":{"anyOf":[{"type":"number"},{"type":"null"}]},"channels":{"type":"object","properties":{"sms":{"anyOf":[{"type":"object","properties":{"sent":{"type":"integer","allOf":[{"minimum":0}]},"received":{"type":"integer","allOf":[{"minimum":0}]},"failed":{"type":"integer","allOf":[{"minimum":0}]},"lastAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["sent","received","failed"],"additionalProperties":false},{"type":"null"}]},"whatsapp":{"anyOf":[{"type":"object","properties":{"sent":{"type":"integer","allOf":[{"minimum":0}]},"received":{"type":"integer","allOf":[{"minimum":0}]},"failed":{"type":"integer","allOf":[{"minimum":0}]},"lastAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["sent","received","failed"],"additionalProperties":false},{"type":"null"}]},"email":{"anyOf":[{"type":"object","properties":{"sent":{"type":"integer","allOf":[{"minimum":0}]},"received":{"type":"integer","allOf":[{"minimum":0}]},"failed":{"type":"integer","allOf":[{"minimum":0}]},"bounced":{"type":"integer","allOf":[{"minimum":0}]},"lastAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["sent","received","failed","bounced"],"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false},"performance":{"anyOf":[{"type":"object","properties":{"successRate":{"type":"number"},"escalationRate":{"type":"number"},"resolutionRate":{"type":"number"},"averageHandlingTime":{"type":"number","allOf":[{"minimum":0}]}},"required":["successRate","escalationRate","resolutionRate","averageHandlingTime"],"additionalProperties":false},{"type":"null"}]}},"required":["totalInteractions","lastActiveAt","averageResponseTime","channels"],"additionalProperties":false},{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]},"messagesSent":{"type":"integer","allOf":[{"minimum":0}]},"messagesReceived":{"type":"integer","allOf":[{"minimum":0}]},"activeConversations":{"type":"integer","allOf":[{"minimum":0}]},"lastActivityAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"channelsUsed":{"type":"object","additionalProperties":{"type":"integer","allOf":[{"minimum":0}]}}},"required":["totalMessages","messagesSent","messagesReceived","activeConversations","lastActivityAt","channelsUsed"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]},"created":{"type":"integer","allOf":[{"minimum":0}]},"updated":{"type":"integer","allOf":[{"minimum":0}]},"skipped":{"type":"integer","allOf":[{"minimum":0}]},"errors":{"type":"integer","allOf":[{"minimum":0}]},"results":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]},"failed":{"type":"integer","allOf":[{"minimum":0}]}},"required":["deleted","failed"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]}},"required":["data","format","count"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":["sms","whatsapp","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Objects_"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Union_"},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentGroupId":{"anyOf":[{"$ref":"#/components/schemas/ContactGroupId"},{"type":"null"}]},"contactCount":{"type":"integer","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":[{"$ref":"#/components/schemas/Union_"},{"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":{"$ref":"#/components/schemas/Objects_"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Objects_"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":[{"$ref":"#/components/schemas/Union_"},{"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":{"$ref":"#/components/schemas/Objects_1"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]},"skipped":{"type":"integer","allOf":[{"minimum":0}]}},"required":["added","skipped"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]}},"required":["removed"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]},"removed":{"type":"integer","allOf":[{"minimum":0}]},"total":{"type":"integer","allOf":[{"minimum":0}]}},"required":["added","removed","total"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Objects_2"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Union_1"},"defaultValue":{"anyOf":[{"type":"string"},{"type":"null"}]},"isRequired":{"type":"boolean"},"sortOrder":{"type":"integer","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"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":{"$ref":"#/components/schemas/Objects_2"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"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":{"$ref":"#/components/schemas/Objects_1"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":["sms","whatsapp","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":["sms","whatsapp","email"]},{"type":"array","items":{"type":"string","enum":["sms","whatsapp","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":["sms","whatsapp","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","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}}}},"/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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}}}},"/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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}}}},"/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":["sms","whatsapp","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}}}},"/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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Returns a single template by ID, including its SML source and compiled channel content.","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Updates a template's metadata or SML source; a new source's root tag must match the template's existing channel. Returns the updated template.","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/templates/{id}/render":{"post":{"tags":["Templates"],"operationId":"templates.render","parameters":[{"name":"id","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":["sms","whatsapp","email"]},"rendered":{"type":"object","properties":{"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"type":"string"}},"required":["text"],"additionalProperties":false},"sms":{"anyOf":[{"type":"object","properties":{"encoding":{"anyOf":[{"type":"string"},{"type":"null"}]},"estimatedSegments":{"anyOf":[{"type":"integer"},{"type":"null"}]}},"required":["encoding","estimatedSegments"],"additionalProperties":false},{"type":"null"}]},"whatsapp":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"},"language":{"type":"string"},"category":{"type":"string"},"headerContent":{"anyOf":[{"type":"string"},{"type":"null"}]},"bodyContent":{"type":"string"},"footerContent":{"anyOf":[{"type":"string"},{"type":"null"}]},"buttons":{"type":"array","items":{"type":"object"}}},"required":["name","language","category","bodyContent","buttons"],"additionalProperties":false},{"type":"null"}]},"missingVariables":{"type":"array","items":{"type":"string"}},"errors":{"type":"array","items":{"type":"string"}}},"required":["channel","rendered","missingVariables","errors"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Renders a template with the provided variables and returns a channel-specific preview, along with any missing variables and errors. No message is sent.","summary":"Render a template","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"variables":{"anyOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"null"}]}},"additionalProperties":false}},"required":["data"],"additionalProperties":false}}},"required":true}}},"/v1/templates/{id}/duplicate":{"post":{"tags":["Templates"],"operationId":"templates.duplicate","parameters":[{"name":"id","in":"path","schema":{"$ref":"#/components/schemas/TemplateId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Creates a copy of the template as a new draft template with a fresh slug. Returns the new template with status 201.","summary":"Duplicate a template"}},"/v1/templates/{id}/publish":{"post":{"tags":["Templates"],"operationId":"templates.publish","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Compiles the template's current source and creates a new published version snapshot, recording the publisher. Returns the updated template.","summary":"Publish a template"}},"/v1/templates/{id}/unpublish":{"post":{"tags":["Templates"],"operationId":"templates.unpublish","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Reverts a published template by creating a new draft version from its current source. Returns the updated template.","summary":"Unpublish a template"}},"/v1/templates/{id}/versions":{"get":{"tags":["Templates"],"operationId":"templates.versionHistory","parameters":[{"name":"id","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":{"id":{"type":"string"},"version":{"type":"integer","allOf":[{"exclusiveMinimum":0}]},"status":{"type":"string"},"isCurrent":{"type":"boolean"},"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"publishedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"publishedBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","version","status","isCurrent","source","publishedAt","publishedBy","createdAt","updatedAt"],"additionalProperties":false}}},"required":["versions"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Returns the template's version history, listing each source version with its status and publish metadata.","summary":"List template versions"}},"/v1/templates/{id}/versions/{versionId}/restore":{"post":{"tags":["Templates"],"operationId":"templates.restoreVersion","parameters":[{"name":"id","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":"Template","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Recompiles an older version's source and restores it as a new draft version. Fails if the source no longer compiles or its channel differs.","summary":"Restore a template version"}},"/v1/templates/spam-check":{"post":{"tags":["Templates"],"operationId":"templates.spamCheck","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"score":{"type":"number","allOf":[{"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","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Scores email content for spam risk, from either a stored email template or raw subject, HTML, and text. Returns a score, severity, issues, and recommendations.","summary":"Spam-check a template or email content","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"templateId":{"$ref":"#/components/schemas/TemplateId"},"inputs":{"anyOf":[{"type":"object"},{"type":"null"}]}},"required":["templateId"],"additionalProperties":false},{"type":"object","properties":{"subject":{"type":"string"},"html":{"type":"string"},"text":{"type":"string"}},"required":["subject","html","text"],"additionalProperties":false}]}}},"required":true}}},"/v1/editor-sessions":{"post":{"tags":["Editor Sessions"],"operationId":"editorSessions.create","parameters":[],"security":[{"apiKey":[]}],"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/Objects_7"},"source":{"type":"string"},"checks":{"$ref":"#/components/schemas/Objects_8"},"theme":{"$ref":"#/components/schemas/Objects_10"},"transport":{"$ref":"#/components/schemas/Objects_11"}},"required":["session","source","checks","theme","transport"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Creates a new editor session for a template and returns the session state, checks, theme, and transport with a 201 Created status.","summary":"Create an editor session","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"$ref":"#/components/schemas/TemplateId"}},"required":["templateId"],"additionalProperties":false}}},"required":true}}},"/v1/editor-sessions/{sessionId}/connect":{"post":{"tags":["Editor Sessions"],"operationId":"editorSessions.connect","parameters":[{"name":"sessionId","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/Objects_7"},"source":{"type":"string"},"checks":{"$ref":"#/components/schemas/Objects_8"},"theme":{"$ref":"#/components/schemas/Objects_10"},"transport":{"$ref":"#/components/schemas/Objects_11"}},"required":["session","source","checks","theme","transport"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Connects to an existing editor session and returns its current state, source, checks, theme, and transport details.","summary":"Connect to an editor session"}},"/v1/editor-sessions/{sessionId}":{"get":{"tags":["Editor Sessions"],"operationId":"editorSessions.load","parameters":[{"name":"sessionId","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/Objects_7"},"source":{"type":"string"},"checks":{"$ref":"#/components/schemas/Objects_8"},"theme":{"$ref":"#/components/schemas/Objects_10"}},"required":["session","source","checks","theme"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Returns the current state, source, checks, and theme for an editor session.","summary":"Load an editor session"}},"/v1/editor-sessions/{sessionId}/agent-context":{"post":{"tags":["Editor Sessions"],"operationId":"editorSessions.issueAgentContext","parameters":[{"name":"sessionId","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"}},"required":["token"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Issues a short-lived, signed capability bound to the authenticated user and editor session.","summary":"Issue a template editor agent capability"}},"/v1/editor-sessions/{sessionId}/operations":{"post":{"tags":["Editor Sessions"],"operationId":"editorSessions.applyOperation","parameters":[{"name":"sessionId","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/Objects_7"},"source":{"type":"string"},"checks":{"$ref":"#/components/schemas/Objects_8"},"theme":{"$ref":"#/components/schemas/Objects_10"},"operation":{"type":"object","properties":{"ok":{"type":"boolean"},"revision":{"type":"string"},"errors":{"type":"array","items":{"type":"string"}}},"required":["ok","revision","errors"],"additionalProperties":false}},"required":["session","source","checks","theme","operation"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Replaces the full source of an editor session and returns the updated state, checks, theme, and operation result.","summary":"Replace editor session source","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string"}},"required":["source"],"additionalProperties":false}}},"required":true}}},"/v1/editor-sessions/{sessionId}/save":{"post":{"tags":["Editor Sessions"],"operationId":"editorSessions.save","parameters":[{"name":"sessionId","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/Objects_7"},"source":{"type":"string"},"checks":{"$ref":"#/components/schemas/Objects_8"},"theme":{"$ref":"#/components/schemas/Objects_10"},"template":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/TemplateId"},"version":{"type":"integer","allOf":[{"exclusiveMinimum":0}]},"updatedAt":{"type":"string"}},"required":["id","version","updatedAt"],"additionalProperties":false}},"required":["session","source","checks","theme","template"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Saves the editor session source to its template and returns the updated session along with the new template version.","summary":"Save an editor session","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"revision":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false}}},"required":true}}},"/v1/editor-sessions/{sessionId}/render":{"post":{"tags":["Editor Sessions"],"operationId":"editorSessions.render","parameters":[{"name":"sessionId","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"rendered":{"anyOf":[{"type":"object","properties":{"channel":{"type":"string","enum":["email"]},"subject":{"type":"string"},"html":{"type":"string"},"text":{"type":"string"},"missingVariables":{"type":"array","items":{"type":"string"}}},"required":["channel","subject","html","text","missingVariables"],"additionalProperties":false},{"type":"object","properties":{"channel":{"type":"string","enum":["sms"]},"body":{"type":"string"},"encoding":{"type":"string","enum":["gsm7","ucs2"]},"estimatedSegments":{"type":"integer","allOf":[{"exclusiveMinimum":0}]},"missingVariables":{"type":"array","items":{"type":"string"}}},"required":["channel","body","encoding","estimatedSegments","missingVariables"],"additionalProperties":false},{"type":"object","properties":{"channel":{"type":"string","enum":["whatsapp"]},"name":{"type":"string"},"language":{"type":"string"},"category":{"type":"string"},"headerContent":{"anyOf":[{"type":"string"},{"type":"null"}]},"bodyContent":{"type":"string"},"footerContent":{"anyOf":[{"type":"string"},{"type":"null"}]},"buttons":{"type":"array","items":{"type":"object"}},"missingVariables":{"type":"array","items":{"type":"string"}}},"required":["channel","name","language","category","bodyContent","buttons","missingVariables"],"additionalProperties":false}]},"checks":{"$ref":"#/components/schemas/Objects_8"}},"required":["rendered","checks"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Renders the editor session's email to subject, HTML, and text using the provided variables, and reports any missing variables.","summary":"Render an editor session","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"variables":{"anyOf":[{"type":"object"},{"type":"null"}]}},"additionalProperties":false}}},"required":true}}},"/v1/editor-sessions/{sessionId}/check":{"get":{"tags":["Editor Sessions"],"operationId":"editorSessions.check","parameters":[{"name":"sessionId","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Objects_8"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Runs compile and compatibility checks on the editor session and returns the resulting diagnostics.","summary":"Check an editor session"}},"/v1/editor-sessions/{sessionId}/versions":{"get":{"tags":["Editor Sessions"],"operationId":"editorSessions.versions","parameters":[{"name":"sessionId","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"versions":{"type":"array","items":{"$ref":"#/components/schemas/Objects_12"}}},"required":["versions"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}}}},"/v1/editor-sessions/{sessionId}/publish":{"post":{"tags":["Editor Sessions"],"operationId":"editorSessions.publish","parameters":[{"name":"sessionId","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/Objects_7"},"source":{"type":"string"},"version":{"$ref":"#/components/schemas/Objects_12"}},"required":["session","source","version"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Objects_13"}}},"required":true}}},"/v1/editor-sessions/{sessionId}/versions/{versionId}/restore":{"post":{"tags":["Editor Sessions"],"operationId":"editorSessions.restore","parameters":[{"name":"sessionId","in":"path","schema":{"type":"string"},"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":{"session":{"$ref":"#/components/schemas/Objects_7"},"source":{"type":"string"},"version":{"$ref":"#/components/schemas/Objects_12"}},"required":["session","source","version"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Objects_13"}}},"required":true}}},"/v1/editor-sessions/{sessionId}/send-test":{"post":{"tags":["Editor Sessions"],"operationId":"editorSessions.testSend","parameters":[{"name":"sessionId","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Union_4"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError | FlagDisabledError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"},{"$ref":"#/components/schemas/FlagDisabledErrorJsonEncoding"},{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError | WhatsAppTemplateIneligibleError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"},{"$ref":"#/components/schemas/WhatsAppTemplateIneligibleErrorJsonEncoding"}]}}}},"429":{"description":"RateLimitedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitedErrorJsonEncoding"}}}},"500":{"description":"WebhookEnqueueError | InternalError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/WebhookEnqueueErrorJsonEncoding"},{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}]}}}},"502":{"description":"ExternalServiceError | BillingProviderError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"},{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}]}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"string"},"variables":{"$ref":"#/components/schemas/Union_2"},"to":{"$ref":"#/components/schemas/Union_3"}},"required":["revision","to"],"additionalProperties":false}}},"required":true}}},"/v1/editor-sessions/{sessionId}/send":{"post":{"tags":["Editor Sessions"],"operationId":"editorSessions.send","parameters":[{"name":"sessionId","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Union_4"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError | FlagDisabledError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"},{"$ref":"#/components/schemas/FlagDisabledErrorJsonEncoding"},{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError | WhatsAppTemplateIneligibleError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"},{"$ref":"#/components/schemas/WhatsAppTemplateIneligibleErrorJsonEncoding"}]}}}},"429":{"description":"RateLimitedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitedErrorJsonEncoding"}}}},"500":{"description":"WebhookEnqueueError | InternalError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/WebhookEnqueueErrorJsonEncoding"},{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}]}}}},"502":{"description":"ExternalServiceError | BillingProviderError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"},{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}]}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"string"},"variables":{"$ref":"#/components/schemas/Union_2"},"to":{"type":"array","items":{"$ref":"#/components/schemas/Union_3"}}},"required":["revision","to"],"additionalProperties":false}}},"required":true}}},"/v1/editor-sessions/{sessionId}/schedule":{"post":{"tags":["Editor Sessions"],"operationId":"editorSessions.schedule","parameters":[{"name":"sessionId","in":"path","schema":{"type":"string"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Union_4"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"FlagDisabledError | ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/FlagDisabledErrorJsonEncoding"},{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError | WhatsAppTemplateIneligibleError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"},{"$ref":"#/components/schemas/WhatsAppTemplateIneligibleErrorJsonEncoding"}]}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"revision":{"type":"string"},"variables":{"$ref":"#/components/schemas/Union_2"},"to":{"type":"array","items":{"$ref":"#/components/schemas/Union_3"}},"scheduledFor":{"type":"string"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["revision","to","scheduledFor"],"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":["sms","whatsapp","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"}}}}},"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","allOf":[{"minLength":1}]},"weights":{"type":"array","items":{"type":"number","allOf":[{"minimum":100,"maximum":900}]},"allOf":[{"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":{"$ref":"#/components/schemas/Objects_4"},"hostedFaces":{"type":"number"},"next":{"type":"string"}},"required":["token","font","hostedFaces","next"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"ExternalServiceError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalServiceErrorJsonEncoding"}}}}},"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","allOf":[{"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","allOf":[{"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","allOf":[{"minimum":100,"maximum":900}]},"allOf":[{"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.initializeUpload","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"uploadId":{"type":"string","allOf":[{"pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"}]},"uploadUrl":{"type":"string"},"contentType":{"type":"string","enum":["font/woff2"]},"expiresAt":{"type":"string"}},"required":["uploadId","uploadUrl","contentType","expiresAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Returns a short-lived, organization-scoped R2 URL for uploading raw woff2 bytes.","summary":"Initialize a custom font upload","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"contentType":{"type":"string","enum":["font/woff2"]},"contentLength":{"type":"number","allOf":[{"minimum":1,"maximum":2097152}]}},"required":["contentType","contentLength"],"additionalProperties":false}}},"required":true}}},"/v1/fonts/uploads/{uploadId}/confirm":{"post":{"tags":["Fonts"],"operationId":"fonts.confirmUpload","parameters":[{"name":"uploadId","in":"path","schema":{"type":"string","allOf":[{"pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"}]},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"weight":{"type":"number"},"style":{"type":"string","enum":["normal","italic"]},"src":{"type":"string"}},"required":["weight","style","src"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Validates the staged woff2 bytes, promotes the content-addressed object, and returns the hosted face.","summary":"Confirm a custom font upload","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"weight":{"type":"number","allOf":[{"minimum":100,"maximum":900}]},"style":{"type":"string","enum":["normal","italic"]}},"required":["weight","style"],"additionalProperties":false}}},"required":true}}},"/v1/template-assets/uploads":{"post":{"tags":["Template Assets"],"operationId":"templateAssets.initializeUpload","parameters":[],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"uploadId":{"type":"string","allOf":[{"pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"}]},"uploadUrl":{"type":"string"},"contentType":{"type":"string","enum":["image/png","image/jpeg","image/webp"]},"expiresAt":{"type":"string"}},"required":["uploadId","uploadUrl","contentType","expiresAt"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Returns a short-lived, organization-scoped R2 URL for uploading raw image bytes.","summary":"Initialize 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","allOf":[{"minimum":1,"maximum":5242880}]}},"required":["contentType","contentLength"],"additionalProperties":false}}},"required":true}}},"/v1/template-assets/uploads/{uploadId}/confirm":{"post":{"tags":["Template Assets"],"operationId":"templateAssets.confirmUpload","parameters":[{"name":"uploadId","in":"path","schema":{"type":"string","allOf":[{"pattern":"^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"}]},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"src":{"type":"string"}},"required":["src"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Validates the staged image bytes, promotes the content-addressed object, and returns its public URL.","summary":"Confirm a template asset upload"}},"/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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":["sms","whatsapp","email"]},{"type":"null"}]},"required":false}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Objects_14"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Union_5"},"content":{"$ref":"#/components/schemas/Objects_16"},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":["sms","whatsapp","email"]},"recipients":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/Objects_15"}},{"type":"null"}]},"content":{"anyOf":[{"$ref":"#/components/schemas/Objects_16"},{"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":{"$ref":"#/components/schemas/Objects_14"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Objects_14"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Objects_15"}},{"type":"null"}]},"content":{"anyOf":[{"$ref":"#/components/schemas/Objects_16"},{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Objects_17"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Objects_17"}},"total":{"type":"integer","allOf":[{"minimum":0}]}},"required":["attachments","total"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Objects_17"}},"required":["url","expiresAt","attachment"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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"},"smsCount":{"type":"number"},"emailCount":{"type":"number"},"whatsappCount":{"type":"number"},"totalMessages":{"type":"number"}},"required":["periodStart","periodEnd","smsCount","emailCount","whatsappCount","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"},{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}]}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"},{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}]}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"},{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}]}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Deactivates the existing key and issues a replacement with the same name and permissions. 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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]},"successfulRequests":{"type":"integer","allOf":[{"minimum":0}]},"failedRequests":{"type":"integer","allOf":[{"minimum":0}]},"dailyVolume":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"requests":{"type":"integer","allOf":[{"minimum":0}]}},"required":["date","requests"],"additionalProperties":false}}},"required":["totalRequests","successfulRequests","failedRequests","dailyVolume"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":100,"maximum":599}]},"latency":{"type":"number","allOf":[{"minimum":0}]}},"required":["id","timestamp","method","endpoint","statusCode","latency"],"additionalProperties":false}},"total":{"type":"integer","allOf":[{"minimum":0}]},"hasMore":{"type":"boolean"}},"required":["data","total","hasMore"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"402":{"description":"PaymentRequiredError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"409":{"description":"ConflictError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConflictErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}},"502":{"description":"BillingProviderError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingProviderErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"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","allOf":[{"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"}]},"responseBody":{"anyOf":[{"type":"string"},{"type":"null"}]},"durationMs":{"anyOf":[{"type":"number","allOf":[{"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","responseBody","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]},"pending":{"type":"integer","allOf":[{"minimum":0}]},"delivered":{"type":"integer","allOf":[{"minimum":0}]},"exhausted":{"type":"integer","allOf":[{"minimum":0}]},"cancelled":{"type":"integer","allOf":[{"minimum":0}]}},"required":["total","pending","delivered","exhausted","cancelled"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"422":{"description":"ValidationError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":["sms","whatsapp","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","allOf":[{"minimum":0}]},"whatsapp":{"type":"integer","allOf":[{"minimum":0}]},"sms":{"type":"integer","allOf":[{"minimum":0}]}},"required":["date","email","whatsapp","sms"],"additionalProperties":false}}},"required":["volumeHistory"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]},"deliveryRate":{"type":"number"},"uniqueOpenedMessages":{"type":"integer","allOf":[{"minimum":0}]},"openTrackingEligibleDeliveredMessages":{"type":"integer","allOf":[{"minimum":0}]},"uniqueMessageOpenRate":{"type":"number"},"uniqueClickedMessages":{"type":"integer","allOf":[{"minimum":0}]},"clickTrackingEligibleDeliveredMessages":{"type":"integer","allOf":[{"minimum":0}]},"uniqueMessageClickRate":{"type":"number"},"bounceRate":{"type":"number"}},"required":["sent","deliveryRate","uniqueOpenedMessages","openTrackingEligibleDeliveredMessages","uniqueMessageOpenRate","uniqueClickedMessages","clickTrackingEligibleDeliveredMessages","uniqueMessageClickRate","bounceRate"],"additionalProperties":false},"whatsapp":{"type":"object","properties":{"sent":{"type":"integer","allOf":[{"minimum":0}]},"deliveryRate":{"type":"number"},"readRate":{"type":"number"},"failureRate":{"type":"number"},"avgResponseTime":{"type":"number","allOf":[{"minimum":0}]}},"required":["sent","deliveryRate","readRate","failureRate","avgResponseTime"],"additionalProperties":false},"sms":{"type":"object","properties":{"sent":{"type":"integer","allOf":[{"minimum":0}]},"deliveryRate":{"type":"number"},"failureRate":{"type":"number"},"totalSegments":{"type":"integer","allOf":[{"minimum":0}]}},"required":["sent","deliveryRate","failureRate","totalSegments"],"additionalProperties":false}},"required":["email","whatsapp","sms"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]}},"required":["id","name","email","phone","messageCount"],"additionalProperties":false}}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]}},"required":["hour","count"],"additionalProperties":false}}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":["sms","whatsapp","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]}},"required":["country","region","count"],"additionalProperties":false}}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Returns message volume grouped by geographic region for SMS and WhatsApp traffic, derived from sender phone numbers.","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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":["sms","whatsapp","email"]}},{"type":"null"}]}},"required":["startDate","endDate"],"additionalProperties":false}}},"required":true}}},"/v1/developers/send-log":{"get":{"tags":["Send Log"],"operationId":"developers.listSendLog","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","sms","whatsapp"]},{"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":"SendLogListResponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendLogListResponse"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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 the send log"}},"/v1/developers/send-log/{messageId}":{"get":{"tags":["Send Log"],"operationId":"developers.getSendLogEntry","parameters":[{"name":"messageId","in":"path","schema":{"$ref":"#/components/schemas/MessageId"},"required":true}],"security":[{"apiKey":[]}],"responses":{"200":{"description":"SendLogEntryDetail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendLogEntryDetail"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"description":"Returns one send 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 send 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":{"$ref":"#/components/schemas/Objects_18"}},"messages":{"type":"array","items":{"$ref":"#/components/schemas/Objects_18"}},"templates":{"type":"array","items":{"$ref":"#/components/schemas/Objects_18"}},"domains":{"type":"array","items":{"$ref":"#/components/schemas/Objects_18"}}},"required":["contacts","messages","templates","domains"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Objects_5"},"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":{"$ref":"#/components/schemas/Objects_6"},"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":{"$ref":"#/components/schemas/Objects_19"},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Objects_5"},"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":{"$ref":"#/components/schemas/Objects_6"},"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":{"$ref":"#/components/schemas/Objects_19"},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Objects_20"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Objects_20"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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":{"$ref":"#/components/schemas/Objects_21"}},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}},"required":["items","pagination"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"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":{"$ref":"#/components/schemas/Objects_21"}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"minimum":0}]},"skipped":{"type":"integer","allOf":[{"minimum":0}]}},"required":["added","skipped"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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"},"allOf":[{"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","allOf":[{"minimum":0}]}},"required":["removed"],"additionalProperties":false}}}},"401":{"description":"UnauthorizedError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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"},"allOf":[{"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"404":{"description":"ResourceNotFoundError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFoundErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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/UnauthorizedErrorJsonEncoding"}}}},"403":{"description":"ForbiddenError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorJsonEncoding"}}}},"500":{"description":"InternalError","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalErrorJsonEncoding"}}}}},"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","allOf":[{"pattern":"^conv_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"ContactId":{"type":"string","allOf":[{"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":["sms","whatsapp","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":["sms","whatsapp","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":["sms","whatsapp","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}},"smsDeliveryDetails":{"type":"array","items":{"type":"object","properties":{"deliveryId":{"type":"string"},"fromNumber":{"type":"string"},"toNumber":{"type":"string"},"segmentCount":{"type":"number"},"encoding":{"type":"string"},"dltTemplateId":{"anyOf":[{"type":"string"},{"type":"null"}]},"dltEntityId":{"anyOf":[{"type":"string"},{"type":"null"}]},"dltContentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"carrier":{"anyOf":[{"type":"string"},{"type":"null"}]},"numSegmentsReported":{"anyOf":[{"type":"number"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["deliveryId","fromNumber","toNumber","segmentCount","encoding","dltTemplateId","dltEntityId","dltContentId","carrier","numSegmentsReported","createdAt","updatedAt"],"additionalProperties":false}},"whatsappDeliveryDetails":{"type":"array","items":{"type":"object","properties":{"deliveryId":{"type":"string"},"fromNumber":{"type":"string"},"toNumber":{"type":"string"},"messageType":{"type":"string","enum":["text","image","video","audio","document","location","contacts","template","interactive","sticker","reaction","order","button","system","unsupported"]},"templateName":{"anyOf":[{"type":"string"},{"type":"null"}]},"templateLanguage":{"anyOf":[{"type":"string"},{"type":"null"}]},"templateCategory":{"anyOf":[{"type":"string"},{"type":"null"}]},"templateParams":{"anyOf":[{"$ref":"#/components/schemas/JsonObject"},{"type":"null"}]},"mediaUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"mediaType":{"anyOf":[{"type":"string"},{"type":"null"}]},"mediaS3Key":{"anyOf":[{"type":"string"},{"type":"null"}]},"interactiveType":{"anyOf":[{"type":"string"},{"type":"null"}]},"contextMessageId":{"anyOf":[{"type":"string"},{"type":"null"}]},"conversationType":{"anyOf":[{"type":"string","enum":["marketing","utility","authentication","service"]},{"type":"null"}]},"serviceWindowId":{"anyOf":[{"type":"string"},{"type":"null"}]},"freeEntryPointId":{"anyOf":[{"type":"string"},{"type":"null"}]},"isBillable":{"type":"boolean"},"pricing":{"anyOf":[{"type":"object","properties":{"messageCost":{"type":"string","allOf":[{"pattern":"^\\d+\\.\\d{4}$"}]},"reason":{"type":"string"},"sentInServiceWindow":{"type":"boolean"},"sentInFreeEntryPoint":{"type":"boolean"}},"required":["messageCost","reason","sentInServiceWindow","sentInFreeEntryPoint"],"additionalProperties":false},{"type":"null"}]},"recipientId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["deliveryId","fromNumber","toNumber","messageType","templateName","templateLanguage","templateCategory","templateParams","mediaUrl","mediaType","mediaS3Key","interactiveType","contextMessageId","conversationType","serviceWindowId","freeEntryPointId","isBillable","pricing","recipientId","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","smsDeliveryDetails","whatsappDeliveryDetails"],"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},"InternalErrorJsonEncoding":{"type":"object","properties":{"_tag":{"type":"string","enum":["InternalError"]},"operation":{"type":"string"},"message":{"type":"string"}},"required":["_tag","operation","message"],"additionalProperties":false},"ForbiddenErrorJsonEncoding":{"type":"object","properties":{"_tag":{"type":"string","enum":["ForbiddenError"]},"operation":{"type":"string"},"message":{"type":"string"}},"required":["_tag","operation","message"],"additionalProperties":false},"UnauthorizedErrorJsonEncoding":{"type":"object","properties":{"_tag":{"type":"string","enum":["UnauthorizedError"]},"operation":{"type":"string"},"message":{"type":"string"}},"required":["_tag","operation","message"],"additionalProperties":false},"MessageId":{"type":"string","allOf":[{"pattern":"^msg_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"ResourceNotFoundErrorJsonEncoding":{"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","allOf":[{"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"},"allOf":[{"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","allOf":[{"minLength":1}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email"],"additionalProperties":false},{"type":"null"}]},"EmailAttachments":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"filename":{"type":"string"},"content":{"anyOf":[{"type":"string"},{"type":"null"}]},"url":{"anyOf":[{"type":"string"},{"type":"null"}]},"contentType":{"type":"string"},"size":{"type":"integer","allOf":[{"minimum":0}]}},"required":["filename","contentType","size"],"additionalProperties":false}},{"type":"null"}]},"TemplateId":{"type":"string","allOf":[{"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","allOf":[{"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","allOf":[{"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},"SmsRecipient":{"anyOf":[{"type":"object","properties":{"contactId":{"$ref":"#/components/schemas/ContactId"}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"phone":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayName":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]}},"required":["phone"],"additionalProperties":false}]},"SmsRecipients":{"type":"array","items":{"$ref":"#/components/schemas/SmsRecipient"},"allOf":[{"minItems":1},{"maxItems":1}]},"SmsTemplateData":{"anyOf":[{"$ref":"#/components/schemas/JsonObject"},{"type":"null"}]},"SmsContent":{"type":"object","properties":{"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"templateId":{"anyOf":[{"$ref":"#/components/schemas/TemplateId"},{"type":"null"}]},"templateSlug":{"anyOf":[{"type":"string","allOf":[{"pattern":"^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$"}]},{"type":"null"}]},"templateData":{"$ref":"#/components/schemas/SmsTemplateData"}},"additionalProperties":false},"SmsSendMessagePayload":{"type":"object","properties":{"conversationId":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]},{"type":"null"}]},"metadata":{"$ref":"#/components/schemas/MessageMetadata"},"channel":{"type":"string","enum":["sms"]},"to":{"$ref":"#/components/schemas/SmsRecipients"},"sms":{"$ref":"#/components/schemas/SmsContent"}},"required":["channel","to","sms"],"additionalProperties":false,"description":"SMS sending is coming soon. The payload is accepted by the contract today and the endpoint answers 403 until the channel launches for your organization."},"WhatsAppRecipient":{"anyOf":[{"type":"object","properties":{"contactId":{"$ref":"#/components/schemas/ContactId"}},"required":["contactId"],"additionalProperties":false},{"type":"object","properties":{"whatsapp":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"displayName":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]}},"required":["whatsapp"],"additionalProperties":false}]},"WhatsAppRecipients":{"type":"array","items":{"$ref":"#/components/schemas/WhatsAppRecipient"},"allOf":[{"minItems":1},{"maxItems":1}]},"WhatsAppTemplateData":{"anyOf":[{"$ref":"#/components/schemas/JsonObject"},{"type":"null"}]},"WhatsAppContent":{"type":"object","properties":{"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"mediaUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"mediaType":{"anyOf":[{"type":"string","enum":["image","video","audio","document"]},{"type":"null"}]},"templateId":{"anyOf":[{"$ref":"#/components/schemas/TemplateId"},{"type":"null"}]},"templateSlug":{"anyOf":[{"type":"string","allOf":[{"pattern":"^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$"}]},{"type":"null"}]},"templateCategory":{"anyOf":[{"type":"string","enum":["marketing","utility","authentication"]},{"type":"null"}]},"templateData":{"$ref":"#/components/schemas/WhatsAppTemplateData"}},"additionalProperties":false},"WhatsAppSendMessagePayload":{"type":"object","properties":{"conversationId":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]},{"type":"null"}]},"metadata":{"$ref":"#/components/schemas/MessageMetadata"},"channel":{"type":"string","enum":["whatsapp"]},"to":{"$ref":"#/components/schemas/WhatsAppRecipients"},"whatsapp":{"$ref":"#/components/schemas/WhatsAppContent"}},"required":["channel","to","whatsapp"],"additionalProperties":false,"description":"WhatsApp sending is coming soon. The payload is accepted by the contract today and the endpoint answers 403 until the channel launches for your organization."},"SendMessagePayload":{"anyOf":[{"$ref":"#/components/schemas/EmailSendMessagePayload"},{"$ref":"#/components/schemas/SmsSendMessagePayload"},{"$ref":"#/components/schemas/WhatsAppSendMessagePayload"}]},"ConflictErrorJsonEncoding":{"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},"RateLimitedErrorJsonEncoding":{"type":"object","properties":{"_tag":{"type":"string","enum":["RateLimitedError"]},"operation":{"type":"string"},"retryAfterSeconds":{"type":"number"}},"required":["_tag","operation","retryAfterSeconds"],"additionalProperties":false},"PaymentRequiredErrorJsonEncoding":{"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},"BillingProviderErrorJsonEncoding":{"type":"object","properties":{"_tag":{"type":"string","enum":["BillingProviderError"]},"operation":{"type":"string"},"message":{"type":"string"}},"required":["_tag","operation","message"],"additionalProperties":false},"ExternalServiceErrorJsonEncoding":{"type":"object","properties":{"_tag":{"type":"string","enum":["ExternalServiceError"]},"operation":{"type":"string"},"message":{"type":"string"}},"required":["_tag","operation","message"],"additionalProperties":false},"ValidationErrorJsonEncoding":{"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},"FlagDisabledErrorJsonEncoding":{"type":"object","properties":{"_tag":{"type":"string","enum":["FlagDisabledError"]},"operation":{"type":"string"},"flag":{"type":"string"}},"required":["_tag","operation","flag"],"additionalProperties":false},"WebhookEnqueueErrorJsonEncoding":{"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","allOf":[{"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","allOf":[{"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},"SmsDispatchContent":{"type":"object","properties":{"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"templateId":{"anyOf":[{"$ref":"#/components/schemas/TemplateId"},{"type":"null"}]},"templateSlug":{"anyOf":[{"type":"string","allOf":[{"pattern":"^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$"}]},{"type":"null"}]},"templateData":{"$ref":"#/components/schemas/SmsTemplateData"}},"additionalProperties":false},"SmsDispatchSendMessagePayload":{"type":"object","properties":{"conversationId":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]},{"type":"null"}]},"metadata":{"$ref":"#/components/schemas/MessageMetadata"},"channel":{"type":"string","enum":["sms"]},"to":{"$ref":"#/components/schemas/SmsRecipients"},"sms":{"$ref":"#/components/schemas/SmsDispatchContent"}},"required":["channel","to","sms"],"additionalProperties":false,"description":"SMS sending is coming soon. The payload is accepted by the contract today and the endpoint answers 403 until the channel launches for your organization."},"WhatsAppDispatchContent":{"type":"object","properties":{"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"mediaUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"mediaType":{"anyOf":[{"type":"string","enum":["image","video","audio","document"]},{"type":"null"}]},"templateId":{"anyOf":[{"$ref":"#/components/schemas/TemplateId"},{"type":"null"}]},"templateSlug":{"anyOf":[{"type":"string","allOf":[{"pattern":"^(?=.{1,100}$)[a-z0-9]+(?:-[a-z0-9]+)*$"}]},{"type":"null"}]},"templateCategory":{"anyOf":[{"type":"string","enum":["marketing","utility","authentication"]},{"type":"null"}]},"templateData":{"$ref":"#/components/schemas/WhatsAppTemplateData"}},"additionalProperties":false},"WhatsAppDispatchSendMessagePayload":{"type":"object","properties":{"conversationId":{"anyOf":[{"anyOf":[{"$ref":"#/components/schemas/ConversationId"},{"type":"null"}]},{"type":"null"}]},"metadata":{"$ref":"#/components/schemas/MessageMetadata"},"channel":{"type":"string","enum":["whatsapp"]},"to":{"$ref":"#/components/schemas/WhatsAppRecipients"},"whatsapp":{"$ref":"#/components/schemas/WhatsAppDispatchContent"}},"required":["channel","to","whatsapp"],"additionalProperties":false,"description":"WhatsApp sending is coming soon. The payload is accepted by the contract today and the endpoint answers 403 until the channel launches for your organization."},"DispatchSendMessagePayload":{"anyOf":[{"$ref":"#/components/schemas/EmailDispatchSendMessagePayload"},{"$ref":"#/components/schemas/SmsDispatchSendMessagePayload"},{"$ref":"#/components/schemas/WhatsAppDispatchSendMessagePayload"}]},"AbsoluteInstantJsonEncoding":{"type":"string","allOf":[{"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","allOf":[{"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":{"anyOf":[{"$ref":"#/components/schemas/SendMessagePayload"},{"type":"object","properties":{"kind":{"type":"string","enum":["editor-session-snapshot"]},"channel":{"type":"string","enum":["email","sms","whatsapp"]},"sessionId":{"type":"string"},"revision":{"type":"string"},"templateId":{"$ref":"#/components/schemas/TemplateId"},"templateVersion":{"type":"integer","allOf":[{"exclusiveMinimum":0}]},"isTest":{"type":"boolean"}},"required":["kind","channel","sessionId","revision","templateId","templateVersion","isTest"],"additionalProperties":false}]},"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":{"type":"string"},"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},"SmsCampaignContentInput":{"type":"object","properties":{"channel":{"type":"string","enum":["sms"]},"sms":{"$ref":"#/components/schemas/SmsDispatchContent"},"conversationId":{"$ref":"#/components/schemas/CampaignConversationRef"},"metadata":{"$ref":"#/components/schemas/CampaignContentMetadata"}},"required":["channel","sms"],"additionalProperties":false},"WhatsAppCampaignContentInput":{"type":"object","properties":{"channel":{"type":"string","enum":["whatsapp"]},"whatsapp":{"$ref":"#/components/schemas/WhatsAppDispatchContent"},"conversationId":{"$ref":"#/components/schemas/CampaignConversationRef"},"metadata":{"$ref":"#/components/schemas/CampaignContentMetadata"}},"required":["channel","whatsapp"],"additionalProperties":false},"CampaignContentInput":{"anyOf":[{"$ref":"#/components/schemas/EmailCampaignContentInput"},{"$ref":"#/components/schemas/SmsCampaignContentInput"},{"$ref":"#/components/schemas/WhatsAppCampaignContentInput"}]},"ContactGroupId":{"type":"string","allOf":[{"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"},"allOf":[{"maxItems":25000}]},{"type":"null"}]},"groupIds":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ContactGroupId"},"allOf":[{"maxItems":100}]},{"type":"null"}]}},"additionalProperties":false},"CampaignPolicy":{"type":"object","properties":{"unsubscribeGroupId":{"anyOf":[{"$ref":"#/components/schemas/UnsubscribeId"},{"type":"null"}]},"pageSize":{"anyOf":[{"type":"integer","allOf":[{"minimum":100},{"maximum":1000}]},{"type":"null"}]}},"additionalProperties":false},"CampaignId":{"type":"string","allOf":[{"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},"SmsCampaignContent":{"type":"object","properties":{"channel":{"type":"string","enum":["sms"]},"sms":{"$ref":"#/components/schemas/SmsContent"},"conversationId":{"$ref":"#/components/schemas/CampaignConversationRef"},"metadata":{"$ref":"#/components/schemas/CampaignContentMetadata"}},"required":["channel","sms"],"additionalProperties":false},"WhatsAppCampaignContent":{"type":"object","properties":{"channel":{"type":"string","enum":["whatsapp"]},"whatsapp":{"$ref":"#/components/schemas/WhatsAppContent"},"conversationId":{"$ref":"#/components/schemas/CampaignConversationRef"},"metadata":{"$ref":"#/components/schemas/CampaignContentMetadata"}},"required":["channel","whatsapp"],"additionalProperties":false},"CampaignContent":{"anyOf":[{"$ref":"#/components/schemas/EmailCampaignContent"},{"$ref":"#/components/schemas/SmsCampaignContent"},{"$ref":"#/components/schemas/WhatsAppCampaignContent"}]},"Campaign":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/CampaignId"},"name":{"type":"string"},"channel":{"type":"string","enum":["sms","whatsapp","email"]},"content":{"$ref":"#/components/schemas/CampaignContent"},"audience":{"$ref":"#/components/schemas/CampaignAudience"},"policy":{"$ref":"#/components/schemas/CampaignPolicy"},"status":{"type":"string","enum":["draft","archived"]},"createdBy":{"type":"string"},"actorEmail":{"type":"string"},"memberRole":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","channel","content","audience","policy","status","createdBy","actorEmail","memberRole","createdAt","updatedAt"],"additionalProperties":false},"CampaignRunId":{"type":"string","allOf":[{"pattern":"^crun_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"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":{"type":"string"},"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","allOf":[{"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","allOf":[{"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","allOf":[{"pattern":"^dom_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"EmailSenderId":{"type":"string","allOf":[{"pattern":"^sender_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"DeliverabilityFacts":{"type":"object","properties":{"bounceRate":{"type":"number","allOf":[{"minimum":0,"maximum":1}]},"complaintRate":{"type":"number","allOf":[{"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"},"status":{"type":"string","enum":["pending","verified","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","allOf":[{"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","status","dnsRecords","verifiedAt","isDefault","defaultSenderId","deliverability","createdAt","updatedAt"],"additionalProperties":false},"EmailChannelErrorJsonEncoding":{"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","allOf":[{"pattern":"^op_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"OperationResource":{"type":"object","properties":{"type":{"type":"string","allOf":[{"minLength":1},{"maxLength":80}]},"id":{"type":"string","allOf":[{"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-unavailable","timed-out","internal"]},"message":{"type":"string","allOf":[{"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","allOf":[{"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","allOf":[{"pattern":"^\\/v1\\/"},{"maxLength":500}]},"resource":{"$ref":"#/components/schemas/OperationResourceLink"}},"required":["self","resource"],"additionalProperties":false}},"required":["operation","links"],"additionalProperties":false},"EmailDomainVerificationStatusResponseJsonEncoding":{"type":"object","properties":{"domain":{"type":"string"},"isVerified":{"type":"boolean"},"verificationStatus":{"type":"string"},"mailFromStatus":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["domain","isVerified","verificationStatus"],"additionalProperties":false},"SuccessResult":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"],"additionalProperties":false},"WebhookEndpointId":{"type":"string","allOf":[{"pattern":"^wep_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"BrandedTrackingDnsRecord":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"value":{"type":"string"}},"required":["name","type","value"],"additionalProperties":false},"BrandedTrackingStatus":{"type":"object","properties":{"enabled":{"type":"boolean"},"brandedTracking":{"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/BrandedTrackingDnsRecord"},{"type":"null"}]},"dcvDelegation":{"anyOf":[{"$ref":"#/components/schemas/BrandedTrackingDnsRecord"},{"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","brandedTracking"],"additionalProperties":false},"SuppressionId":{"type":"string","allOf":[{"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","allOf":[{"pattern":"^blk_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"BlockedEmailLogId":{"type":"string","allOf":[{"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","allOf":[{"pattern":"^fwd_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"OrganizationId":{"type":"string","allOf":[{"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","allOf":[{"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","allOf":[{"minimum":0}]},"messagesFromHuman":{"type":"integer","allOf":[{"minimum":0}]},"totalActors":{"type":"integer","allOf":[{"minimum":0}]},"contactCount":{"type":"integer","allOf":[{"minimum":0}]},"channelSwitches":{"type":"integer","allOf":[{"minimum":0}]},"channelDistribution":{"type":"object","additionalProperties":{"type":"integer","allOf":[{"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":["sms","whatsapp","email"]}},"primaryChannel":{"type":"string","enum":["sms","whatsapp","email"]},"status":{"type":"string","enum":["active","waiting","resolved","escalated","archived"]},"statusReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"priority":{"type":"integer","allOf":[{"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},"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":["sms","whatsapp","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","allOf":[{"exclusiveMinimum":0}]},"currency":{"type":"string"},"validityHours":{"anyOf":[{"type":"integer","allOf":[{"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","allOf":[{"exclusiveMinimum":0}]},{"type":"null"}]},"messagesPerDay":{"anyOf":[{"type":"integer","allOf":[{"exclusiveMinimum":0}]},{"type":"null"}]},"cooldownMinutes":{"anyOf":[{"type":"integer","allOf":[{"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","allOf":[{"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":["sms","whatsapp","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"}]},"sms":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"whatsapp":{"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","allOf":[{"exclusiveMinimum":0}]},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]}},"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"}},"engagement":{"$ref":"#/components/schemas/UnknownRecord"},"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","engagement","accessLevel","accessConfig","preferences","status","statusReason","externalId","metadata","createdAt","updatedAt","createdBy","lastModifiedBy"],"additionalProperties":false},"BulkUpdateResult":{"type":"object","properties":{"updated":{"type":"integer","allOf":[{"minimum":0}]},"failed":{"type":"integer","allOf":[{"minimum":0}]}},"required":["updated","failed"],"additionalProperties":false},"Union_":{"anyOf":[{"type":"object"},{"type":"null"}]},"Objects_":{"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":{"$ref":"#/components/schemas/Union_"},"color":{"anyOf":[{"type":"string"},{"type":"null"}]},"icon":{"anyOf":[{"type":"string"},{"type":"null"}]},"parentGroupId":{"anyOf":[{"$ref":"#/components/schemas/ContactGroupId"},{"type":"null"}]},"contactCount":{"type":"integer","allOf":[{"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},"Objects_1":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false},"CustomFieldDefinitionId":{"type":"string","allOf":[{"pattern":"^cfield_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"Union_1":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"Objects_2":{"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":{"$ref":"#/components/schemas/Union_1"},"defaultValue":{"anyOf":[{"type":"string"},{"type":"null"}]},"isRequired":{"type":"boolean"},"sortOrder":{"type":"integer","allOf":[{"minimum":0}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","key","label","type","options","defaultValue","isRequired","sortOrder","createdAt","updatedAt"],"additionalProperties":false},"TemplateFamilyId":{"type":"string","allOf":[{"pattern":"^tfam_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"TemplateFromDefault":{"type":"object","properties":{"email":{"type":"string","allOf":[{"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","allOf":[{"minimum":0}]},{"type":"null"}]},"maxLength":{"anyOf":[{"type":"number","allOf":[{"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","allOf":[{"pattern":"^user_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"TemplateCompliance":{"type":"object","properties":{"dltTemplateId":{"anyOf":[{"type":"string"},{"type":"null"}]},"dltStatus":{"anyOf":[{"type":"string","enum":["pending","approved","rejected","expired"]},{"type":"null"}]},"dltApprovedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"whatsappTemplateId":{"anyOf":[{"type":"string"},{"type":"null"}]},"whatsappStatus":{"anyOf":[{"type":"string","enum":["draft","pending","approved","published","rejected","archived"]},{"type":"null"}]},"whatsappApprovedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"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","allOf":[{"pattern":"^#[0-9a-f]{6}$"}]}},"Objects_4":{"type":"object","properties":{"source":{"type":"string","enum":["system","google","custom"]},"family":{"type":"string","allOf":[{"minLength":1}]},"fallback":{"type":"string","allOf":[{"minLength":1}]},"faces":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"weight":{"type":"number","allOf":[{"minimum":100,"maximum":900}]},"style":{"type":"string","enum":["normal","italic"]},"src":{"type":"string","allOf":[{"minLength":1}]},"unicodeRange":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["weight","style","src"],"additionalProperties":false},"allOf":[{"minItems":1}]},{"type":"null"}]}},"required":["source","family","fallback"],"additionalProperties":false},"Objects_3":{"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","allOf":[{"minimum":0}]}},{"type":"null"}]},"fontFamilies":{"anyOf":[{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Objects_4"}},{"type":"null"}]},"fontWeights":{"anyOf":[{"type":"object","additionalProperties":{"type":"number","allOf":[{"minimum":100,"maximum":900}]}},{"type":"null"}]},"text":{"anyOf":[{"type":"object","additionalProperties":{"type":"object","properties":{"sizePx":{"type":"number","allOf":[{"exclusiveMinimum":0}]},"lineHeightPx":{"type":"number","allOf":[{"exclusiveMinimum":0}]}},"required":["sizePx","lineHeightPx"],"additionalProperties":false}},{"type":"null"}]},"leading":{"anyOf":[{"type":"object","additionalProperties":{"type":"number"}},{"type":"null"}]},"spacingPx":{"anyOf":[{"type":"number","allOf":[{"exclusiveMinimum":0}]},{"type":"null"}]},"containerPx":{"anyOf":[{"type":"object","additionalProperties":{"type":"number","allOf":[{"exclusiveMinimum":0}]}},{"type":"null"}]},"tracking":{"anyOf":[{"type":"object","additionalProperties":{"type":"number"}},{"type":"null"}]}},"additionalProperties":false},"Objects_5":{"type":"object","properties":{"logoUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"logoDarkUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"iconUrl":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false},"Objects_6":{"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},"Design":{"type":"object","properties":{"theme":{"anyOf":[{"$ref":"#/components/schemas/Objects_3"},{"type":"null"}]},"assets":{"anyOf":[{"$ref":"#/components/schemas/Objects_5"},{"type":"null"}]},"footer":{"anyOf":[{"$ref":"#/components/schemas/Objects_6"},{"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":["sms","whatsapp","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"}]},"source":{"anyOf":[{"type":"string"},{"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"}]},"sms":{"anyOf":[{"type":"object","properties":{"body":{"type":"string"},"encoding":{"anyOf":[{"type":"string"},{"type":"null"}]},"estimatedSegments":{"anyOf":[{"type":"integer"},{"type":"null"}]},"category":{"anyOf":[{"type":"string","enum":["transactional","promotional","service_implicit"]},{"type":"null"}]}},"required":["body","encoding","estimatedSegments","category"],"additionalProperties":false},{"type":"null"}]},"whatsapp":{"anyOf":[{"type":"object","properties":{"name":{"type":"string"},"language":{"type":"string"},"category":{"type":"string","enum":["marketing","utility","authentication","service"]},"headerType":{"anyOf":[{"type":"string","enum":["text","image","video","document","none"]},{"type":"null"}]},"headerMediaType":{"anyOf":[{"type":"string"},{"type":"null"}]},"headerContent":{"anyOf":[{"type":"string"},{"type":"null"}]},"bodyContent":{"type":"string"},"footerContent":{"anyOf":[{"type":"string"},{"type":"null"}]},"components":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["header","body","footer","button"]},"format":{"anyOf":[{"type":"string","enum":["TEXT","IMAGE","VIDEO","DOCUMENT"]},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"example":{"anyOf":[{"type":"object","properties":{"header_text":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]},"body_text":{"anyOf":[{"type":"array","items":{"type":"array","items":{"type":"string"}}},{"type":"null"}]}},"additionalProperties":false},{"type":"null"}]},"buttons":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["QUICK_REPLY","URL","PHONE_NUMBER","COPY_CODE"]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"url":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}]},"example":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["type"],"additionalProperties":false}},{"type":"null"}]},"parameters":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text","currency","date_time","image","document","video"]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"type":"object","properties":{"fallback_value":{"type":"string"},"code":{"type":"string"},"amount_1000":{"type":"number"}},"required":["fallback_value","code","amount_1000"],"additionalProperties":false},{"type":"null"}]},"date_time":{"anyOf":[{"type":"object","properties":{"fallback_value":{"type":"string"}},"required":["fallback_value"],"additionalProperties":false},{"type":"null"}]},"image":{"anyOf":[{"type":"object","properties":{"link":{"type":"string"}},"required":["link"],"additionalProperties":false},{"type":"null"}]},"document":{"anyOf":[{"type":"object","properties":{"link":{"type":"string"},"filename":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["link"],"additionalProperties":false},{"type":"null"}]},"video":{"anyOf":[{"type":"object","properties":{"link":{"type":"string"}},"required":["link"],"additionalProperties":false},{"type":"null"}]}},"required":["type"],"additionalProperties":false}},{"type":"null"}]}},"required":["type"],"additionalProperties":false}},{"type":"null"}]},"buttons":{"anyOf":[{"type":"array","items":{"type":"object"}},{"type":"null"}]},"examples":{"anyOf":[{"type":"object"},{"type":"null"}]}},"required":["name","language","category","headerType","headerMediaType","headerContent","bodyContent","footerContent","components","buttons","examples"],"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","allOf":[{"minimum":0}]},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"isActive":{"type":"boolean"},"isDefault":{"type":"boolean"},"version":{"type":"integer","allOf":[{"exclusiveMinimum":0}]},"publishedSource":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}]},{"type":"null"}]},"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","source","email","sms","whatsapp","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":["sms","whatsapp","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","allOf":[{"exclusiveMinimum":0}]},"usageCount":{"type":"integer","allOf":[{"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":["sms","whatsapp","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","allOf":[{"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","allOf":[{"minimum":0,"maximum":1}]},{"type":"null"}]},"openRate":{"anyOf":[{"type":"number","allOf":[{"minimum":0,"maximum":1}]},{"type":"null"}]},"clickRate":{"anyOf":[{"type":"number","allOf":[{"minimum":0,"maximum":1}]},{"type":"null"}]},"responseRate":{"anyOf":[{"type":"number","allOf":[{"minimum":0,"maximum":1}]},{"type":"null"}]},"conversionRate":{"anyOf":[{"type":"number","allOf":[{"minimum":0,"maximum":1}]},{"type":"null"}]},"averageSatisfaction":{"anyOf":[{"type":"number","allOf":[{"minimum":1,"maximum":5}]},{"type":"null"}]},"totalSent":{"anyOf":[{"type":"number","allOf":[{"minimum":0}]},{"type":"null"}]},"totalDelivered":{"anyOf":[{"type":"number","allOf":[{"minimum":0}]},{"type":"null"}]},"totalOpened":{"anyOf":[{"type":"number","allOf":[{"minimum":0}]},{"type":"null"}]},"totalClicked":{"anyOf":[{"type":"number","allOf":[{"minimum":0}]},{"type":"null"}]},"totalResponses":{"anyOf":[{"type":"number","allOf":[{"minimum":0}]},{"type":"null"}]},"totalConversions":{"anyOf":[{"type":"number","allOf":[{"minimum":0}]},{"type":"null"}]},"lastUsedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"usageCount":{"anyOf":[{"type":"number","allOf":[{"minimum":0}]},{"type":"null"}]}},"additionalProperties":false},"CreateTemplatePayload":{"type":"object","properties":{"name":{"type":"string","allOf":[{"minLength":1}]},"slug":{"anyOf":[{"type":"string","allOf":[{"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","allOf":[{"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","allOf":[{"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","allOf":[{"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"}]},"source":{"anyOf":[{"type":"string","allOf":[{"minLength":1}]},{"type":"null"}]},"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","allOf":[{"exclusiveMinimum":0}]},{"type":"null"}]}},"additionalProperties":false}},"required":["data"],"additionalProperties":false},"TemplateSourceVersionId":{"type":"string","allOf":[{"pattern":"^src_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"Objects_7":{"type":"object","properties":{"id":{"type":"string"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"templateId":{"$ref":"#/components/schemas/TemplateId"},"channel":{"type":"string","enum":["sms","whatsapp","email"]},"templateVersion":{"type":"integer","allOf":[{"exclusiveMinimum":0}]},"source":{"type":"string"},"revision":{"type":"string"},"dirty":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastConnectedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastSavedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdVia":{"anyOf":[{"type":"string","enum":["api","mcp","agent"]},{"type":"null"}]},"updatedBy":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedVia":{"anyOf":[{"type":"string","enum":["api","mcp","agent"]},{"type":"null"}]}},"required":["id","organizationId","templateId","channel","templateVersion","source","revision","dirty","createdAt","updatedAt","lastConnectedAt","lastSavedAt","createdBy","createdVia","updatedBy","updatedVia"],"additionalProperties":false},"Objects_9":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"span":{"type":"object","properties":{"start":{"type":"number"},"end":{"type":"number"}},"required":["start","end"],"additionalProperties":false},"line":{"type":"number"},"column":{"type":"number"},"repair":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["replace-class","remove-class","rewrite-node","use-primitive"]},"raw":{"anyOf":[{"type":"string"},{"type":"null"}]},"suggestions":{"type":"array","items":{"type":"string"}},"explanation":{"type":"string"}},"required":["kind","suggestions","explanation"],"additionalProperties":false},{"type":"null"}]}},"required":["code","message","span","line","column"],"additionalProperties":false},"Objects_8":{"type":"object","properties":{"channel":{"type":"string","enum":["sms","whatsapp","email"]},"compile":{"type":"object","properties":{"ok":{"type":"boolean"},"diagnostics":{"type":"array","items":{"$ref":"#/components/schemas/Objects_9"}},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/Objects_9"}}},"required":["ok","diagnostics","warnings"],"additionalProperties":false},"compatibility":{"type":"array","items":{"type":"string"}},"visualQa":{"type":"object","properties":{"compileOk":{"type":"boolean"},"blockingDiagnostics":{"type":"number"},"warnings":{"type":"number"},"compatibilityWarnings":{"type":"number"},"repairableDiagnostics":{"type":"number"},"placeholders":{"type":"array","items":{"type":"string"}},"darkClassCount":{"type":"number"},"reviewModes":{"type":"array","items":{"type":"string","enum":["light","dark"]}},"recommendations":{"type":"array","items":{"type":"string"}}},"required":["compileOk","blockingDiagnostics","warnings","compatibilityWarnings","repairableDiagnostics","placeholders","darkClassCount","reviewModes","recommendations"],"additionalProperties":false}},"required":["channel","compile","compatibility","visualQa"],"additionalProperties":false},"Objects_10":{"type":"object","properties":{"orgKit":{"$ref":"#/components/schemas/Objects_3"},"templateOverrides":{"anyOf":[{"$ref":"#/components/schemas/Objects_3"},{"type":"null"}]}},"required":["orgKit","templateOverrides"],"additionalProperties":false},"Objects_11":{"type":"object","properties":{"mode":{"type":"string","enum":["http"]},"loadPath":{"type":"string"},"operationsPath":{"type":"string"},"savePath":{"type":"string"},"renderPath":{"type":"string"},"checkPath":{"type":"string"}},"required":["mode","loadPath","operationsPath","savePath","renderPath","checkPath"],"additionalProperties":false},"Objects_12":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/TemplateSourceVersionId"},"version":{"type":"integer","allOf":[{"exclusiveMinimum":0}]},"status":{"type":"string"},"isCurrent":{"type":"boolean"},"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"publishedSource":{"anyOf":[{"type":"string"},{"type":"null"}]},"publishedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string"}},"required":["id","version","status","isCurrent","source","publishedSource","publishedAt","createdAt"],"additionalProperties":false},"Objects_13":{"type":"object","properties":{"revision":{"type":"string"}},"required":["revision"],"additionalProperties":false},"Union_2":{"anyOf":[{"type":"object"},{"type":"null"}]},"Union_3":{"anyOf":[{"type":"object","properties":{"address":{"type":"string","allOf":[{"pattern":"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["address"],"additionalProperties":false},{"type":"object","properties":{"address":{"type":"string","allOf":[{"pattern":"^\\+[1-9]\\d{1,14}$"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["address"],"additionalProperties":false}]},"Union_4":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["sent"]},"messageId":{"$ref":"#/components/schemas/MessageId"}},"required":["status","messageId"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","enum":["scheduled"]},"scheduledMessageId":{"$ref":"#/components/schemas/ScheduledMessageId"},"scheduledFor":{"type":"string"}},"required":["status","scheduledMessageId","scheduledFor"],"additionalProperties":false}]},"WhatsAppTemplateIneligibleErrorJsonEncoding":{"type":"object","properties":{"_tag":{"type":"string","enum":["WhatsAppTemplateIneligibleError"]},"operation":{"type":"string"},"templateId":{"type":"string"},"reason":{"type":"string","enum":["not-published","source-mismatch","missing-provider-binding","provider-not-approved","unsupported-category"]},"message":{"type":"string"}},"required":["_tag","operation","templateId","reason","message"],"additionalProperties":false},"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","allOf":[{"pattern":"^draft_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"Objects_15":{"type":"object","properties":{"contactId":{"anyOf":[{"$ref":"#/components/schemas/ContactId"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"whatsappId":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":false},"Union_5":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/Objects_15"}},{"type":"null"}]},"Objects_16":{"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},"Objects_14":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/DraftId"},"organizationId":{"$ref":"#/components/schemas/OrganizationId"},"channel":{"type":"string"},"recipients":{"$ref":"#/components/schemas/Union_5"},"content":{"$ref":"#/components/schemas/Objects_16"},"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},"Objects_17":{"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","allOf":[{"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},"CreateMediaPayload":{"type":"object","properties":{"filename":{"type":"string","allOf":[{"minLength":1},{"maxLength":255}]},"contentType":{"type":"string","allOf":[{"minLength":1},{"maxLength":127}]},"sizeBytes":{"type":"number","allOf":[{"exclusiveMinimum":0},{"maximum":26214400}]},"purpose":{"type":"string","enum":["attachment","avatar","whatsapp_media"]},"checksumSha256":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["filename","contentType","sizeBytes","purpose"],"additionalProperties":false},"MediaId":{"type":"string","allOf":[{"pattern":"^media_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"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","allOf":[{"minimum":0}]},"width":{"anyOf":[{"type":"number","allOf":[{"exclusiveMinimum":0}]},{"type":"null"}]},"height":{"anyOf":[{"type":"number","allOf":[{"exclusiveMinimum":0}]},{"type":"null"}]},"durationMs":{"anyOf":[{"type":"number","allOf":[{"minimum":0}]},{"type":"null"}]},"purpose":{"type":"string","enum":["attachment","avatar","whatsapp_media"]},"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","allOf":[{"minimum":0}]},"width":{"anyOf":[{"type":"number","allOf":[{"exclusiveMinimum":0}]},{"type":"null"}]},"height":{"anyOf":[{"type":"number","allOf":[{"exclusiveMinimum":0}]},{"type":"null"}]},"durationMs":{"anyOf":[{"type":"number","allOf":[{"minimum":0}]},{"type":"null"}]},"purpose":{"type":"string","enum":["attachment","avatar","whatsapp_media"]},"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"},"smsUsed":{"type":"number"},"smsUsedThisMonth":{"type":"number"},"whatsappUsed":{"type":"number"},"whatsappUsedThisMonth":{"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","smsUsed","smsUsedThisMonth","whatsappUsed","whatsappUsedThisMonth","emailUsed","emailUsedThisMonth","contactsUsed","conversationsUsed","teamMembersUsed","messagesResetAt"],"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","allOf":[{"pattern":"^key_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"CreateWebhookPayload":{"type":"object","properties":{"name":{"type":"string","allOf":[{"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"]},"allOf":[{"minItems":1}]},"channels":{"anyOf":[{"type":"array","items":{"type":"string","enum":["sms","whatsapp","email"]},"allOf":[{"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"]}},"channels":{"anyOf":[{"type":"array","items":{"type":"string","enum":["sms","whatsapp","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","allOf":[{"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"]},"allOf":[{"minItems":1}]},{"type":"null"}]},"channels":{"anyOf":[{"anyOf":[{"type":"array","items":{"type":"string","enum":["sms","whatsapp","email"]},"allOf":[{"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","allOf":[{"pattern":"^whevt_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"WebhookDeliveryId":{"type":"string","allOf":[{"pattern":"^whdel_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"WebhookAttemptId":{"type":"string","allOf":[{"pattern":"^whatt_[0-9a-hjkmnp-tv-z]{16,24}$"}]},"SendLogEntry":{"type":"object","properties":{"messageId":{"$ref":"#/components/schemas/MessageId"},"channel":{"type":"string","enum":["email","sms","whatsapp"]},"status":{"type":"string","enum":["pending","scheduled","queued","processing","sent","delivered","read","failed","bounced","complained"]},"recipientCount":{"type":"integer","allOf":[{"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},"SendLogFacetRow":{"type":"object","properties":{"value":{"type":"string"},"total":{"type":"integer","allOf":[{"minimum":0}]}},"required":["value","total"],"additionalProperties":false},"SendLogApiKeyFacetRow":{"type":"object","properties":{"value":{"$ref":"#/components/schemas/ApiKeyId"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"integer","allOf":[{"minimum":0}]}},"required":["value","label","total"],"additionalProperties":false},"SendLogFacets":{"type":"object","properties":{"status":{"type":"array","items":{"$ref":"#/components/schemas/SendLogFacetRow"}},"channel":{"type":"array","items":{"$ref":"#/components/schemas/SendLogFacetRow"}},"apiKey":{"type":"array","items":{"$ref":"#/components/schemas/SendLogApiKeyFacetRow"}}},"required":["status","channel","apiKey"],"additionalProperties":false},"SendLogListResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SendLogEntry"}},"meta":{"type":"object","properties":{"page":{"type":"integer","allOf":[{"exclusiveMinimum":0}]},"limit":{"type":"integer","allOf":[{"exclusiveMinimum":0}]},"total":{"type":"integer","allOf":[{"minimum":0}]},"hasMore":{"type":"boolean"},"facets":{"anyOf":[{"$ref":"#/components/schemas/SendLogFacets"},{"type":"null"}]}},"required":["page","limit","total","hasMore"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false},"SendLogApiRequest":{"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},"SendLogEntryDetail":{"type":"object","properties":{"messageId":{"$ref":"#/components/schemas/MessageId"},"channel":{"type":"string","enum":["email","sms","whatsapp"]},"status":{"type":"string","enum":["pending","scheduled","queued","processing","sent","delivered","read","failed","bounced","complained"]},"recipientCount":{"type":"integer","allOf":[{"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/SendLogApiRequest"},{"type":"null"}]},"statusHistory":{"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":["messageId","channel","status","recipientCount","acceptedAt","createdAt","updatedAt","apiKeyId","apiKeyName","content","apiRequest","statusHistory"],"additionalProperties":false},"Objects_18":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"sublabel":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","label","sublabel"],"additionalProperties":false},"Objects_19":{"type":"object","properties":{"opens":{"type":"boolean"},"clicks":{"type":"boolean"}},"required":["opens","clicks"],"additionalProperties":false},"Objects_20":{"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},"Objects_21":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/UnsubscribeId"},"organizationId":{"type":"string"},"name":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"memberCount":{"type":"integer","allOf":[{"minimum":0}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","name","description","memberCount","createdAt","updatedAt"],"additionalProperties":false}},"securitySchemes":{"apiKey":{"type":"apiKey","name":"x-api-key","in":"header"}}},"security":[],"tags":[{"name":"Messages","description":"Multichannel message management. The send payload is a channel union: email delivers today, the SMS and WhatsApp variants are published as coming soon and answer 403 until they launch, and the read models already span every channel a message can arrive on."},{"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":"Conversation management — create, update, and manage multi-channel conversations"},{"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":"Single-channel SML template management, rendering, and compliance — the channel derives from the source's root tag"},{"name":"Editor Sessions","description":"Channel-neutral SML source editor sessions"},{"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":"Send Log","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"}]}