Guides/API Integration

API Integration Guide

Use the GeoRedir API to programmatically create links, manage redirect rules, and pull analytics data. This guide covers authentication, endpoints, and examples.

10 min read

Getting an API Key

Generate an API key in your dashboard:

  1. Go to Settings → API Keys
  2. Click "Create API Key"
  3. Give it a descriptive name (e.g., "Production Integration")
  4. Copy the key — it's only shown once

Keep Keys Secret

API keys grant full access to your account. Never commit them to version control, share them publicly, or include them in client-side code.

Authentication

Include your API key in the X-API-Key header with every request:

curl -H "X-API-Key: your_api_key_here" \
  https://api.georedir.com/api/v1/public/links

Create a smart link with rules in a single request:

curl -X POST https://api.georedir.com/api/v1/public/links \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Casino Offer Q1",
    "slug": "casino-q1",
    "rules": [
      {
        "priority": 1,
        "rule_type": "geo",
        "conditions": {"countries": ["US", "CA"]},
        "destination_url": "https://offer-us.com/?ref=123"
      },
      {
        "priority": 2,
        "rule_type": "geo",
        "conditions": {"countries": ["GB"]},
        "destination_url": "https://offer-uk.com/?ref=456"
      },
      {
        "priority": 99,
        "rule_type": "fallback",
        "conditions": {},
        "destination_url": "https://offer-global.com/?ref=789"
      }
    ]
  }'

Managing Rules

Update a link's settings:

curl -X PATCH https://api.georedir.com/api/v1/public/links/123 \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Casino Offer Q1 (Updated)",
    "is_active": true
  }'

Pulling Analytics

Get analytics for a specific link:

# Get analytics for link ID 123 (last 30 days)
curl -H "X-API-Key: your_api_key_here" \
  "https://api.georedir.com/api/v1/public/analytics/123?days=30"

# Get current usage and limits
curl -H "X-API-Key: your_api_key_here" \
  https://api.georedir.com/api/v1/public/usage

Rate Limits

API requests are rate-limited to 100 requests per minute per API key. If you exceed this limit, you'll receive a 429 Too Many Requests response.

For full API documentation, see the API Reference.

Ready to get started?

Create your first geo-targeted smart link in under 2 minutes. Free plan available, no credit card required.

Free plan included • No credit card required • Upgrade anytime