Skip to main content
DrapierDrapier

First Integration

End-to-end tutorial to verify your API key, browse products, generate tracking links, and monitor earnings.

This guide walks through a complete integration from verifying your API key to monitoring your first commission. Each step includes full request and response examples you can run directly.

Step 1: Verify your API key

Confirm your credentials are working by fetching your publisher profile.

Request:

curl -s -H "Authorization: Bearer sk_live_abc123..." \
  https://api.drapier.io/api/v1/publishers/me

Response:

{
  "id": "pub_8xk2m9",
  "name": "Luxury Fashion Blog",
  "email": "partner@example.com",
  "status": "ACTIVE",
  "website": "https://luxuryfashionblog.com",
  "createdAt": "2025-11-15T10:30:00Z"
}

If you see your publisher details, you're authenticated. A 401 means your key is invalid — double-check it in Settings → API Keys.

Step 2: Browse available products

Fetch products available for promotion. The opportunities endpoint returns products with pricing, imagery, and deep link data.

Request:

curl -s -H "Authorization: Bearer sk_live_abc123..." \
  "https://api.drapier.io/api/v1/publishers/me/opportunities?brand=italist&limit=2"

Response:

{
  "data": [
    {
      "productId": "prod_xr9k2f",
      "title": "Prada Galleria Saffiano Leather Mini Bag",
      "brand": "italist",
      "category": "Women > Bags > Handbags",
      "salePrice": 1895.00,
      "currency": "USD",
      "imageUrl": "https://cdn.italist.com/image/product/prada-galleria-12345.jpg",
      "productUrl": "https://italist.com/us/women/bags/handbags/prada-galleria/12345",
      "availability": "in_stock",
      "earningsTier": "high"
    },
    {
      "productId": "prod_m4v7np",
      "title": "Gucci GG Marmont Small Shoulder Bag",
      "brand": "italist",
      "category": "Women > Bags > Shoulder Bags",
      "salePrice": 1650.00,
      "currency": "USD",
      "imageUrl": "https://cdn.italist.com/image/product/gucci-marmont-67890.jpg",
      "productUrl": "https://italist.com/us/women/bags/shoulder-bags/gucci-marmont/67890",
      "availability": "in_stock",
      "earningsTier": "medium"
    }
  ],
  "pagination": {
    "total": 12847,
    "limit": 2,
    "offset": 0,
    "hasMore": true
  }
}

Use query parameters to filter by brand, category, minPrice, maxPrice, and availability.

Create a deep link that attributes clicks and purchases to your publisher account.

Request:

curl -s -X POST \
  -H "Authorization: Bearer sk_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "productUrl": "https://italist.com/us/women/bags/handbags/prada-galleria/12345",
    "subId": "homepage-hero-banner"
  }' \
  https://api.drapier.io/api/v1/publishers/me/deep-link

Response:

{
  "trackingUrl": "https://click.drapier.io/pub_8xk2m9/prod_xr9k2f?sub_id=homepage-hero-banner",
  "productId": "prod_xr9k2f",
  "destinationUrl": "https://italist.com/us/women/bags/handbags/prada-galleria/12345",
  "expiresAt": null
}

The trackingUrl is what you place on your site. The optional subId parameter lets you tag links for internal tracking (e.g., which page or placement drove the click).

Use the tracking URL anywhere you'd normally link to a product — editorial content, product roundups, comparison tables, email newsletters, or social media.

HTML example:

<a href="https://click.drapier.io/pub_8xk2m9/prod_xr9k2f?sub_id=homepage-hero-banner">
  <img src="https://cdn.italist.com/image/product/prada-galleria-12345.jpg"
       alt="Prada Galleria Saffiano Leather Mini Bag" />
  <p>Prada Galleria Saffiano Leather Mini Bag — $1,895</p>
</a>

When a user clicks this link:

  1. The click is recorded with your publisher ID, the product ID, and a timestamp.
  2. The user is redirected to the product page on the brand's storefront.
  3. A cookie and localStorage entry store the click ID for attribution.
  4. If the user purchases within 30 days, the order is attributed to you.

Step 5: Monitor clicks

Check how your links are performing with the click stats endpoint.

Request:

curl -s -H "Authorization: Bearer sk_live_abc123..." \
  "https://api.drapier.io/api/v1/clicks/stats/me?period=7d"

Response:

{
  "period": "7d",
  "totalClicks": 342,
  "uniqueClicks": 289,
  "byDay": [
    { "date": "2026-03-12", "clicks": 45, "unique": 38 },
    { "date": "2026-03-13", "clicks": 52, "unique": 44 },
    { "date": "2026-03-14", "clicks": 61, "unique": 53 },
    { "date": "2026-03-15", "clicks": 48, "unique": 41 },
    { "date": "2026-03-16", "clicks": 39, "unique": 33 },
    { "date": "2026-03-17", "clicks": 50, "unique": 42 },
    { "date": "2026-03-18", "clicks": 47, "unique": 38 }
  ],
  "bySubId": [
    { "subId": "homepage-hero-banner", "clicks": 187, "unique": 162 },
    { "subId": "gift-guide-article", "clicks": 155, "unique": 127 }
  ]
}

The period parameter accepts 24h, 7d, 30d, or 90d. Results break down by day and by subId so you can see which placements drive the most traffic.

Step 6: Check earnings

View your commissions and their current lifecycle status.

Request:

curl -s -H "Authorization: Bearer sk_live_abc123..." \
  "https://api.drapier.io/api/v1/commissions/me?status=PENDING,APPROVED&limit=5"

Response:

{
  "data": [
    {
      "id": "com_v3k8m2",
      "orderId": "ord_9xp4r1",
      "productTitle": "Prada Galleria Saffiano Leather Mini Bag",
      "brand": "italist",
      "salePrice": 1895.00,
      "commissionAmount": 240.00,
      "currency": "USD",
      "status": "PENDING",
      "subId": "homepage-hero-banner",
      "clickedAt": "2026-03-14T09:22:15Z",
      "orderedAt": "2026-03-14T09:45:33Z",
      "createdAt": "2026-03-14T09:46:01Z"
    },
    {
      "id": "com_h7n1p5",
      "orderId": "ord_2wf6t8",
      "productTitle": "Gucci GG Marmont Small Shoulder Bag",
      "brand": "italist",
      "salePrice": 1650.00,
      "commissionAmount": 198.00,
      "currency": "USD",
      "status": "APPROVED",
      "subId": "gift-guide-article",
      "clickedAt": "2026-03-10T14:11:42Z",
      "orderedAt": "2026-03-10T15:03:18Z",
      "createdAt": "2026-03-10T15:04:00Z"
    }
  ],
  "summary": {
    "totalCommissions": 438.00,
    "pendingCount": 1,
    "approvedCount": 1
  },
  "pagination": {
    "total": 2,
    "limit": 5,
    "offset": 0,
    "hasMore": false
  }
}

Filter by status (comma-separated), brand, dateFrom, and dateTo. See Commission Model for a full explanation of commission states and the lifecycle from PENDING to PAID.

What's next

You've completed a full integration cycle. From here:

  • Scale with product feeds — Instead of generating links one by one, pull the full catalog via Product Feeds and build product pages dynamically.
  • Understand attribution — Read How Tracking Works to understand the click-to-commission pipeline.
  • Optimize earnings — Use subId tags to A/B test placements and identify your highest-converting content.

On this page