Skip to content

MarkTag API ​

The MarkTag endpoints allow you to generate and verify tracking implementations for merchant domains.

Endpoints ​

Generate MarkTag ​

Generate tracking implementation for a merchant. Choose from three types based on your specific needs:

Choosing the Right MarkTag Type ​

Quick Decision Guide:

Need tracking NOW? → Use client-side
Merchant wants their own domain? → Use server-side
Integrating many merchants on your platform? → Use preverified

MarkTag Type Comparison ​

TypeSetup TimeDNS RequiredDomain UsedBest For
client-sideInstantNomtag.markopolo.aiQuick starts, testing, non-technical merchants
server-side5-30 minYes (merchant's)Merchant's customEnterprise, domain control, ad blocker resistance
preverifiedInstantNo (uses yours)Your partner domainPlatform merchants, white-label, bulk onboarding

Detailed Type Descriptions ​

client-side 🚀

  • JavaScript-based tracking using mtag.markopolo.ai
  • No DNS configuration ever required
  • Works instantly after generation
  • Perfect for immediate tracking needs

server-side 🏢

  • DNS-based tracking on merchant's custom domain
  • Merchant must configure CNAME record
  • Requires verification before activation
  • Best for enterprise requirements

preverified 🎯

  • DNS-based tracking on your pre-configured partner domain
  • Uses CNAME you set up during onboarding
  • Activates instantly without merchant DNS setup
  • Ideal for platform-integrated merchants

Endpoint: POST /v1/partners/marktag/generate

Headers:

Authorization: Bearer mp_live_YOUR_TOKEN
Content-Type: application/json

Request Body:

json
{
  "merchantId": "01d1f5db-848d-4410-bb38-7e2c5b084ec8",
  "type": "server-side",
  "domain": "example.com" // Only required for server-side type
}

Request Body Parameters:

FieldTypeRequiredDescriptionValidation
merchantIdstringYesMerchant identifierValid UUID format
typestringYesType of marktag to generateMust be: "server-side", "client-side", or "preverified"
domainstringConditionalRoot domain name onlyRequired for "server-side" type only. Must be valid domain without protocol or www prefix. Optional for "preverified" (auto-derived from partner config)

Type-Specific Requirements:

TypeDomain FieldDNS SetupVerificationTime to Active
client-sideNot neededNeverNoInstant
server-sideRequiredMerchant configuresYes5-30 minutes
preverifiedOptionalPre-configured by youNoInstant

Decision Flow ​

Domain Validation Rules (for server-side):

  • Domain must be a root domain (e.g., "example.com")
  • No protocol prefix (http:// or https://)
  • No www prefix
  • Must be a valid domain format
  • Cannot be a preverified partner domain
  • Pattern: ^(?!.*:\/\/)(?!www\.)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$

Example Requests:

Client-Side MarkTag (No DNS Required):

bash
curl -X POST "https://api-alpha.markopolo.ai/v1/partners/marktag/generate" \
  -H "Authorization: Bearer mp_live_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantId": "01d1f5db-848d-4410-bb38-7e2c5b084ec8",
    "type": "client-side"
  }'

Server-Side MarkTag (Custom Domain):

bash
curl -X POST "https://api-alpha.markopolo.ai/v1/partners/marktag/generate" \
  -H "Authorization: Bearer mp_live_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantId": "01d1f5db-848d-4410-bb38-7e2c5b084ec8",
    "type": "server-side",
    "domain": "example.com"
  }'

Preverified MarkTag (Partner Domain):

bash
curl -X POST "https://api-alpha.markopolo.ai/v1/partners/marktag/generate" \
  -H "Authorization: Bearer mp_live_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantId": "01d1f5db-848d-4410-bb38-7e2c5b084ec8",
    "type": "preverified"
  }'

Success Responses (200 OK):

Client-Side Response:

json
{
  "status": "active",
  "message": "New tag created successfully",
  "type": "client-side"
}

Server-Side Response:

