GET
https://www.app.ocoya.com/api/_public/v1/email/{emailId}
Get email
curl --request GET \
  --url https://www.app.ocoya.com/api/_public/v1/email/{emailId} \
  --header 'X-API-Key: <api-key>'
{
  "id": "cmwdkjtfh005gy0k4ggzzg1bs",
  "brandId": "cmayvq3hk00017apshay5qezu",
  "type": "<string>",
  "name": "Autumn sale",
  "subject": "Our autumn sale starts today",
  "preheader": "<string>",
  "status": "draft",
  "scheduledAt": "2024-01-01T00:00:00Z",
  "sentAt": "<string>",
  "error": "<string>",
  "campaignId": "<string>",
  "audience": {
    "all": true,
    "groupIds": [
      "<string>"
    ],
    "excludeGroupIds": [
      "<string>"
    ]
  },
  "createdBy": {
    "id": "<string>",
    "name": "<string>"
  },
  "createdAt": "2024-01-01T00:00:00Z",
  "updatedAt": "2024-01-01T00:00:00Z",
  "document": {
    "theme": {},
    "blocks": [
      {
        "type": "heading",
        "text": "Hi {{first_name}}",
        "level": 1
      },
      {
        "type": "text",
        "text": "Our autumn sale starts today."
      },
      {
        "type": "button",
        "label": "Shop now",
        "href": "https://example.com"
      }
    ]
  },
  "audienceCount": 120,
  "summary": {
    "recipients": 123,
    "sent": 123,
    "delivered": 123,
    "opened": 123,
    "clicked": 123,
    "bounced": 123,
    "complained": 123,
    "unsubscribed": 123,
    "failed": 123,
    "queued": 123,
    "openRate": 123,
    "clickRate": 123
  },
  "labels": [
    {
      "id": "<string>",
      "value": "<string>",
      "color": "<string>"
    }
  ],
  "waitingForApproval": true
}

Authorizations

X-API-Keystringheaderrequired

Your API key. Create one in Ocoya. Authorization: Bearer <key> works too.

Path Parameters

emailIdstringrequired

Ocoya email ID, from GET /email.

Example:"cmwdkjtfh005gy0k4ggzzg1bs"

Response

application/json

Success

idstring

Email ID.

Example:"cmwdkjtfh005gy0k4ggzzg1bs"
brandIdstring | null
Example:"cmayvq3hk00017apshay5qezu"
typestring
namestring

Internal name, shown in the app only.

Example:"Autumn sale"
subjectstring
Example:"Our autumn sale starts today"
preheaderstring | null

Preview line shown after the subject in the inbox.

statusenum<string>

generating while AI writes it (POST /email/ai), then draft, scheduled, sending, sent; failed when writing or sending failed (see error), canceled.

Available options: generating, draft, scheduled, sending, sent, failed, canceled
Example:"draft"
scheduledAtstring | null

When it is scheduled, or, for a campaign email not scheduled yet, its planned time.

Example:"2024-01-01T00:00:00Z"
sentAtstring | null
errorstring | null

Why sending failed, when it did.

campaignIdstring | null

The email campaign it belongs to, if any.

audienceobject
Show child attributesHide child attributes
audience.allboolean

true when it goes to every subscribed contact.

audience.groupIdsstring[]
audience.excludeGroupIdsstring[]
createdByobject | null
Show child attributesHide child attributes
createdBy.idstring
createdBy.namestring | null
createdAtstring
Example:"2024-01-01T00:00:00Z"
updatedAtstring
Example:"2024-01-01T00:00:00Z"
documentobject

The email body.

Show child attributesHide child attributes
document.blocksobject[]

The blocks, top to bottom. Common ones: {type: "heading", text, level}, {type: "text", text} (bold, italics and links in Markdown style), {type: "button", label, href}, {type: "image", src, alt, href}, {type: "hero", title, text, label, href, src}, {type: "divider"}, {type: "spacer", height}. Read any email with GET /email/{emailId} for the full format. Merge tags: {{first_name}}, {{last_name}}.

Example:
[
  {
    "type": "heading",
    "text": "Hi {{first_name}}",
    "level": 1
  },
  {
    "type": "text",
    "text": "Our autumn sale starts today."
  },
  {
    "type": "button",
    "label": "Shop now",
    "href": "https://example.com"
  }
]
Show child attributesHide child attributes
document.blocks.typestring
document.themeobject

Fonts, colours and spacing. Left out: the brand's on create, the email's own on update.

audienceCountinteger

Subscribed contacts it reaches now.

Example:120
summaryobject

Results, worked out from its sends.

Show child attributesHide child attributes
summary.recipientsinteger
summary.sentinteger
summary.deliveredinteger
summary.openedinteger
summary.clickedinteger
summary.bouncedinteger
summary.complainedinteger
summary.unsubscribedinteger
summary.failedinteger
summary.queuedinteger
summary.openRatenumber

Percent of delivered.

summary.clickRatenumber

Percent of delivered.

labelsobject[]
Show child attributesHide child attributes
labels.idstring
labels.valuestring
labels.colorstring | null
waitingForApprovalboolean

true while an approval it waits on is open: it cannot be scheduled until then.