Skip to main content
POST
/
campaigns
Create campaign
curl --request POST \
  --url https://api.mailrify.com/campaigns \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "subject": "<string>",
  "body": "<string>",
  "from": "[email protected]",
  "audienceType": "ALL",
  "description": "<string>",
  "fromName": "<string>",
  "replyTo": "[email protected]",
  "segmentId": "<string>",
  "audienceCondition": {
    "logic": "AND",
    "groups": [
      {
        "filters": [
          {
            "field": "<string>",
            "operator": "equals",
            "value": "<unknown>",
            "unit": "days"
          }
        ],
        "conditions": "<unknown>"
      }
    ]
  }
}
'
{
  "success": true,
  "data": {
    "id": "<string>",
    "name": "<string>",
    "description": "<string>",
    "subject": "<string>",
    "body": "<string>",
    "from": "[email protected]",
    "fromName": "<string>",
    "replyTo": "[email protected]",
    "audienceType": "ALL",
    "audienceCondition": {
      "logic": "AND",
      "groups": [
        {
          "filters": [
            {
              "field": "<string>",
              "operator": "equals",
              "value": "<unknown>",
              "unit": "days"
            }
          ],
          "conditions": "<unknown>"
        }
      ]
    },
    "segmentId": "<string>",
    "status": "DRAFT",
    "totalRecipients": 123,
    "sentCount": 123,
    "deliveredCount": 123,
    "openedCount": 123,
    "clickedCount": 123,
    "bouncedCount": 123,
    "scheduledFor": "2023-11-07T05:31:56Z",
    "sentAt": "2023-11-07T05:31:56Z",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "segment": {
      "id": "<string>",
      "name": "<string>",
      "description": "<string>",
      "condition": {
        "logic": "AND",
        "groups": [
          {
            "filters": [
              {
                "field": "<string>",
                "operator": "equals",
                "value": "<unknown>",
                "unit": "days"
              }
            ],
            "conditions": "<unknown>"
          }
        ]
      },
      "trackMembership": true,
      "memberCount": 123,
      "projectId": "<string>",
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z"
    }
  }
}

Authorizations

Authorization
string
header
required

API Key authentication. Secret keys (sk_*) are required for all endpoints except /v1/track. Public keys (pk_*) only work with the /v1/track endpoint for client-side event tracking. The project is automatically derived from the key.

Body

application/json
name
string
required

Campaign name

subject
string
required

Email subject line

body
string
required

HTML email body

from
string<email>
required

Sender email address (must be from verified domain)

audienceType
enum<string>
required

Target audience type

Available options:
ALL,
SEGMENT,
FILTERED
description
string

Campaign description

fromName
string

Sender name

replyTo
string<email>

Reply-to email address

segmentId
string

Segment ID (required if audienceType is SEGMENT)

audienceCondition
object

Root segment condition structure using logical groups.

Response

201 - application/json

Campaign created

success
boolean
data
object