json
{
  "record": {
    "type": "CNAME",
    "name": "mtag-h7k9",
    "value": "mts1.markopolo.ai",
    "ttl": 300
  },
  "status": "inactive",
  "message": "New tag created successfully",
  "type": "server-side"
}

Preverified Response:

json
{
  "record": {
    "type": "CNAME",
    "name": "mtag-k3m7",
    "value": "mts1.markopolo.ai",
    "ttl": 300
  },
  "status": "active",
  "message": "New tag created successfully",
  "type": "preverified"
}

Response Fields:

FieldTypeDescriptionPresent For
typestringType of marktag ("client-side", "server-side", or "preverified")All types
statusstringCurrent status ("active" or "inactive")All types
messagestringStatus message ("New tag created successfully" or "Existing tag retrieved")All types
recordobjectDNS CNAME record to be added to domainserver-side, preverified only
record.typestringDNS record type (always "CNAME")server-side, preverified only
record.namestringSubdomain name for the CNAME recordserver-side, preverified only
record.valuestringTarget value for the CNAME recordserver-side, preverified only
record.ttlnumberTime-to-live in secondsserver-side, preverified only

Status Field Reference:

Understanding the status field helps you manage marktag lifecycle:

TypeInitial StatusBecomes ActiveAction Required
client-sideactiveImmediatelyNone
server-sideinactiveAfter DNS verificationCall verify endpoint
preverifiedactiveImmediatelyNone

Error Responses:

HTTP StatusError CodeDescription
400VALIDATION_ERRORInvalid request parameters (missing merchantId, invalid type, missing/invalid domain for server-side, server-side attempting to use preverified domain)
401AUTHENTICATION_ERRORMissing or invalid Bearer token
403FORBIDDENAccess denied - merchant doesn't belong to partner
404NOT_FOUNDMerchant doesn't exist
409VALIDATION_ERRORDomain already registered
500SERVICE_ERRORUnable to process request

For detailed error handling, see the Error Handling Guide.

Important Notes:

Progressive Enhancement Strategy:

  • Start with client-side for immediate tracking (always available)
  • Add server-side when merchant configures their domain (always available)
  • Use preverified for platform-integrated features (requires prior setup)
  • Each merchant can have one marktag of each type

Availability:

  • Client-side & Server-side: Available to all partners immediately
  • Preverified: Requires setup process with Markopolo (contact partners@markopolo.ai)

DNS Configuration:

  • Client-side: No DNS ever required - works with JavaScript
  • Server-side: Merchant adds CNAME to their domain
  • Preverified: You configured CNAME once during onboarding

Activation Timeline:

  • Client-side: Active immediately, no verification needed
  • Server-side: Active after DNS propagation and verification
  • Preverified: Active immediately using your pre-configured domain

Common Use Cases:

  • Testing/Development: Use client-side for instant results
  • Enterprise Merchants: Use server-side for domain control
  • SaaS Platforms: Use preverified for seamless integration
  • Mixed Approach: Start with client-side, add others as needed

Verify MarkTag ​

Verify DNS configuration for server-side marktags. This endpoint activates tracking after DNS setup.

Verification Requirements by Type ​

MarkTag TypeVerification RequiredReason
client-side❌ NeverNo DNS involved
server-side✅ AlwaysMust verify merchant's DNS
preverified❌ NeverUses pre-verified partner domain

When to use this endpoint:

  • Only for server-side marktags
  • After merchant adds CNAME to their domain
  • After waiting for DNS propagation (5-30 minutes)
  • To activate tracking on merchant's custom domain

Skip this endpoint for:

  • Client-side marktags - They're active immediately
  • Preverified marktags - They use your pre-configured domain

Endpoint: POST /v1/partners/marktag/verify

Headers:

Authorization: Bearer mp_live_YOUR_TOKEN
Content-Type: application/json

Request Body:

json
{
  "merchantId": "01d1f5db-848d-4410-bb38-7e2c5b084ec8",
  "subdomain": "mtag-h7k9.example.com"
}

Request Body Parameters:

