Back to API Reference

Email Tracking API

Track email engagement including opens, clicks, replies, and attachments. Works with public webhooks (no authentication) for tracking pixels and Power Automate integrations.

---

Base URL

https://app.datapublisher.io/api/track

---

Authentication

Most tracking endpoints are PUBLIC (no authentication required) to allow email clients and Power Automate to call them. Admin/user-facing endpoints require JWT authentication.

---

Overview

The Email Tracking API provides:

Key Features:

---

Public Endpoints (No Authentication)

Track Email Open

Record when an email is opened via tracking pixel.

Endpoint: GET /open/:trackingId

Parameters:

Response (200 OK):

Example URL:

https://app.datapublisher.io/api/track/open/abc123-def456-ghi789

How It Works:

  • Email HTML includes:
  • When email opened, browser loads image
  • API returns pixel immediately (<10ms)
  • Database updated asynchronously
  • Open timestamp recorded
  • Notes:

    ---

    Track Link Click

    Record when a link in an email is clicked.

    Endpoint: GET /click/:trackingId

    Parameters:

    Response (302 Found):

    Example URL:

    https://app.datapublisher.io/api/track/click/abc123?redirect=https%3A%2F%2Fexample.com%2Fproduct

    How It Works:

  • Original link: https://example.com/product
  • Replace with: https://app.datapublisher.io/api/track/click/TRACKING_ID?redirect=https%3A%2F%2Fexample.com%2Fproduct
  • User clicks link
  • API records click asynchronously
  • User redirected to original URL immediately
  • Notes:

    ---

    Track Reply (Power Automate Webhook)

    Mark an email as replied (called by Power Automate flow).

    Endpoint: POST /reply/:trackingId

    Parameters:

    Request Body:

    {
    

    "replyMessage": "Optional reply message content",

    "attachmentCount": 2

    }

    Response (200 OK):

    {
    

    "success": true,

    "message": "Reply tracked successfully"

    }

    Power Automate Integration:

    Trigger: When new email arrives
    

    Condition: Is reply to tracked email

    Action: HTTP POST to /api/track/reply/{trackingId}

    Body: {

    "replyMessage": @{body('Get_email')},

    "attachmentCount": @{length(attachments)}

    }

    ---

    Upload Reply Attachment

    Upload an attachment from an email reply (Power Automate webhook).

    Endpoint: POST /reply-attachment/:trackingId

    Headers:

    Content-Type: multipart/form-data

    Form Data:

    Response (200 OK):

    {
    

    "success": true,

    "attachmentId": "uuid",

    "fileName": "document.pdf",

    "fileSize": 125000,

    "uploadedDateTime": "2026-02-12T10:30:00Z"

    }

    Error Responses:

    400 Bad Request:
    {
    

    "success": false,

    "message": "No file uploaded"

    }

    ---

    Mark Reminder Sent

    Record that an automated reminder was sent (Power Automate webhook).

    Endpoint: POST /reminder-sent/:trackingId

    Parameters:

    Response (200 OK):

    {
    

    "success": true,

    "message": "Reminder marked as sent"

    }

    ---

    Authenticated Endpoints

    Get Tracking Status

    Retrieve tracking details for a specific email.

    Endpoint: GET /status/:trackingId

    Headers:

    Authorization: Bearer 

    Response (200 OK):

    {
    

    "success": true,

    "tracking": {

    "trackingId": "abc123-def456-ghi789",

    "campaignId": "campaign-uuid",

    "recipientEmail": "customer@example.com",

    "openCount": 3,

    "clickCount": 1,

    "replied": true,

    "reminderSent": false,

    "firstOpenAt": "2026-02-10T09:15:00Z",

    "lastOpenAt": "2026-02-12T08:30:00Z",

    "firstClickAt": "2026-02-10T09:20:00Z",

    "repliedAt": "2026-02-11T14:00:00Z",

    "sentAt": "2026-02-10T09:00:00Z"

    },

    "opens": [

    {

    "openedAt": "2026-02-10T09:15:00Z",

    "ipAddress": "192.168.1.1",

    "userAgent": "Mozilla/5.0..."

    }

    ],

    "clicks": [

    {

    "clickedAt": "2026-02-10T09:20:00Z",

    "clickedUrl": "https://example.com/product",

    "ipAddress": "192.168.1.1"

    }

    ],

    "replyAttachments": [

    {

    "fileName": "signed-contract.pdf",

    "fileSize": 125000,

    "uploadedAt": "2026-02-11T14:05:00Z"

    }

    ]

    }

    ---

    Get Campaign Tracking Summary

    Aggregate tracking statistics for an entire campaign.

    Endpoint: GET /campaign/:campaignId

    Headers:

    Authorization: Bearer 

    Response (200 OK):

    {
    

    "success": true,

    "campaign": {

    "campaignId": "campaign-uuid",

    "campaignName": "Welcome Campaign",

    "sentCount": 150,

    "openedCount": 98,

    "clickedCount": 45,

    "repliedCount": 12,

    "openRate": 65.3,

    "clickRate": 30.0,

    "replyRate": 8.0,

    "bounceCount": 2,

    "unsubscribeCount": 1,

    "averageTimeToOpen": "2 hours 15 minutes",

    "averageTimeToClick": "2 hours 45 minutes"

    },

    "topLinks": [

    {

    "url": "https://example.com/product",

    "clicks": 30

    },

    {

    "url": "https://example.com/pricing",

    "clicks": 15

    }

    ],

    "engagementTimeline": [

    {

    "date": "2026-02-10",

    "opens": 45,

    "clicks": 20,

    "replies": 3

    }

    ]

    }

    ---

    Download Reply Attachment

    Download a file attached to an email reply.

    Endpoint: GET /reply-attachment/:attachmentId

    Headers:

    Authorization: Bearer 

    Response (200 OK):

    ---

    Tracking Pixel Implementation

    HTML Email Template

    
    

    Hello {{FirstName}},

    Welcome to our service!

    View Product

    ---

    Power Automate Integration

    Flow: Track Email Replies

    Trigger: When a new email arrives (Office 365 Outlook)

    Condition: Is reply (In-Reply-To header matches tracked email)

    Action: HTTP POST

    {
    

    "replyMessage": "@{body('Get_email')}",

    "attachmentCount": "@{length(attachments)}"

    }

    For Each Attachment:

    ---

    Privacy & Compliance

    GDPR Compliance

    CAN-SPAM Compliance

    ---

    Rate Limiting

    ---

    Common Error Codes

    | Status Code | Description |

    |-------------|-------------|

    | 400 | Missing redirect URL or file |

    | 401 | Unauthorized - invalid JWT (authenticated endpoints only) |

    | 404 | Tracking ID not found |

    | 413 | Attachment too large (>25 MB) |

    | 500 | Internal server error |

    ---

    Best Practices

  • Test Tracking: Send test emails to verify tracking works
  • Privacy Notice: Include tracking disclosure in footer
  • Link Formatting: Ensure original URLs are properly URL-encoded
  • Pixel Placement: Place tracking pixel at end of email body
  • Unique IDs: Generate unique tracking ID per recipient
  • Webhook Security: Verify Power Automate webhook signatures
  • Attachment Storage: Clean up old reply attachments periodically
  • ---

    Related Documentation