API Reference

Integrate CloakRadar with your systems using our REST API. Manage campaigns, track clicks, record conversions, and retrieve analytics programmatically.

Authentication

The CloakRadar API uses JWT (JSON Web Token) authentication.

Getting Your API Key

  1. Go to Settings > API
  2. Click Generate API Key
  3. Copy your API Key and Secret
Keep Your Secret Safe

Your API secret is only shown once. Store it securely. Never expose it in client-side code.

Obtaining a Token

POST /api/v1/auth/token POST
curl -X POST https://cloakradar.pro/api/v1/auth/token \
  -H "Content-Type: application/json" \
  -d '{
    "email": "your@email.com",
    "password": "your_password"
  }'

Response

{
  "success": true,
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "expires_in": 86400
}

Using the Token

Include the token in the Authorization header:

Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Base URL & Format

Base URL

https://cloakradar.pro/api/v1

Request Format

Response Format

All responses are JSON with this structure:

{
  "success": true,
  "data": { ... },
  "meta": {
    "page": 1,
    "per_page": 20,
    "total": 100
  }
}

Rate Limits

Plan Requests/Minute Requests/Day
Starter 60 10,000
Professional 300 100,000
Enterprise 1,000 Unlimited

Rate limit headers are included in all responses:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1640000000

Campaigns API

List Campaigns

GET /api/v1/campaigns GET
curl -X GET https://cloakradar.pro/api/v1/campaigns \
  -H "Authorization: Bearer YOUR_TOKEN"

Query Parameters

Parameter Type Description
page integer Page number (default: 1)
per_page integer Items per page (default: 20, max: 100)
status string Filter by status (active, paused, inactive)

Response

{
  "success": true,
  "data": [
    {
      "id": 1,
      "uuid": "abc123xyz",
      "name": "Facebook - Weight Loss",
      "status": "active",
      "tracking_url": "https://track.cloakradar.pro/c/abc123xyz",
      "clicks_today": 1250,
      "conversions_today": 45,
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 20,
    "total": 5
  }
}

Get Campaign

GET /api/v1/campaigns/{id} GET
curl -X GET https://cloakradar.pro/api/v1/campaigns/1 \
  -H "Authorization: Bearer YOUR_TOKEN"

Create Campaign

POST /api/v1/campaigns POST
curl -X POST https://cloakradar.pro/api/v1/campaigns \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New Campaign",
    "traffic_source_id": 1,
    "cost_model": "cpc",
    "cost_value": 0.50,
    "status": "active"
  }'

Request Body

Field Type Required Description
name string Yes Campaign name
traffic_source_id integer No Traffic source ID
cost_model string No cpc, cpm, cpa, revshare
cost_value decimal No Cost amount
status string No active, paused, inactive

Update Campaign

PUT /api/v1/campaigns/{id} PUT
curl -X PUT https://cloakradar.pro/api/v1/campaigns/1 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Campaign Name",
    "status": "paused"
  }'

Delete Campaign

DELETE /api/v1/campaigns/{id} DELETE
curl -X DELETE https://cloakradar.pro/api/v1/campaigns/1 \
  -H "Authorization: Bearer YOUR_TOKEN"

Get Campaign Statistics

GET /api/v1/campaigns/{id}/stats GET
curl -X GET "https://cloakradar.pro/api/v1/campaigns/1/stats?from=2024-01-01&to=2024-01-31" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

{
  "success": true,
  "data": {
    "clicks": 15000,
    "unique_clicks": 12500,
    "real_clicks": 10000,
    "bot_clicks": 3000,
    "vpn_clicks": 2000,
    "conversions": 450,
    "revenue": 20250.00,
    "cost": 7500.00,
    "profit": 12750.00,
    "roi": 170.00,
    "cr": 4.50,
    "epc": 1.35
  }
}

Clicks API

List Clicks

GET /api/v1/clicks GET
curl -X GET "https://cloakradar.pro/api/v1/clicks?campaign_id=1&from=2024-01-01" \
  -H "Authorization: Bearer YOUR_TOKEN"

Query Parameters

