API Documentation

Connect your vibe-coded project, bot, or app to earn affiliate commissions automatically.

Quick Start

1. Register your app

curl -X POST https://api.endorso.com/api/v1/partners/register \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-cool-bot",
    "email": "dev@example.com",
    "app_url": "https://mybot.app",
    "description": "A vibe-coded shopping assistant"
  }'

# Response:
{
  "partner": { "id": 2, "name": "my-cool-bot", "tag": "my-cool-bot" },
  "api_key": "na_abc123...",
  "message": "Save your API key — it will not be shown again."
}

2. Match a URL to an affiliate link

curl -X POST https://api.endorso.com/api/v1/links/match \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://nike.com/shoes/air-max-90"}'

# Response:
{
  "matched": true,
  "program": {
    "name": "Nike",
    "network": "Impact",
    "domain": "nike.com",
    "commission_type": "CPA"
  },
  "link": {
    "tracking_id": "a1b2c3d4e5f6",
    "tracking_url": "https://api.endorso.com/t/a1b2c3d4e5f6",
    "affiliate_url": "https://nike.ojrq.net/c/437971/...",
    "original_url": "https://nike.com/shoes/air-max-90"
  }
}

3. Use the tracking URL in your app

# Your bot/app outputs the tracking URL instead of the raw URL
# Every click through /t/{id} is tracked and attributed to you

# The tracking URL does a 302 redirect to the affiliate link
# Clicks are logged with bot detection, IP hashing, and partner attribution

API Endpoints

POST
/api/v1/partners/register

Register your bot/app. Returns API key.

Auth: None

POST
/api/v1/links/match

Send a URL, get an affiliate tracking link. THE key endpoint.

Auth: Optional (links attributed to partner if provided)

GET
/api/v1/links

List your tracking links. With auth: only your links.

Auth: Optional

GET
/api/v1/networks

List all affiliate networks. Filter by status, search.

Auth: None

GET
/api/v1/programs

Search programs/merchants. Filter by network, domain, keyword.

Auth: None

GET
/api/v1/products/search

Full-text product search across all feeds.

Auth: None

GET
/api/v1/partners/me

Get your partner stats: clicks, conversions, revenue.

Auth: Required

GET
/t/{trackingId}

302 redirect. Use as your monetized link.

Auth: None

How Revenue Works

1. You register your bot/app and get an API key with a unique tag.

2. Your bot sends URLs to /api/v1/links/match. We match them to the best affiliate program across 122 networks and return a tracking URL.

3. Your bot uses the tracking URL (/t/{id}) in its output — social posts, emails, chat responses, product pages, whatever.

4. When users click, we 302-redirect to the merchant through the affiliate link. We log the click, detect bots, and attribute it to your partner tag.

5. When conversions happen, commissions are tracked. Default revenue share: 70% to you, 30% platform.

6. Check your stats anytime: GET /api/v1/partners/me

CLI Usage

# Install
npx netaggr init

# Match a URL
npx netaggr match "https://nike.com/shoes"

# List your links
npx netaggr links

# Check your stats
npx netaggr stats

# Search products
npx netaggr search "wireless headphones"

# Browse networks
npx netaggr networks --status=ACTIVE

Integration Examples

Node.js / TypeScript Bot

const API = "http://localhost:3000/api/v1";
const KEY = "na_your_api_key_here";

async function monetize(url: string) {
  const res = await fetch(`${API}/links/match`, {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ url }),
  });
  const data = await res.json();
  if (data.matched) {
    return data.link.tracking_url; // Use this instead of raw URL
  }
  return url; // No match, use original
}

Python Bot

import requests

API = "http://localhost:3000/api/v1"
KEY = "na_your_api_key_here"

def monetize(url: str) -> str:
    resp = requests.post(f"{API}/links/match",
        headers={"Authorization": f"Bearer {KEY}"},
        json={"url": url})
    data = resp.json()
    if data.get("matched"):
        return data["link"]["tracking_url"]
    return url

curl (Any Language)

# One-liner to monetize any URL
curl -s -X POST https://api.endorso.com/api/v1/links/match \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://amazon.com/dp/B0123"}' | jq .link.tracking_url