API Reference
The Appfiliate REST API lets you record clicks, attribute installs, track purchases, and retrieve analytics. All endpoints accept and return JSON.
Base URL
https://us-central1-appfiliate-5a18b.cloudfunctions.net/apiAll endpoint paths are relative to this base URL. For example, the click endpoint is available at https://us-central1-appfiliate-5a18b.cloudfunctions.net/api/v1/click.
Authentication
Authenticated endpoints require two headers:
| Header | Description |
|---|---|
X-API-Key | Your app's API key, found on the Appfiliate dashboard under app settings. |
X-App-ID | Your app's unique identifier, also available on the dashboard. |
The SDK handles authentication automatically. If you are calling the API directly, include both headers on every request. The /v1/click and /v1/link/:code endpoints are called by infrastructure and do not require these headers.
Rate Limits
The API enforces the following rate limits per app:
- Click recording: 1,000 requests per minute
- Attribution: 500 requests per minute
- Purchase tracking: 500 requests per minute
- Stats: 60 requests per minute
If you exceed a limit, the API returns a 429 Too Many Requests response. Back off and retry after a short delay.
Response Format
All responses are JSON. Successful responses return the relevant data directly. Error responses use a consistent format:
{
"error": "Description of what went wrong"
}Common HTTP status codes:
- 200 -- Success
- 400 -- Bad request (missing required fields)
- 401 -- Invalid API key
- 404 -- Resource not found
- 429 -- Rate limit exceeded
- 500 -- Internal server error
Endpoints
/v1/clickRecords a tracking link click. Called by the Cloudflare redirect worker.
/v1/attributionAttributes an app install to a click. Called by the SDK on first launch.
/v1/purchasesRecords an in-app purchase and links it to an attribution.
/v1/stats/:appIdFetches aggregated analytics for the dashboard.
/v1/link/:codeLooks up tracking link data. Used by the Cloudflare Worker for redirects.