Your API key. Create one in Ocoya. Authorization: Bearer <key> works too.
Create a scheduled or a draft email
Creates an email from your own document, from a template (templateId: a built-in one laid out for the brand with its sample words to replace, or a saved one as saved), or blank. No AI and no credits: for an AI-written email use POST /email/ai. Saved as a draft, scheduled with scheduledAt, or sent with publishNow; a schedule that is refused leaves no email behind.
Create a scheduled or a draft email
curl --request POST \
--url https://www.app.ocoya.com/api/_public/v1/email \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"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"
}
]
},
"templateId": "launch",
"name": "Autumn sale",
"subject": "Our autumn sale starts today",
"preheader": "<string>",
"audience": {
"groupIds": [
"cmwdke1w70043y0k4ffzsa6om"
],
"excludeGroupIds": []
},
"scheduledAt": "2024-01-01T00:00:00Z",
"publishNow": false
}
'{
"emailId": "cmwdkjtfh005gy0k4ggzzg1bs",
"status": "draft",
"scheduledAt": null,
"recipients": 120
}Authorizations
Body
application/json
Was this page helpful?