Marketing

Manage audience segments, build email templates, and run campaigns. Track opens, clicks, bounces, and other engagement metrics across your marketing efforts.


GET/v1/marketing/segments

List segments

Retrieve a paginated list of all audience segments.

Optional parameters

  • Name
    status
    Type
    string
    Description

    Filter by status: active, archived.

  • Name
    limit
    Type
    integer
    Description

    Maximum number of records to return (default: 50).

  • Name
    offset
    Type
    integer
    Description

    Number of records to skip for pagination.

Request

GET
/v1/marketing/segments
curl https://api.umbraerp.com/v1/marketing/segments \
  -H "Authorization: Bearer <your_access_token>"

Response

{
  "result": "success",
  "segments": [
    {
      "id": "seg_abc123",
      "name": "Active Customers",
      "description": "Customers with a purchase in the last 90 days",
      "contact_count": 342,
      "status": "active",
      "created_at": "2026-01-10T08:00:00Z"
    }
  ],
  "total_count": 1
}

POST/v1/marketing/segments

Create segment

Create a new audience segment.

Required attributes

  • Name
    name
    Type
    string
    Description

    Name of the segment.

Optional attributes

  • Name
    description
    Type
    string
    Description

    Description of the segment criteria.

  • Name
    filters
    Type
    object
    Description

    Filter rules to automatically populate the segment. Supports field, operator, and value conditions.

  • Name
    contact_ids
    Type
    array
    Description

    Array of contact IDs to manually add to the segment.

Request

POST
/v1/marketing/segments
curl -X POST https://api.umbraerp.com/v1/marketing/segments \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Active Customers",
    "description": "Customers with a purchase in the last 90 days",
    "filters": {
      "conditions": [
        {
          "field": "last_purchase_date",
          "operator": "gte",
          "value": "2025-12-01"
        }
      ]
    }
  }'

Response

{
  "result": "success",
  "segment_id": "seg_abc123",
  "message": "Segment created successfully."
}

GET/v1/marketing/segments/:id

Get segment

Retrieve details of a specific segment, including contact count and filter rules.

Request

GET
/v1/marketing/segments/seg_abc123
curl https://api.umbraerp.com/v1/marketing/segments/seg_abc123 \
  -H "Authorization: Bearer <your_access_token>"

Response

{
  "result": "success",
  "segment": {
    "id": "seg_abc123",
    "name": "Active Customers",
    "description": "Customers with a purchase in the last 90 days",
    "contact_count": 342,
    "status": "active",
    "filters": {
      "conditions": [
        {
          "field": "last_purchase_date",
          "operator": "gte",
          "value": "2025-12-01"
        }
      ]
    },
    "created_at": "2026-01-10T08:00:00Z",
    "updated_at": "2026-01-10T08:00:00Z"
  }
}

PUT/v1/marketing/segments/:id

Update segment

Update an existing segment's name, description, or filter rules.

Optional attributes

  • Name
    name
    Type
    string
    Description

    Updated segment name.

  • Name
    description
    Type
    string
    Description

    Updated description.

  • Name
    filters
    Type
    object
    Description

    Updated filter rules.

  • Name
    status
    Type
    string
    Description

    Set to active or archived.

Request

PUT
/v1/marketing/segments/seg_abc123
curl -X PUT https://api.umbraerp.com/v1/marketing/segments/seg_abc123 \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Active Customers (90 Days)",
    "status": "active"
  }'

Response

{
  "result": "success",
  "message": "Segment updated successfully."
}

DELETE/v1/marketing/segments/:id

Delete segment

Delete an audience segment. This does not delete the contacts within the segment.

Request

DELETE
/v1/marketing/segments/seg_abc123
curl -X DELETE https://api.umbraerp.com/v1/marketing/segments/seg_abc123 \
  -H "Authorization: Bearer <your_access_token>"

Response

{
  "result": "success",
  "message": "Segment deleted successfully."
}

GET/v1/marketing/templates

List templates

Retrieve a paginated list of all email templates.

Optional parameters

  • Name
    status
    Type
    string
    Description

    Filter by status: draft, published, archived.

  • Name
    limit
    Type
    integer
    Description

    Maximum number of records to return (default: 50).

  • Name
    offset
    Type
    integer
    Description

    Number of records to skip for pagination.

Request

GET
/v1/marketing/templates
curl https://api.umbraerp.com/v1/marketing/templates \
  -H "Authorization: Bearer <your_access_token>"

Response

{
  "result": "success",
  "templates": [
    {
      "id": "tmpl_001",
      "name": "Monthly Newsletter",
      "subject": "Your monthly update from {{company_name}}",
      "status": "published",
      "created_at": "2026-01-05T09:00:00Z",
      "updated_at": "2026-02-01T14:30:00Z"
    }
  ],
  "total_count": 1
}

