Skip to content
v1

API reference

A REST API for creating and managing short links and reading their analytics.

Authentication

Every request needs an API key in the Authorization header. Keys are created at /dashboard/api-keys, shown once, and stored only as a SHA-256 hash — there is no way to recover a lost key.

curl https://sportnex.pro/api/v1/links \
  -H "Authorization: Bearer lf_your_key_here"

Scopes

  • readList and retrieve links; read analytics. Granted by default.
  • writeCreate, update and delete links. Grant it only where you need it.

Rate limits

Limits are applied per key. Exceeding one returns 429 with a Retry-After header giving the seconds until the window resets. Back off rather than retrying immediately — a tight retry loop will simply keep the window saturated.

Endpoints

Base URL: https://sportnex.pro/api/v1

  • GET/linksread

    List your links, newest first.

    page
    integerPage number. Default 1.
    per_page
    integer1–100. Default 25.
    status
    stringactive | disabled | archived | expired
  • POST/linkswrite

    Create a short link.

    destinationUrl
    stringRequired. Public http(s) URL.
    slug
    stringOptional. Generated when omitted.
    password
    stringOptional. Gates the redirect.
    expiresAt
    stringOptional ISO 8601 instant.
    maxClicks
    integerOptional click budget.
  • GET/links/{id}read

    Retrieve one link.

  • PATCH/links/{id}write

    Partial update. Only the fields you send are changed.

    destination_url
    stringNew destination.
    status
    stringactive | disabled | archived
    password
    stringSend "" to remove protection.
  • DELETE/links/{id}write

    Soft delete. Recorded clicks are retained.

  • GET/analyticsread

    Time series and dimension breakdowns.

    days
    integer1–365. Default 30.
    link_id
    uuidScope to a single link.

Errors

Every failure returns the same envelope, so a client can handle them uniformly:

{
  "error": {
    "code": "invalid_key",
    "message": "That API key is not valid."
  }
}
400
The request body was not valid JSON.
401
Missing, invalid, expired or revoked key.
403
The key lacks the required scope, or the account is inactive.
404
No such resource, or it does not belong to this key.
409
The requested slug is taken.
422
Validation failed. The response names the offending fields.
429
Rate limited. See Retry-After.
503
The API is disabled on this deployment.

A complete example

# Create a link
curl -X POST https://sportnex.pro/api/v1/links \
  -H "Authorization: Bearer lf_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "destinationUrl": "https://example.com/spring-campaign",
    "slug": "spring",
    "title": "Spring campaign",
    "utmSource": "newsletter",
    "utmMedium": "email"
  }'

# Read its analytics
curl "https://sportnex.pro/api/v1/analytics?link_id=<id>&days=30" \
  -H "Authorization: Bearer lf_your_key_here"

Questions about the API on LinkForge? Contact your administrator.