4Endpoints
GETMethod
JSONResponse Format
API KeyAuthentication

Authentication

API Keys

All API endpoints require authentication via an API key. You can generate keys from your dashboard or from the admin panel.

Query parameter:
GET /api/traffic.php?domain=example.com&api_key=YOUR_KEY
Authorization header (Bearer):
curl -H "Authorization: Bearer YOUR_KEY" https://traffx.co.ke/api/traffic.php?domain=example.com
Custom header:
curl -H "X-API-Key: YOUR_KEY" https://traffx.co.ke/api/traffic.php?domain=example.com

Base URL

API Endpoints

All API calls are GET requests. Responses follow a consistent JSON envelope format.

GET /api/traffic.php?domain={domain}

Get full traffic intelligence report

Returns visits, unique visitors, page views, bounce rate, pages/visit, avg duration, global/country/category ranks, growth %, engagement score, domain/page authority, data confidence, traffic sources, 6-month trend, audience geography, and keywords/referrals/ads/tech data.

ParameterTypeRequiredDescription
domainstringyesThe domain to analyze
api_keystringyesYour API key (or use Authorization header)

Example: GET /api/traffic.php?domain=example.com&api_key=YOUR_KEY

GET /api/keywords.php?domain={domain}

Get SEO keyword data and search ads

Returns top organic keywords with search volume, clicks, CPC, position, difficulty, intent. Also returns paid search ads.

Example: GET /api/keywords.php?domain=example.com&api_key=YOUR_KEY

GET /api/backlinks.php?domain={domain}

Get referring / backlink data

Returns top referring domains with traffic contribution, authority score, and link type classification.

Example: GET /api/backlinks.php?domain=example.com&api_key=YOUR_KEY

GET /api/tech.php?domain={domain}

Get technology stack data

Returns detected CMS, web server, analytics platform, CDN, ad pixels, and frontend/backend frameworks.

Example: GET /api/tech.php?domain=example.com&api_key=YOUR_KEY

Response Format

JSON Envelope

All successful responses use the following envelope structure:

{
    "status": "success",
    "code": 200,
    "message": "Traffic intelligence retrieved successfully",
    "data": {
        "domain": "example.com",
        "visits": 1234567,
    },
    "meta": {
        "api_version": "1.0",
        "generated_at": "2025-01-01T00:00:00+00:00",
        "cached": false,
        "requested_at": "2025-01-01T00:00:00+00:00"
    }
}

Error Codes

Error Responses

HTTP StatusError TypeDescription
400Bad RequestInvalid parameters provided
401authentication_requiredNo API key provided
401invalid_api_keyAPI key is invalid, revoked, or expired
403permission_deniedAPI key lacks access to the requested endpoint
422invalid_domainDomain parameter is missing or malformed
429rate_limit_exceededToo many requests per minute
500internal_errorServer-side processing error
{
    "status": "error",
    "code": 401,
    "error": {
        "type": "invalid_api_key",
        "message": "The provided API key is invalid, revoked, or expired."
    },
    "meta": {
        "api_version": "1.0",
        "generated_at": "2025-01-01T00:00:00+00:00"
    }
}

Get started

cURL Examples

# Get traffic report
curl -H "Authorization: Bearer YOUR_KEY" \
  "https://traffx.co.ke/api/traffic.php?domain=google.com" | jq .

# Get keywords for a domain
curl "https://traffx.co.ke/api/keywords.php?domain=amazon.com&api_key=YOUR_KEY" | jq .

# Get backlinks
curl -H "X-API-Key: YOUR_KEY" \
  "https://traffx.co.ke/api/backlinks.php?domain=nytimes.com" | jq .

# Get technology stack
curl -H "Authorization: Bearer YOUR_KEY" \
  "https://traffx.co.ke/api/tech.php?domain=shopify.com" | jq .
Rate limiting & caching: API responses are rate-limited per API key (configurable, default 60 req/min). Responses are cached for 6 hours. Need a higher limit? Upgrade your key or contact us.