TrackTags Proxy Setup Guide

Overview

The TrackTags proxy allows you to add rate limiting and usage tracking to any HTTP API by routing requests through TrackTags. When a request exceeds your configured limits, it will be denied before reaching the target API.

Prerequisites

Before using the proxy, you must:

  1. Create a metric - The metric must exist before making proxy requests
  2. Configure domain authorization - Add a .tracktags.json file to your target domain

Step 1: Create Your Metric

First, create a metric that the proxy will check:

curl -X POST https://tracktags.fly.dev/api/v1/metrics?scope=business \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"metric_name": "api_calls", "limit_value": 1000.0, "limit_operator": "gte", "breach_action": "deny"}'

Important: Set breach_action to “deny” to block requests when limit is exceeded.

Step 2: Domain Authorization

Add a .tracktags.json file to your target domain root with your business_id in the authorized_businesses array.

Step 3: Using the Proxy

curl -X POST https://tracktags.fly.dev/api/v1/proxy \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"scope": "business", "metric_name": "api_calls", "target_url": "https://api.openai.com/v1/chat/completions", "method": "POST"}'

Troubleshooting

  • Metric not found: Create the metric first before using the proxy
  • Domain not authorized: Verify .tracktags.json exists at your target domain root
  • Loop detected: Do not set target_url to point back to TrackTags
  • Request denied: Your metric has reached its limit