Parameter Type Description
campaign_id integer Filter by campaign
from date Start date (YYYY-MM-DD)
to date End date (YYYY-MM-DD)
status string real, bot, vpn, cloaked
country string Country code (US, UK, etc.)

Response

{
  "success": true,
  "data": [
    {
      "id": "clk_abc123",
      "campaign_id": 1,
      "ip": "192.168.x.x",
      "country": "US",
      "city": "New York",
      "device": "mobile",
      "os": "iOS",
      "browser": "Safari",
      "status": "real",
      "is_bot": false,
      "is_vpn": false,
      "converted": true,
      "created_at": "2024-01-15T14:30:00Z"
    }
  ]
}

Get Click Details

GET /api/v1/clicks/{clickid} GET
curl -X GET https://cloakradar.pro/api/v1/clicks/clk_abc123 \
  -H "Authorization: Bearer YOUR_TOKEN"

Conversions API

List Conversions

GET /api/v1/conversions GET
curl -X GET "https://cloakradar.pro/api/v1/conversions?from=2024-01-01" \
  -H "Authorization: Bearer YOUR_TOKEN"

Record Conversion

POST /api/v1/conversions POST
curl -X POST https://cloakradar.pro/api/v1/conversions \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "click_id": "clk_abc123",
    "payout": 45.00,
    "transaction_id": "txn_12345",
    "status": "approved"
  }'

Request Body

Field Type Required Description
click_id string Yes CloakRadar click ID
payout decimal No Conversion payout
transaction_id string No External transaction ID
status string No approved, pending, rejected

Postback URL

For server-to-server tracking, use the postback URL:

https://cloakradar.pro/api/v1/postback?clickid={clickid}&payout={payout}&txid={txid}

Statistics API

Get Overall Statistics

GET /api/v1/stats GET
curl -X GET "https://cloakradar.pro/api/v1/stats?from=2024-01-01&to=2024-01-31" \
  -H "Authorization: Bearer YOUR_TOKEN"

Get Statistics by Country

GET /api/v2/analytics/countries GET
curl -X GET "https://cloakradar.pro/api/v2/analytics/countries?campaign_id=1" \
  -H "Authorization: Bearer YOUR_TOKEN"

Get Statistics by Device

GET /api/v2/analytics/devices GET
curl -X GET "https://cloakradar.pro/api/v2/analytics/devices?campaign_id=1" \
  -H "Authorization: Bearer YOUR_TOKEN"

Fraud Detection API

Get Fraud Statistics

GET /api/v2/fraud/stats GET
curl -X GET "https://cloakradar.pro/api/v2/fraud/stats?campaign_id=1" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response

{
  "success": true,
  "data": {
    "total_clicks": 10000,
    "fraudulent_clicks": 850,
    "fraud_rate": 8.5,
    "fraud_by_type": {
      "bot": 300,
      "duplicate": 200,
      "vpn": 150,
      "datacenter": 100,
      "rapid_fire": 50,
      "click_farm": 50
    },
    "estimated_savings": 425.00
  }
}

Generate Fraud Report

POST /api/v2/fraud/report POST
curl -X POST https://cloakradar.pro/api/v2/fraud/report \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "campaign_id": 1,
    "from": "2024-01-01",
    "to": "2024-01-31",
    "platform": "google"
  }'

Download Fraud Report CSV

GET /api/v2/fraud/report/{id}/csv GET
curl -X GET https://cloakradar.pro/api/v2/fraud/report/123/csv \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -o fraud_report.csv

Error Handling

Error Response Format

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "The name field is required",
    "details": {
      "name": ["The name field is required"]
    }
  }
}

HTTP Status Codes

Code Meaning
200 Success
201 Created
400 Bad Request (validation error)
401 Unauthorized (invalid token)
403 Forbidden (no permission)
404 Not Found
429 Too Many Requests (rate limited)
500 Internal Server Error

Error Codes

Code Description
VALIDATION_ERROR Request validation failed
AUTHENTICATION_ERROR Invalid or expired token
AUTHORIZATION_ERROR No permission for this action
NOT_FOUND Resource not found
RATE_LIMIT_EXCEEDED Too many requests
INTERNAL_ERROR Server error

Next: Set up real-time notifications with Webhooks.