POST/v1/marketing/templates

Create template

Create a new email template.

Required attributes

  • Name
    name
    Type
    string
    Description

    Internal name for the template.

  • Name
    subject
    Type
    string
    Description

    Email subject line. Supports merge tags like {{first_name}}.

  • Name
    html_body
    Type
    string
    Description

    HTML content of the email. Supports merge tags.

Optional attributes

  • Name
    text_body
    Type
    string
    Description

    Plain text version of the email.

  • Name
    from_name
    Type
    string
    Description

    Sender display name.

  • Name
    from_email
    Type
    string
    Description

    Sender email address (must be a verified domain).

Request

POST
/v1/marketing/templates
curl -X POST https://api.umbraerp.com/v1/marketing/templates \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Monthly Newsletter",
    "subject": "Your monthly update from {{company_name}}",
    "html_body": "<h1>Hello {{first_name}}</h1><p>Here is your monthly update.</p>",
    "text_body": "Hello {{first_name}}, here is your monthly update.",
    "from_name": "Marketing Team",
    "from_email": "marketing@example.com"
  }'

Response

{
  "result": "success",
  "template_id": "tmpl_001",
  "message": "Template created successfully."
}

GET/v1/marketing/templates/:id

Get template

Retrieve details of a specific email template, including its HTML and text content.

Request

GET
/v1/marketing/templates/tmpl_001
curl https://api.umbraerp.com/v1/marketing/templates/tmpl_001 \
  -H "Authorization: Bearer <your_access_token>"

Response

{
  "result": "success",
  "template": {
    "id": "tmpl_001",
    "name": "Monthly Newsletter",
    "subject": "Your monthly update from {{company_name}}",
    "html_body": "<h1>Hello {{first_name}}</h1><p>Here is your monthly update.</p>",
    "text_body": "Hello {{first_name}}, here is your monthly update.",
    "from_name": "Marketing Team",
    "from_email": "marketing@example.com",
    "status": "published",
    "created_at": "2026-01-05T09:00:00Z",
    "updated_at": "2026-02-01T14:30:00Z"
  }
}

PUT/v1/marketing/templates/:id

Update template

Update an existing email template.

Optional attributes

  • Name
    name
    Type
    string
    Description

    Updated template name.

  • Name
    subject
    Type
    string
    Description

    Updated subject line.

  • Name
    html_body
    Type
    string
    Description

    Updated HTML content.

  • Name
    text_body
    Type
    string
    Description

    Updated plain text content.

  • Name
    status
    Type
    string
    Description

    Set to draft, published, or archived.

Request

PUT
/v1/marketing/templates/tmpl_001
curl -X PUT https://api.umbraerp.com/v1/marketing/templates/tmpl_001 \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "subject": "Your February update from {{company_name}}",
    "status": "published"
  }'

Response

{
  "result": "success",
  "message": "Template updated successfully."
}

DELETE/v1/marketing/templates/:id

Delete template

Delete an email template. Templates that are currently in use by active campaigns cannot be deleted.

Request

DELETE
/v1/marketing/templates/tmpl_001
curl -X DELETE https://api.umbraerp.com/v1/marketing/templates/tmpl_001 \
  -H "Authorization: Bearer <your_access_token>"

Response

{
  "result": "success",
  "message": "Template deleted successfully."
}

GET/v1/marketing/campaigns

List campaigns

Retrieve a paginated list of all email campaigns.

Optional parameters

  • Name
    status
    Type
    string
    Description

    Filter by status: draft, scheduled, sending, sent, paused, cancelled.

  • Name
    limit
    Type
    integer
    Description

    Maximum number of records to return (default: 50).

  • Name
    offset
    Type
    integer
    Description

    Number of records to skip for pagination.

Request

GET
/v1/marketing/campaigns
curl https://api.umbraerp.com/v1/marketing/campaigns \
  -H "Authorization: Bearer <your_access_token>"

Response

{
  "result": "success",
  "campaigns": [
    {
      "id": "cmp_001",
      "name": "February Newsletter",
      "template_id": "tmpl_001",
      "segment_id": "seg_abc123",
      "status": "sent",
      "sent_at": "2026-02-01T10:00:00Z",
      "created_at": "2026-01-28T14:00:00Z"
    }
  ],
  "total_count": 1
}

POST/v1/marketing/campaigns

Create campaign

Create a new email campaign.

Required attributes

  • Name
    name
    Type
    string
    Description

    Campaign name.

  • Name
    template_id
    Type
    string
    Description

    ID of the email template to use.

  • Name
    segment_id
    Type
    string
    Description

    ID of the audience segment to send to.

