Marktag Api Documentation
Marktag api doc is here!!
Overview
The MarkTag API provides endpoints for managing companies, MarkTag tracking, and API tokens. This API is designed for integrating Markopolo's MarkTag tracking capabilities into platforms and can track events from your website.
Authentication
The API uses Bearer token authentication. Include your API token in the Authorization header:
Authorization: Bearer your_api_token_hereBase URL
https://api-alpha.markopolo.ai/v1Getting API Tokens
API tokens are managed through the Partner Dashboard endpoints (requires JWT authentication from the main application).
API Endpoints
MarkTag Partner API
Base path: /partners
Get All Companies
Retrieves all companies associated with the partner account.
GET /partners/companyResponse:
[
{
"resourceId": "550e8400-e29b-41d4-a716-446655440000",
"name": "Acme Corporation",
"url": "https://acme.com",
"tagId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"createdAt": "2025-01-25T10:30:00Z",
"updatedAt": "2025-01-25T10:30:00Z"
}
]Create Company
Creates a new company in the system.
POST /partners/companyRequest Body:
{
"name": "Acme Corporation",
"url": "https://acme.com"
}Response:
{
"companyId": "550e8400-e29b-41d4-a716-446655440000",
"tagId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}Generate MarkTag
Creates a new company and generates tracking implementation details.
POST /partners/marktag/generateRequest Body:
{
"companyId": "550e8400-e29b-41d4-a716-446655440000",
"domain": "acme.com"
}Marktag Script :
<script>
window.mtrem = window.mtrem || [];
function mtag() { mtrem.push(arguments) };
mtag("init", "https://mtag-glel.example.com", {"consent":true});
mtag("event", { type: "ViewContent" });
</script>
<script async type="text/javascript" src="https://mtag-glel.example.com/script"></script>Response:
{
"cnameRecord": {
"type": "CNAME",
"name": "mtag-glel",
"meta": {
"subdomain": "mtag-glel.example.com"
},
"value": "mts2.markopolo.ai",
"ttl": 3600
}
}Verify MarkTag
Verifies an existing MarkTag installation or generates a new MarkTag.
POST /partners/marktag/verifyRequest Body:
{
"companyId": "550e8400-e29b-41d4-a716-446655440000",
"hostname": "acme.com"
}Response:
{
"verified": true
}Events API
Retrieves tracking events from websites with filtering capabilities.
GET partners/events?tagId=6ba7b810-9dad-11d1-80b4-00c04fd430c8&startDate=2025-01-01T00:00:00Z&endDate=2025-01-31T23:59:59ZQuery Parameters:
tagId(required): Tag identifierstartDate(optional): Start date in ISO formatendDate(optional): End date in ISO format
Response:
[
{
"id": "dcb3aa96-98c8-4dd3-81c9-8f9905622eed",
"name": "Signup",
"email": "demo@example.com",
"phone": "+13425784032",
"muid": "55603dbd-2558-47f9-ad64-3ba6802585cc",
"platform": "Organic",
"timestamp": "2025-10-26 19:55:05"
},
{
"id": "78a77ba0-e303-44e0-be74-f1aa83d0cc52",
"name": "ViewContent",
"email": "demo@example.com",
"phone": "+13425784032",
"muid": "55603dbd-2558-47f9-ad64-3ba6802585cc",
"platform": "Organic",
"timestamp": "2025-10-26 19:54:31"
}
]Note: This endpoint retrieves tracking events collected from websites where the MarkTag is installed. Currently returns an empty array as a placeholder.
Data Models
Company
resourceId
string
Company identifier
550e8400-e29b-41d4-a716-446655440000
name
string
Company name
Acme Corporation
url
string
Company website URL
https://acme.com
tagId
string
Associated tag identifier
6ba7b810-9dad-11d1-80b4-00c04fd430c8
createdAt
Date
Creation timestamp
2025-01-25T10:30:00Z
updatedAt
Date
Last update timestamp
2025-01-25T10:30:00Z
MarkTag Implementation
The MarkTag implementation consists of two parts:
Script Tag: Add this to your website's HTML
DNS CNAME Record: Add this to your domain's DNS settings
Script Tag
<script>
window.mtrem = window.mtrem || [];
function mtag() { mtrem.push(arguments) };
mtag("init", "mtag-glel.example.com", {"consent":true});
mtag("event", { type: "ViewContent" });
</script>
<script async type="text/javascript" src="mtag-glel.example.com/script"></script>DNS CNAME Record
Type: CNAME
Name: mtag
Value: mtag.markopolo.ai
TTL: 300Error Handling
The API uses standard HTTP status codes:
200 OK: Request successful201 Created: Resource created successfully400 Bad Request: Invalid request data401 Unauthorized: Invalid or missing authentication403 Forbidden: Insufficient permissions404 Not Found: Resource not found500 Internal Server Error: Server error
Error responses include a message field with details:
{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}cURL Examples
Create a Company
curl -X POST "https://api-alpha.markopolo.com/v1/partners/company" \
-H "Authorization: Bearer your_api_token" \
-H "Content-Type: application/json" \
-d '{
"name": "Acme Corporation",
"url": "https://acme.com"
}'Generate MarkTag
curl -X POST "https://api-alpha.markopolo.com/v1/partners/marktag/generate" \
-H "Authorization: Bearer your_api_token" \
-H "Content-Type: application/json" \
-d '{
"companyId": "550e8400-e29b-41d4-a716-446655440000",
"hostname": "acme.com"
}'Get All Companies
curl -X GET "https://api-alpha.markopolo.com/v1/partners/company" \
-H "Authorization: Bearer your_api_token"JavaScript/Node.js Example
const axios = require('axios');
const apiClient = axios.create({
baseURL: '',
headers: {
'Authorization': 'Bearer your_api_token',
'Content-Type': 'application/json'
}
});
// Create a company
async function createCompany(name, url) {
try {
const response = await apiClient.post('/partners/company', {
name,
url
});
return response.data;
} catch (error) {
console.error('Error creating company:', error.response.data);
throw error;
}
}
// Generate MarkTag
async function generateMarkTag(companyId, hostname) {
try {
const response = await apiClient.post('/partners/marktag/generate', {
companyId,
hostname
});
return response.data;
} catch (error) {
console.error('Error generating MarkTag:', error.response.data);
throw error;
}
}
// Usage
createCompany('Acme Corporation', 'https://acme.com')
.then(company => {
console.log('Company created:', company);
return generateMarkTag(company.companyId, 'acme.com');
})
.then(marktag => {
console.log('MarkTag generated:', marktag);
})
.catch(error => {
console.error('Error:', error);
});Support
For API support and questions:
Email: support@markopolo.ai
Documentation: Available at
/docsendpoint when running the application locallyAPI Reference: Available at
/referenceendpoint when running the application locally
Changelog
Version 1.0.0
Initial release of MarkTag API
Company management endpoints
MarkTag generation and verification
Partner token management
Events API (placeholder implementation)
Last updated