Skip to content

API Reference

The Partners API provides RESTful endpoints for managing merchants, MarkTag implementations, and event data. This reference documents all available endpoints.

Base URL

All API endpoints are relative to:

https://api-alpha.markopolo.ai/v1/partners

Available Endpoints

The Partners API consists of three main resource groups:

Merchants

Manage merchant accounts under your partner account.

  • GET /merchant - List all merchants with their MarkTags
  • POST /merchant - Create a new merchant

MarkTag

Generate and verify tracking implementations.

  • POST /marktag/generate - Generate a MarkTag for a domain
  • POST /marktag/verify - Verify MarkTag DNS configuration

Events

Retrieve tracking data collected by MarkTag.

  • GET /events - Get filtered event data with pagination

Request Headers

All requests require authentication:

http
Authorization: Bearer mp_live_YOUR_TOKEN
Content-Type: application/json

Response Format

All responses are returned in JSON format:

json
{
  "field": "value",
  "nested": {
    "data": "example"
  }
}

Error Response Format

All error responses follow a consistent format:

json
{
  "message": "Human-readable error message",
  "code": "ERROR_CODE",
  "statusCode": 400
}

Example authentication error:

json
{
  "message": "Authentication required",
  "code": "AUTHENTICATION_ERROR",
  "statusCode": 401
}

HTTP Status Codes

The API uses standard HTTP status codes:

CodeDescription
200Success - Request completed successfully
201Created - Resource created successfully
400Bad Request - Invalid request parameters
401Unauthorized - Authentication failed
403Forbidden - Access denied to resource
404Not Found - Resource doesn't exist
409Conflict - Resource already exists
422Unprocessable Entity - DNS verification pending
500Internal Server Error - Server error

Standardized Error Codes

The API uses these standardized error codes:

CodeHTTP StatusDescription
VALIDATION_ERROR400, 409, 422Invalid parameters, domain already registered, or DNS pending
AUTHENTICATION_ERROR401Missing or invalid Bearer token
FORBIDDEN403Access denied to resource
NOT_FOUND404Resource doesn't exist
SERVICE_ERROR500Unable to process request

For detailed error handling information, see the Error Handling Guide.

Pagination

List endpoints support pagination using query parameters:

ParameterTypeDefaultDescription
pageinteger1Page number (min: 1)
limitinteger10-12Items per page (max: 100)

Paginated responses include metadata:

json
{
  "data": [...],
  "pagination": {
    "currentPage": 1,
    "itemsPerPage": 10,
    "totalItems": 100,
    "totalPages": 10,
    "hasNextPage": true,
    "hasPreviousPage": false
  }
}

Date Formats

All dates use ISO 8601 format in UTC:

2025-01-25T10:30:00Z

When filtering by date range:

  • startDate: Beginning of range (inclusive)
  • endDate: End of range (inclusive)

Domain Validation

Different endpoints have different domain requirements:

Generate MarkTag

Requires root domain only:

  • example.com
  • https://example.com
  • www.example.com
  • shop.example.com

Verify MarkTag

Accepts full subdomain:

  • shop.example.com
  • api.shop.example.com
  • https://shop.example.com

Partner Isolation

All API operations are isolated to your partner account:

  • You can only access merchants you created
  • Attempting to access other partners' resources returns 404
  • All operations verify partner ownership

Quick Start Examples

Test Authentication

bash
curl -X GET "https://api-alpha.markopolo.ai/v1/partners/merchant?limit=1" \
  -H "Authorization: Bearer mp_live_YOUR_TOKEN"

Complete MarkTag Setup

bash
# 1. Create merchant
curl -X POST "https://api-alpha.markopolo.ai/v1/partners/merchant" \
  -H "Authorization: Bearer mp_live_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "My Store"}'

# 2. Generate MarkTag
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": "MERCHANT_ID", "domain": "example.com"}'

# 3. Verify installation
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 '{"tagId": "TAG_ID", "subdomain": "shop.example.com"}'

# 4. Get events
curl -X GET "https://api-alpha.markopolo.ai/v1/partners/events?merchantId=MERCHANT_ID" \
  -H "Authorization: Bearer mp_live_YOUR_TOKEN"

SDK Support

While official SDKs are in development, you can use any HTTP client library:

  • JavaScript: fetch, axios, node-fetch
  • Python: requests, httpx, aiohttp
  • PHP: Guzzle, cURL
  • Ruby: Net::HTTP, HTTParty
  • Go: net/http
  • Java: HttpClient, OkHttp

Next Steps

Explore the detailed documentation for each endpoint:

  1. Merchants API - Create and manage merchants
  2. MarkTag API - Generate and verify tracking
  3. Events API - Retrieve tracking data