# Email Campaigns
A campaign is a named sending channel. You point a campaign at an Email Template, then add Campaign Subscribers to it. Each subscriber you add is sent the email once.
Emails are not sent the instant you add a subscriber. They go out on the next send cycle and only during the hours sending is allowed for the recipient, so delivery can be delayed by up to a day.
# Create Campaign
POST https://<org-uuid>.production.tratta.io/api/v1/email-campaigns
curl https://<org-uuid>.production.tratta.io/api/v1/email-campaigns \
-H "Authorization: Bearer eyJ0eXA3asdk..." \
-d name="Spring Wave Q2" \
-d description="Spring offers" \
-d email_template_id="0193e6c2-...uuid"
# Parameters
name required|string|max:255
Display name for the campaign. This name is part of utm_term and utm_campaign on tracked links.
email_template_id required|uuid
The id (uuid) of an Email Template you created. Returns 422 if no template matches the uuid.
description optional|string|max:5000
Description of the campaign for internal use.
# Returns
A json with data property that contains created email campaign object.
{
"id": "uuid",
"name": "string",
"description": "string",
"email_template_id": "uuid",
"last_run_created_at": "timestamp",
"created_at": "timestamp"
}
# Get Campaign
GET https://<org-uuid>.production.tratta.io/api/v1/email-campaigns/{id}
curl https://<org-uuid>.production.tratta.io/api/v1/email-campaigns/{id} \
-H "Authorization: Bearer eyJ0eXA3asdk..."Returns the campaign. Returns 404 if no campaign matches the uuid.
# Returns
A json with data property that contains created email campaign object.
{
"id": "uuid",
"name": "string",
"description": "string",
"email_template_id": "uuid",
"last_run_created_at": "timestamp",
"created_at": "timestamp"
}
# List Campaigns
GET https://<org-uuid>.production.tratta.io/api/v1/email-campaigns
curl https://<org-uuid>.production.tratta.io/api/v1/email-campaigns \
-H "Authorization: Bearer eyJ0eXA3asdk..."# Parameters
limit optional|integer|min:1|max:200
Page size. Defaults to 25. Returns a paginated list ordered by newest first.
page optional|integer
Page number for pagination. Defaults to 1.
# Returns
A json with data property that contains array of email campaign objects.
{
"id": "uuid",
"name": "string",
"description": "string",
"email_template_id": "uuid",
"last_run_created_at": "timestamp",
"created_at": "timestamp"
}
# Update Campaign
PUT https://<org-uuid>.production.tratta.io/api/v1/email-campaigns/{id}
curl https://<org-uuid>.production.tratta.io/api/v1/email-campaigns/{id} \
-H "Authorization: Bearer eyJ0eXA3asdk..." \
-d name="Spring Wave Q2 (revised)" \
-X PUT
# Parameters
name optional|string|max:255
New display name.
description optional|string|max:5000
New description.
email_template_id optional|uuid
Swap the campaign to point at a different Email Template.
# Returns
A json with data property that contains created email campaign object.
{
"id": "uuid",
"name": "string",
"description": "string",
"email_template_id": "uuid",
"last_run_created_at": "timestamp",
"created_at": "timestamp"
}
# Delete Campaign
DELETE https://<org-uuid>.production.tratta.io/api/v1/email-campaigns/{id}
curl https://<org-uuid>.production.tratta.io/api/v1/email-campaigns/{id} \
-H "Authorization: Bearer eyJ0eXA3asdk..." \
-X DELETE
A campaign can only be deleted if it hasn't sent an email yet.
# Returns
{
"success": "boolean"
}