GET
https://www.app.ocoya.com/api/_public/v1/email
List all emails
curl --request GET \
  --url https://www.app.ocoya.com/api/_public/v1/email \
  --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",
    "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
    }
  }
]

Authorizations

X-API-Keystringheaderrequired

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

Query Parameters

brandIdstringrequired

Ocoya brand ID. Get one from GET /brands.

Example:"cmayvq3hk00017apshay5qezu"
statusesenum<string>[]

Only emails with these statuses.

Available options: generating, draft, scheduled, sending, sent, failed, canceled
querystring

Search query used to filter results by name or matching text.

Example:"Launch"
campaignIdstring

Only the emails of this email campaign.

standaloneboolean

Only emails that are not part of a campaign.

pageinteger

Zero-based page number for paginated results.

Example:0
perPageinteger

Up to 100. Defaults to 20.

Required range: 1 <= x <= 100
Example:20

Response

application/json

Success

object[]
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"
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.