Parameters

NameTypeRequiredDescription
brandIdstringYesOcoya brand id from ocoya_list_brands.
documentobjectNoThe email body: {theme?, blocks: […]}. Each block has a type, e.g. {type: “heading”, text, level?: 1-4}, {type: “text”, text} (Markdown-style bold, italics, links), {type: “button”, label, href}, {type: “image”, src, alt?, href?}, {type: “divider”}, {type: “spacer”, height?}, {type: “hero”, title, text?, label?, href?, src?}. Read an existing email with ocoya_get_email to see the full format; the theme is the brand’s when left out.
templateIdstringNoTemplate id from ocoya_list_email_templates.
namestringNoInternal name, shown in the app only.
subjectstringNo—
preheaderstringNoPreview line shown after the subject in the inbox.
audienceobjectNoWho gets it: every subscribed contact (omit groupIds), or the contacts in any of groupIds, minus anyone in excludeGroupIds. Group ids from ocoya_list_contact_groups.
scheduledAtstringNoISO datetime to send it at. Omit for a draft.
publishNowbooleanNoSend it to its whole audience at once.

Request example

{
  "name": "ocoya_create_email",
  "arguments": {
    "brandId": "cmayvq3hk00017apshay5qezu",
    "scheduledAt": "2026-07-01T09:00:00Z"
  }
}

Returns

Returns the result of the call as JSON.