Geo-Targeting Content API Documentation

Welcome to the official documentation for the Geo-Targeting Content API. Our service allows you to establish a real-time data stream to fetch geo-specific content updates.

Authentication

The API uses Bearer Token authentication. Include your API key in the Authorization header.

Authorization: Bearer YOUR_API_KEY

Real-time Data Endpoint

To receive continuous content updates, connect to our WebSocket endpoint.

WSS wss://your-worker-domain.workers.dev/feed

Establishing a Connection

You must include a custom header X-Forward-Payload containing the Base64-encoded configuration for the content feed you wish to subscribe to.

This payload specifies the upstream data source and port for the content stream.

// Example using JavaScript's WebSocket API
const apiKey = 'YOUR_API_KEY'; // This should match the secret set in Cloudflare
const contentConfigSource = 'news.provider.com:443';
const payload = btoa(contentConfigSource); // Base64 encode the source

const socket = new WebSocket('wss://your-worker-domain.workers.dev/feed', {
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'X-Forward-Payload': payload
  }
});

socket.onmessage = (event) => {
  // Process incoming data stream
  console.log('Received content update:', event.data);
};

Support

For technical inquiries, please contact our internal engineering team.