API Reference
Authentication
The AFFY API uses API key authentication. You'll need your API key to make requests to the tracking endpoints from your server or custom integrations.
Getting your API key
Your API key is available in the AFFY dashboard:
- Navigate to Program Settings → Marketing & Tracking
- Find the API Key section
- Click the copy button to copy the key to your clipboard
Your API key is a secret — treat it like a password. Never expose it in client-side JavaScript, commit it to version control, or share it publicly. Store it as an environment variable on your server.
Base URL
All API endpoints are relative to:
Base URL
text
https://api.affy.proMaking authenticated requests
Most tracking endpoints accept your Client ID in the request body rather than requiring an Authorization header. Your Client ID is the numeric identifier visible in your dashboard URL and tracking settings.
For endpoints that require authentication, include the API key in the Authorization header as a Bearer token:
Example request with API key
bash
curl -X GET https://api.affy.pro/api/v1/tracking/status/SESSION_ID \
-H "Authorization: Bearer YOUR_API_KEY"JavaScript example
javascript
const response = await fetch('https://api.affy.pro/api/v1/tracking/status/SESSION_ID', {
headers: {
'Authorization': `Bearer ${process.env.AFFY_API_KEY}`,
'Content-Type': 'application/json'
}
})Finding your Client ID
Your Client ID is required in tracking API requests. You can find it in:
- Program Settings → Marketing & Tracking — the JavaScript tracking snippet includes your Client ID
- The dashboard URL when logged in
Client ID in the tracking snippet
javascript
// Your tracking snippet will include your Client ID:
window.affyClientId = 12345; // This is your Client IDResponse format
All API responses are in JSON format. Successful responses return HTTP 200 or 201. Error responses include an error message:
Error response example
json
{
"error": "Unauthorized",
"message": "Invalid or missing API key",
"status": 401
}