Developer
ShortFreeURL API

Use the API reference

Screenshots, terminal commands and a verified request workflow.

Use the same steps for link queries, folders, domains, targeting and statistics. Screenshots show a demonstration workspace; replace every example ID and URL with your own.

1. Prepare your API key

Open Dashboard → Integrations & API → API. Create a named read-only key for reports or a scoped write key for changes. Keep the secret private.

ShortFreeURL API keys in a demonstration workspace
1 → Choose API, name the key, then select its scope. · Demo workspace. Click to enlarge.

2. Choose an endpoint

Open API reference. Expand Link queries, Link Management, Link Targeting, Domains or Statistics API in the left sidebar. Search by name or path. Select the operation to open its own page.

1 → Choose an endpoint2 ↓ Enter IDs3 ↓ LanguageAPI reference screenshot with numbered endpoint, parameter and language instructions
1 → Select an endpoint. 2 → Enter your resource IDs. 3 → Choose your language.

3. Find IDs and fill parameters

Get domain IDs from GET /api/domains, then link IDs from GET /api/links?domainId=YOUR_ID. The link editor URL also contains id=. For folders, list the domain’s folders first.

ShortFreeURL Branded Links in a demonstration workspace
Choose your domain and open a test link to find its ID. · Demo workspace. Click to enlarge.

Path parameters are required. Query parameters filter a read. POST reports accept JSON such as {"period":"last30","column":"country","limit":10}. Reports use UTC. Custom dates need both startDate and endDate.

4. Run and inspect a request

  1. Select Shell, Node, Ruby, PHP or Python, or choose from More languages.
  2. Review the generated URL and JSON. Enter a scoped test key in Credentials.
  3. Select Try it. Read the actual status and response. Changes also require the confirmation checkbox.
  4. Use Cancel request if needed. After cancelling or timing out a write, read the resource before retrying.
API reference request console showing language selection and response area
Choose a language, inspect the example, then check the HTTP response. No real key is shown. Click the image to enlarge it.

5. Run from a terminal

Install curl or use curl.exe on Windows. Set your deployment’s base URL and key for this terminal session. These placeholders are examples.

Windows PowerShell

$env:SHORTFREEURL_BASE_URL = "https://YOUR-WEBSITE"
$secret = Read-Host "API key" -AsSecureString
$env:SHORTFREEURL_API_KEY = [System.Net.NetworkCredential]::new("", $secret).Password
curl.exe --fail-with-body -i "$env:SHORTFREEURL_BASE_URL/api/domains" -H "Authorization: Bearer $env:SHORTFREEURL_API_KEY"

macOS / Linux (Bash)

export SHORTFREEURL_BASE_URL="https://YOUR-WEBSITE"
read -rsp "API key: " SHORTFREEURL_API_KEY; echo
export SHORTFREEURL_API_KEY
curl --fail-with-body -i "$SHORTFREEURL_BASE_URL/api/domains" -H "Authorization: Bearer $SHORTFREEURL_API_KEY"

Copy the selected endpoint’s example after filling your IDs. Python uses its standard library; Node uses fetch. The language examples identify additional libraries where needed. At the end, clear the variable with Remove-Item Env:SHORTFREEURL_API_KEY (PowerShell) or unset SHORTFREEURL_API_KEY (Bash).

Save and run the example

Select a language in the reference, fill in your IDs, then choose Copy example. Save that text in the file below. Run the command in the same terminal where you set your key.

LanguageRequirementsFile and command
ShellBash and curlrequest.sh → bash request.sh
NodeNode.js 18 or newerrequest.mjs → node request.mjs
PythonPython 3; no extra packagerequest.py → python request.py
RubyRuby with net/httprequest.rb → ruby request.rb
PHPPHP with the cURL extensionrequest.php → php request.php
PowerShellWindows PowerShell or PowerShell 7Paste the PowerShell example directly into the terminal.

The expected result is an HTTP success status and your resource/report. If Python is installed as python3 on your machine, use python3 request.py.

6. Read a statistics report

Use your own domain ID instead of 42. This POST reads a report and works with a read-only key. Dimension include/exclude filters require an eligible plan.

curl --request POST 'https://api.shortfreeurl.com/statistics/domain/42/top_by_interval' \
  --header "Authorization: Bearer $SHORTFREEURL_API_KEY" \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "period": "last30",
  "column": "country",
  "interval": "day",
  "limit": 10
}'

Empty reports mean no matching tracked clicks in the retained period. A 401, 402, 403 or 429 is an error, not an empty report. Compare counts using the same domain, filters, period and timezone.

7. Verify and troubleshoot

For changes, reopen the same record in the dashboard and read it through the API. Never retry a payment or a bulk creation blindly. For folder creation, list folders again. For domain settings, read the domain again. Clearing statistics requires an owner/admin, write access and an explicit domain confirmation; it cannot be undone.

Error and rate-limit guide · All task guides