Link Lookup
Looks up tracking link data by short code. Used by the Cloudflare Worker to determine where to redirect the user based on their platform.
GET
/v1/link/:codeReturns the app store URLs, app ID, creator ID, and link ID for a given tracking link short code.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
code | string | Required | The tracking link short code. The API first searches by the short_code field, then falls back to looking up the document by ID (link_{code}). |
Example Request
curl
curl "https://us-central1-appfiliate-5a18b.cloudfunctions.net/api/v1/link/abc123"Responses
Link found
200 OK
{
"app_store_url": "https://apps.apple.com/app/id1234567890",
"play_store_url": "https://play.google.com/store/apps/details?id=com.example.app",
"app_id": "app_myapp",
"creator_id": "creator_abc123",
"link_id": "link_abc123"
}Response Fields
| Parameter | Type | Required | Description |
|---|---|---|---|
app_store_url | string | Required | The iOS App Store URL to redirect iPhone/iPad users to. |
play_store_url | string | Required | The Google Play Store URL to redirect Android users to. |
app_id | string | Required | The app ID this link belongs to. |
creator_id | string | Required | The affiliate (creator) who owns this tracking link. |
link_id | string | Required | The full link document ID. |
Link not found
404 Not Found
{
"error": "Link not found"
}Infrastructure endpoint
This endpoint is designed to be called by the Cloudflare redirect worker. The worker looks up the link data, records a click via POST /v1/click, and then redirects the user to the appropriate app store URL based on their platform.
Lookup strategy
The API first queries links by the short_code field. If no match is found, it falls back to looking up the Firestore document directly by ID using the link_{code} pattern. This supports both named short codes and raw link IDs.