FieldTypeRequiredDescriptionValidation
merchantIdstringYesMerchant identifier used to resolve server marktagNon-empty string
subdomainstringYesSubdomain to verifyValid subdomain without protocol

Subdomain Validation Rules:

  • Must not include protocol (http:// or https://)
  • Can include multiple subdomain levels (e.g., "api.shop.example.com")
  • Must be a valid domain format
  • Pattern: ^(?!.*:\/\/)([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.[a-zA-Z]{2,}$

Example Request:

bash
curl -X POST "https://api-alpha.markopolo.ai/v1/partners/marktag/verify" \
  -H "Authorization: Bearer mp_live_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantId": "01d1f5db-848d-4410-bb38-7e2c5b084ec8",
    "subdomain": "mtag-h7k9.example.com"
  }'

Success Response (200 OK):

json
{
  "verified": true
}

Response Fields:

FieldTypeDescription
verifiedbooleanWhether the MarkTag installation was successfully verified

Error Responses:

HTTP StatusError CodeDescription
400VALIDATION_ERRORInvalid subdomain format or DNS configuration error
401AUTHENTICATION_ERRORMissing or invalid Bearer token
403FORBIDDENAccess denied - merchant doesn't belong to partner
404NOT_FOUNDMerchant has no verifiable server-side/preverified marktag
422VALIDATION_ERRORDNS verification pending - allow time for DNS propagation
500SERVICE_ERRORUnable to process request

Important DNS Verification States:

  • 422 Status: DNS records have been added but haven't propagated yet. This is a temporary state - retry after waiting for DNS propagation (typically 5-30 minutes).
  • 400 Status: DNS records are either missing or incorrectly configured. Check the CNAME record configuration.
  • 200 Status: DNS is properly configured and verified.

Example 422 Response (DNS Pending):

json
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "DNS verification pending. Please allow time for DNS propagation and try again",
    "statusCode": 422,
    "timestamp": "2026-02-16T08:15:31.482Z",
    "path": "/v1/partners/marktag/verify",
    "method": "POST"
  }
}

For detailed error handling, see the Error Handling Guide.

Verification Process:

  • The system extracts the root domain from the subdomain
  • Verifies ownership of the merchant associated with the tag
  • Calls external service to verify DNS configuration
  • Returns different status codes based on DNS state:
    • 200: DNS verified successfully - tag activated
    • 422: DNS pending propagation - retry later
    • 400: DNS misconfigured - check CNAME setup
  • Updates tag status to 'waiting_for_events' upon successful verification
  • Updates both isConnected and isVerified flags

Implementation Guide ​

Complete MarkTag Setup Flow by Type ​

Client-Side MarkTag (Simplest) ​

  1. Generate MarkTag - Create with type: "client-side" (no domain needed)
  2. Install Tracking Code - Add JavaScript to merchant's website using mtag.markopolo.ai
  3. Start Collecting Data - Immediately begins tracking events

Server-Side MarkTag (Custom Domain) ​

  1. Generate MarkTag - Create with type: "server-side" and merchant's domain
  2. Configure DNS - Merchant adds the provided CNAME record to their domain's DNS settings
  3. Wait for Propagation - DNS changes typically take 5-30 minutes to propagate
  4. Verify Installation - Use the verify endpoint to confirm DNS configuration
  5. Install Tracking Code - Add tracking code to merchant's website
  6. Start Collecting Data - Once verified, MarkTag begins tracking events

Preverified MarkTag (Partner Domain) ​

  1. Generate MarkTag - Create with type: "preverified" (domain auto-derived)
  2. Install Tracking Code - Add tracking code using your partner domain
  3. Start Collecting Data - Immediately begins tracking events

DNS Configuration Guide ​

Partner Domain Setup (One-time during onboarding) ​

During onboarding with partners@markopolo.ai, you'll receive a CNAME record to add to your domain. This enables all preverified marktags under your domain.

Custom Merchant Domain Setup ​

For merchants using their own domains, they'll need to add CNAME records after you generate their MarkTag:

Example DNS Record ​

Type: CNAME
Name: mtag
Value: mtag.markopolo.ai
TTL: 300

