Dashboard
Docs
Home

Developers

Stats API

Pull your conversion data into any tool, spreadsheet, or script. Authenticated via API key with 600 requests per hour.

Endpoint

bash
GET https://taprain.com/api/v1/stats

Authentication

Pass your API key using either method.

Your API key is shown on the dashboard (Stats API button). You can also fetch or regenerate it programmatically.

Recommended: Header

X-Api-Key: your_key_here

Alternative: Query param

?api_key=your_key_here
Warning

Avoid passing keys in URLs for production integrations. They can appear in server logs and browser history.

Parameters

All parameters are passed as URL query string values.

range
string

hour, today, yesterday, 7days, 30days, or custom. Default: today

start
string

Start date (YYYY-MM-DD). Required when range=custom.

end
string

End date (YYYY-MM-DD). Required when range=custom. Max 365-day span.

timezone
string

Any IANA timezone string. Default: America/New_York

country
string

Comma-separated ISO 3166-1 alpha-2 codes. e.g. US,GB,CA

offer
string

Comma-separated offer names (exact match). e.g. Freecash CPI,KashKick

source
string

Comma-separated campaign source / s2 values. e.g. tiktok_1,ig_bio

Rate limit: 600 requests / hour per API key. Remaining count is available in the meta.requests_remaining field.

Example Requests

cURL: today's stats

bash
curl -X GET "https://taprain.com/api/v1/stats?range=today" \
  -H "X-Api-Key: YOUR_API_KEY"

cURL: custom range with filters

bash
curl -X GET "https://taprain.com/api/v1/stats?range=custom&start=2026-03-01&end=2026-03-17&country=US,GB&source=tiktok_bio&timezone=America/New_York" \
  -H "X-Api-Key: YOUR_API_KEY"

JavaScript

JavaScript
const response = await fetch(
  'https://taprain.com/api/v1/stats?range=today',
  { headers: { 'X-Api-Key': 'YOUR_API_KEY' } }
);

const { data } = await response.json();
console.log('Revenue today:', data.summary.revenue);
console.log('Leads today:',   data.summary.leads);

Python

bash
import requests

resp = requests.get(
    'https://taprain.com/api/v1/stats',
    params={'range': '7days', 'timezone': 'UTC'},
    headers={'X-Api-Key': 'YOUR_API_KEY'},
)
data = resp.json()['data']

print(f"Revenue: ${data['summary']['revenue']}")
for day in data['time_series']:
    print(day['period'], day['revenue'])

Example Response

range=today, granularity=hour

JSON
{
  "success": true,
  "meta": {
    "range": "today",
    "timezone": "America/New_York",
    "granularity": "hour",
    "period_start": "2026-03-18T05:00:00.000Z",
    "period_end": "2026-03-18T17:43:12.000Z",
    "generated_at": "2026-03-18T17:43:12.418Z",
    "filters": { "country": null, "offer": null, "source": null }
  },
  "data": {
    "summary": {
      "clicks": 214,
      "leads": 27,
      "revenue": 138.24,
      "cvr": 12.6168,
      "epc": 0.645981
    },
    "time_series": [
      { "period": "2026-03-18 00:00", "granularity": "hour", "clicks": 18, "leads": 2, "revenue": 10.40, "cvr": 11.1111, "epc": 0.577778 },
      { "period": "2026-03-18 01:00", "granularity": "hour", "clicks": 31, "leads": 5, "revenue": 26.75, "cvr": 16.129, "epc": 0.862903 }
    ],
    "by_country": [
      { "country": "US", "clicks": 180, "leads": 24, "revenue": 125.40, "cvr": 13.3333, "epc": 0.696667 },
      { "country": "GB", "clicks": 34, "leads": 3, "revenue": 12.84, "cvr": 8.8235, "epc": 0.377647 }
    ],
    "by_source": [
      { "source": "tiktok_bio", "clicks": 141, "leads": 19, "revenue": 98.80, "cvr": 13.4752, "epc": 0.700709 },
      { "source": "Direct", "clicks": 73, "leads": 8, "revenue": 39.44, "cvr": 10.9589, "epc": 0.540274 }
    ],
    "by_offer": [
      { "offer": "Freecash CPI", "clicks": 120, "leads": 16, "revenue": 88.00, "cvr": 13.3333, "epc": 0.733333 },
      { "offer": "KashKick", "clicks": 94, "leads": 11, "revenue": 50.24, "cvr": 11.7021, "epc": 0.534468 }
    ]
  }
}

Error Codes

HTTP responses

200

OK

Success. Conversion data returned.

400

Bad Request

Invalid parameter (see error field for details).

401

Unauthorized

Missing or invalid API key.

403

Forbidden

Account suspended.

429

Rate Limited

600 requests/hour exceeded. Wait and retry.

500

Server Error

Internal error. Try again shortly.

API Key Management

Manage your key programmatically.

Get your current API key

bash
GET https://taprain.com/api/v1/api-key

Requires session authentication (cookie). Returns { success: true, api_key: "..." }.

Regenerate your API key

bash
POST https://taprain.com/api/v1/api-key/regenerate
Warning

Regenerating your key immediately invalidates the old one. Any scripts or integrations using the old key will stop working.