Security

Detect and remove tracking pixels

Detect and optionally remove tracking pixels from HTML emails and documents.

What Are Tracking Pixels?

Tracking pixels are invisible elements embedded in emails and documents to monitor:

  • When and where the document is opened
  • How many times it's viewed
  • Geographic location and device information

Detection Capabilities

Known Tracking Services

Automatically identifies pixels from major email marketing and analytics platforms:

  • Email Marketing: Mailchimp, SendGrid, HubSpot, ConvertKit, Mandrill, Mailgun
  • Social Media: Facebook, LinkedIn, Twitter/X, Pinterest
  • Analytics: Google Analytics, Bing, Quantcast, ComScore

Detection Indicators

  • 1x1 pixel dimensions - Classic tracking pixel signature
  • Hidden elements - CSS hiding (display:none, visibility:hidden, opacity:0)
  • Tracking URLs - Paths containing /track/, /pixel/, /beacon/, /open/
  • Query parameters - UTM parameters, subscriber IDs, campaign IDs
  • Encoded paths - Long base64-encoded tracking identifiers

Response

Returns a list of all detected tracking pixels with:

  • URL and type (image, iframe, beacon)
  • Confidence score (0.0 - 1.0)
  • Known source identification (if recognized)
  • Reasons why it was flagged

When remove=true, the response includes the cleaned file content.

Example

import httpx
import base64

# Detect tracking pixels
response = httpx.post(
    "https://api.filegraph.ai/security/detect-tracking",
    headers={"X-API-Key": "your-api-key"},
    files={"file": open("email.html", "rb")},
    data={"remove": "false"}
)

result = response.json()
print(f"Found {len(result['pixels_found'])} tracking pixels")

# Remove tracking pixels
response = httpx.post(
    "https://api.filegraph.ai/security/detect-tracking",
    headers={"X-API-Key": "your-api-key"},
    files={"file": open("email.html", "rb")},
    data={"remove": "true"}
)

result = response.json()
if result["was_modified"]:
    cleaned = base64.b64decode(result["content_base64"])
    with open("email_cleaned.html", "wb") as f:
        f.write(cleaned)
post/security/detect-tracking

Request

  • Base URL: https://api.filegraph.ai (the document declares no server; this is the origin it was published from)
  • URL: https://api.filegraph.ai/security/detect-tracking
  • Auth: API key in header X-API-Key

Response

Successful Response

pixels_removedinteger required

Number of tracking pixels that were removed (0 if remove=false)

document_typestring required

Detected document type (e.g., 'text/html', 'message/rfc822')

was_modifiedboolean required

Whether the document was modified (pixels were removed)

filenamestring nullable

Output filename (only when modified)

content_typestring nullable

MIME type of the output file (only when modified)

size_bytesinteger nullable

Size of cleaned file in bytes (only when modified)

content_base64string nullable

Base64-encoded cleaned file content (only when modified)

Example response

{
  "content_base64": "PCFET0NUWVBFIGh0bWw+...",
  "content_type": "text/html",
  "document_type": "text/html",
  "filename": "cleaned_email.html",
  "pixels_found": [
    {
      "confidence": 0.95,
      "location": "img[2]",
      "reasons": [
        "Known tracking domain: track.mailchimp.com",
        "1x1 pixel dimensions"
      ],
      "source": "mailchimp",
      "type": "image",
      "url": "https://track.mailchimp.com/open.php?u=abc123"
    }
  ],
  "pixels_removed": 1,
  "size_bytes": 4521,
  "was_modified": true
}

Changes

No recorded changes to this operation across all 1 revision of this API.