Common DNS Providers ​

Cloudflare:

  1. Log in to Cloudflare dashboard
  2. Select your domain
  3. Go to DNS section
  4. Click "Add record"
  5. Select Type: CNAME
  6. Enter Name: mtag
  7. Enter Target: mtag.markopolo.ai
  8. Set TTL: Auto or 5 minutes
  9. Save

GoDaddy:

  1. Log in to GoDaddy account
  2. Go to Domain Settings
  3. Select DNS Management
  4. Add new CNAME record
  5. Host: mtag
  6. Points to: mtag.markopolo.ai
  7. TTL: 600 seconds
  8. Save

Route 53 (AWS):

  1. Open Route 53 console
  2. Select your hosted zone
  3. Create Record
  4. Record type: CNAME
  5. Record name: mtag
  6. Value: mtag.markopolo.ai
  7. TTL: 300
  8. Create records

DNS Propagation ​

  • DNS changes typically propagate within 5-30 minutes
  • Maximum propagation time can be up to 48 hours
  • Use online DNS checkers to verify propagation status
  • The verify endpoint will confirm when DNS is properly configured

Quick Reference: Choosing MarkTag Types ​

Decision Matrix ​

ScenarioRecommended TypeWhy
Need tracking right nowclient-sideNo DNS wait, instant activation
Testing the integrationclient-sideQuick setup, no infrastructure
Enterprise with IT teamserver-sideFull domain control, first-party
Many merchants on your platformpreverifiedNo merchant DNS, your domain
Non-technical merchantsclient-side or preverifiedNo DNS knowledge required
Concerned about ad blockersserver-side or preverifiedFirst-party domain tracking
White-label solution neededpreverifiedUses your branded domain
Progressive rolloutStart client-side, add othersImmediate tracking, enhance later

Setup Complexity ​

TypeMerchant EffortPartner EffortTime to Live
client-sideQuick merchant onboarding, testing, small merchantsInstantNone - just add JavaScript
server-sideEnterprise merchants, custom domains, full control5-30 min (DNS)DNS access, domain ownership
preverifiedMerchants on your platform, seamless integrationInstantUses your partner domain

Best Practices ​

Domain Validation ​

Always validate domain format before making API calls:

  • For generate endpoint: Use root domain only (e.g., example.com)
  • For verify endpoint: Use full subdomain (e.g., shop.example.com)
  • No protocol prefixes (http:// or https://)
  • No www prefix for root domains

Error Handling ​

Implement specific error handling for different scenarios:

  • 400 VALIDATION_ERROR: Invalid parameters or DNS misconfiguration
  • 401 AUTHENTICATION_ERROR: Authentication issues
  • 403 FORBIDDEN: Access denied to resource
  • 404 NOT_FOUND: Merchant not found or merchant has no verifiable server-side/preverified marktag
  • 422 VALIDATION_ERROR: DNS pending propagation (retry after waiting)
  • 500 SERVICE_ERROR: Server errors requiring retry

Handling DNS Verification States:

javascript
async function verifyMarkTag(merchantId, subdomain) {
  try {
    const response = await fetch('/v1/partners/marktag/verify', {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${token}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ merchantId, subdomain }),
    });

    if (response.status === 200) {
      console.log('✓ DNS verified successfully');
      return { verified: true };
    }

    const error = await response.json();

    if (response.status === 422) {
      console.log('⏳ DNS propagation pending, retry in a few minutes');
      // Implement retry logic with delay
      return { verified: false, pending: true };
    }

    if (response.status === 400) {
      console.error('❌ DNS configuration error - check CNAME records');
      return { verified: false, pending: false };
    }

    throw error;
  } catch (error) {
    console.error('Verification failed:', error);
    throw error;
  }
}

For comprehensive error handling examples and best practices, see the Error Handling Guide.

Next Steps ​

After verifying your MarkTag:

  1. MarkTag will begin collecting event data
  2. Retrieve events using the Events API
  3. Monitor tag status through the merchant endpoints