LinkTrace

API Reference

Complete reference for the LinkTrace Client API — link creation, install attribution, link metadata, and event tracking.

Base URL

https://api.linktrace.in

Your API Key

your-api-key(issued once you sign up)

Endpoints in this reference

Links & Attribution

Event Tracking

Authentication

Every request is authenticated with your secret API key. Here's how to send it and what each plan can call.

API Keys

Every request must include your API key in the x-api-key HTTP header. You can find your key in the LinkTrace dashboard under Settings → API Key.

http header
x-api-key: your-api-key

Keep your API key secret. Never expose it in client-side JavaScript, mobile app binaries, or public repositories. Rotate it immediately from the dashboard if you suspect compromise.

Plan requirements

EndpointFree PlanScale Plan
POST /api/v1/referral-links✓ Available✓ Available
POST /api/v1/attributions✓ Available✓ Available
GET /api/v1/referral-links/metadata✓ Available✓ Available
POST /api/v1/events✗ Scale only✓ Available

Event Tracking

Send post-install conversion events to measure what your referred users do after they sign up.

Scale plan required. Event ingestion is available on the Scale plan only. Calls from non-Scale accounts return 403 PLAN_UPGRADE_REQUIRED.

POST

/api/v1/events

Scale x-api-key

Ingest a named event against a referral link's short code — purchases, sign-ups, level completions, anything meaningful — and attribute it back to the link that drove the install. Writes are fire-and-forget: the endpoint responds immediately and the database write happens asynchronously.

Request body

FieldTypeRequiredDescription
linkShortCodestringrequiredThe 4–32 character alphanumeric short code of the referral link (e.g. 497b3422).
eventNamestringrequiredA snake_case event name. Must start with a letter and contain only lowercase letters, digits, and underscores — max 128 characters. Names are normalised to lowercase automatically. Reserved names (rejected): click, install, impression, open.
entityIdstringoptionalA unique identifier for the entity this event represents (e.g. an order ID, user ID, session ID). When provided, LinkTrace deduplicates events: if the same (linkShortCode, eventName, entityId) tuple has already been recorded, the second call returns 200 { deduplicated: true } instead of writing a new row. Max 255 characters.

Basic — no dedup

json
{
  "linkShortCode": "497b3422",
  "eventName": "web_link_click"
}

With entityId — deduplication enabled

json
{
  "linkShortCode": "497b3422",
  "eventName": "purchase",
  "entityId": "order_9876"
}

Responses

202Accepted

Event queued for async write. Normal success path.

{ "success": true, "queued": true }

200Deduplicated

Same (shortCode, eventName, entityId) already recorded.

{ "success": true, "deduplicated": true }

429Quota exceeded

Monthly limit of 5,000 events reached.

{ "code": "QUOTA_EXCEEDED", "resetsOn": "2026-07-01T00:00:00.000Z" }

403Plan upgrade required

Account is not on the Scale plan.

{ "code": "PLAN_UPGRADE_REQUIRED" }

Quota applies to production events only. The 5,000 monthly limit tracks only events sent for the production environment. The counter resets on the 1st of each calendar month (UTC).

Code example

bash
curl -X POST https://api.linktrace.in/api/v1/events \
  -H "x-api-key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "linkShortCode": "497b3422",
    "eventName": "purchase",
    "entityId": "order_9876"
  }'

Errors

Standard HTTP status codes with a consistent error envelope across every endpoint.

Error Response Format

All errors follow a consistent JSON envelope.

json
{
  "success": false,
  "message": "Human-readable description of what went wrong",
  "code": "MACHINE_READABLE_CODE",
  "resetsOn": "2026-07-01T00:00:00.000Z"
}

code is present on some errors; resetsOn is present on 429 QUOTA_EXCEEDED.

HTTP StatusCodeWhen it occurs
400Validation error — missing or invalid request fields.
401Missing or invalid x-api-key header. Your key is available in Settings → API Key.
403PLAN_UPGRADE_REQUIREDThe requested endpoint requires the Scale plan.
404LINK_NOT_FOUNDThe short code does not exist or belongs to another account.
429QUOTA_EXCEEDEDMonthly event quota (5,000) has been exhausted. resetsOn indicates when the counter resets.

Platform Examples

Copy-paste integration snippets for the most common mobile and web stacks.

Platform Integration Examples

kotlin
val client = OkHttpClient()
val mediaType = "application/json".toMediaType()
val body = "{
    \"userId\": \"user_275\"
}".toRequestBody(mediaType)
val request = Request.Builder()
    .url("https://api.linktrace.in/api/v1/attributions")
    .post(body)
    .addHeader("Content-Type", "application/json")
    .addHeader("x-api-key", "your-api-key")
    .build()
val response = client.newCall(request).execute()

Need Help?

Running into an issue with your integration? Send us an email — we respond within 24 hours on weekdays.

contact@linktrace.in