Developer
Statistics

Recording a conversion

Recording a conversion with the ShortFreeURL REST API: POST /api/conversions. Use a real click ID from the referring short link.

Complete this task in your own workspace. The screenshots use demonstration data.

1. Prepare your workspace and API key

Open Dashboard → Integrations & API → API. Create a named secret key with the smallest required scope. Use a key with write access for this operation; a create-only key cannot update existing records. Store it as SHORTFREEURL_API_KEY in your environment. The secret is shown once.

ShortFreeURL API keys in a demonstration workspace
Select the scope before creating your key. Never share the secret in a screenshot. · Demo workspace. Click to enlarge.

2. Find the correct resource

Open Conversions. Select your domain. A link editor URL contains id=; use that link ID in requests. Get domain IDs from GET /api/domains. Replace example IDs 42 and 918 and the example hostname with your own values.

ShortFreeURL Conversions in a demonstration workspace
Conversions · Demo workspace. Click to enlarge.

3. Review the operation

Use a real click ID from the referring short link. Repeated submissions create repeated events: deduplicate in your checkout integration. Currency is a three-letter code and value must be non-negative.

POST /api/conversions. This changes data. Check every ID and field before running it. Inspect upgradeRequired in responses: a successful update can leave unsupported fields unchanged.

4. Choose a language and run the request

Terminal setup with PowerShell, Bash and screenshots →

Shell uses curl. Node requires a runtime with fetch. Python uses its standard library. Other examples list their required HTTP library in code. Set the API host to this installation’s deployed HTTPS origin, then run the example from your terminal or backend.

curl --request POST 'https://api.shortfreeurl.com/api/conversions' \
  --header "Authorization: Bearer $SHORTFREEURL_API_KEY" \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "clid": "actual-click-id",
  "value": 49.95,
  "currency": "USD",
  "source": "checkout"
}'

5. Verify the result

  1. Read the HTTP status and response. For QR exports, save the returned image instead of parsing JSON.
  2. Read the resource again and reopen it in the dashboard. Confirm the intended field changed and unrelated settings stayed intact.
  3. For targeting, expiry or password changes, make a controlled test visit. A real visit may add to analytics. For deletion, verify the record is absent before retrying.

6. Troubleshoot safely

  • 401: check key expiry, revocation and workspace membership.
  • 403/402: check role, key scope, feature access and subscription.
  • 404: confirm the resource belongs to your workspace and domain.
  • 429: wait for Retry-After, reduce concurrency and check plan limits.
  • Timeout after a write: read the resource first; avoid creating duplicates.

Try a request in the API reference · All workflow guides