Optional attributes

  • Name
    subject_override
    Type
    string
    Description

    Override the template's subject line for this campaign.

  • Name
    from_name_override
    Type
    string
    Description

    Override the sender display name.

  • Name
    from_email_override
    Type
    string
    Description

    Override the sender email address.

  • Name
    reply_to
    Type
    string
    Description

    Reply-to email address.

Request

POST
/v1/marketing/campaigns
curl -X POST https://api.umbraerp.com/v1/marketing/campaigns \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "February Newsletter",
    "template_id": "tmpl_001",
    "segment_id": "seg_abc123",
    "reply_to": "replies@example.com"
  }'

Response

{
  "result": "success",
  "campaign_id": "cmp_001",
  "message": "Campaign created successfully."
}

GET/v1/marketing/campaigns/:id

Get campaign

Retrieve details of a specific campaign, including its current status and configuration.

Request

GET
/v1/marketing/campaigns/cmp_001
curl https://api.umbraerp.com/v1/marketing/campaigns/cmp_001 \
  -H "Authorization: Bearer <your_access_token>"

Response

{
  "result": "success",
  "campaign": {
    "id": "cmp_001",
    "name": "February Newsletter",
    "template_id": "tmpl_001",
    "segment_id": "seg_abc123",
    "status": "draft",
    "reply_to": "replies@example.com",
    "created_at": "2026-01-28T14:00:00Z",
    "updated_at": "2026-01-28T14:00:00Z"
  }
}

POST/v1/marketing/campaigns/:id/send

Send campaign

Send a campaign immediately. The campaign must be in draft or scheduled status.

Request

POST
/v1/marketing/campaigns/cmp_001/send
curl -X POST https://api.umbraerp.com/v1/marketing/campaigns/cmp_001/send \
  -H "Authorization: Bearer <your_access_token>"

Response

{
  "result": "success",
  "message": "Campaign is being sent.",
  "recipients_count": 342
}

POST/v1/marketing/campaigns/:id/schedule

Schedule campaign

Schedule a campaign for future delivery. The campaign must be in draft status.

Required attributes

  • Name
    scheduled_at
    Type
    string
    Description

    ISO 8601 datetime for when the campaign should be sent (e.g., 2026-03-15T10:00:00Z).

Request

POST
/v1/marketing/campaigns/cmp_001/schedule
curl -X POST https://api.umbraerp.com/v1/marketing/campaigns/cmp_001/schedule \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "scheduled_at": "2026-03-15T10:00:00Z"
  }'

Response

{
  "result": "success",
  "message": "Campaign scheduled successfully.",
  "scheduled_at": "2026-03-15T10:00:00Z"
}

POST/v1/marketing/campaigns/:id/pause

Pause campaign

Pause a campaign that is currently sending or scheduled. Pausing a sending campaign will stop delivery to remaining recipients.

Request

POST
/v1/marketing/campaigns/cmp_001/pause
curl -X POST https://api.umbraerp.com/v1/marketing/campaigns/cmp_001/pause \
  -H "Authorization: Bearer <your_access_token>"

Response

{
  "result": "success",
  "message": "Campaign paused successfully."
}

POST/v1/marketing/campaigns/:id/cancel

Cancel campaign

Cancel a campaign. Only campaigns in draft, scheduled, or paused status can be cancelled. This action is irreversible.

Request

POST
/v1/marketing/campaigns/cmp_001/cancel
curl -X POST https://api.umbraerp.com/v1/marketing/campaigns/cmp_001/cancel \
  -H "Authorization: Bearer <your_access_token>"

Response

{
  "result": "success",
  "message": "Campaign cancelled successfully."
}

GET/v1/marketing/campaigns/:id/analytics

Campaign analytics

Retrieve performance analytics for a sent campaign, including opens, clicks, bounces, and unsubscribes.

Request

GET
/v1/marketing/campaigns/cmp_001/analytics
curl https://api.umbraerp.com/v1/marketing/campaigns/cmp_001/analytics \
  -H "Authorization: Bearer <your_access_token>"

Response

{
  "result": "success",
  "analytics": {
    "campaign_id": "cmp_001",
    "recipients": 342,
    "delivered": 338,
    "opened": 186,
    "open_rate": 55.03,
    "clicked": 72,
    "click_rate": 21.30,
    "bounced": 4,
    "bounce_rate": 1.17,
    "unsubscribed": 2,
    "unsubscribe_rate": 0.59,
    "spam_reports": 0,
    "last_updated_at": "2026-02-02T08:00:00Z"
  }
}

Was this page helpful?