API Documentation

Developer Guide

v1.0

Integrate Redrx directly into your applications.

Authentication: Include your API key in the X-API-KEY header. You can find your key in the Dashboard.

1. Shorten a URL

Create a new shortened link with optional customization.

POST /api/v1/shorten
curl -X POST https://redrx.eu/api/v1/shorten \
  -H "X-API-KEY: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "long_url": "https://example.com/my-long-link",
    "custom_code": "my-code",
    "code_length": 6,
    "preview_mode": true,
    "stats_enabled": true,
    "rotate_targets": ["https://alt1.com", "https://alt2.com"],
    "ios_target_url": "https://apps.apple.com/app/id123",
    "android_target_url": "https://play.google.com/store/apps/details?id=com.example",
    "password": "secret-password",
    "expiry_hours": 24,
    "start_at": "2026-06-05T22:00:00Z",
    "end_at": "2026-06-30T23:59:59Z"
}'

Request Parameters

Field Type Default Description & Constraints
long_url Required string The original long URL to shorten. Must be a valid and safe destination URL.
custom_code Optional string A custom alias for the short code. Must be 3 to 20 characters long and contain only alphanumeric characters, hyphens, or underscores.
code_length Optional integer 6 Length of the auto-generated short code. Must be between 3 and 20.
preview_mode Optional boolean true Enable preview mode. If true, users see a preview page before redirecting. Accepts boolean value or string representations (true/false, 1/0, yes/no).
stats_enabled Optional boolean true Enable stats collection for this link. If true, click analytics are recorded. Accepts boolean value or string representations.
rotate_targets Optional array[string] [] A list of fallback/alternate redirect destination URLs. Max 50 target URLs. The short link will dynamically rotate through these target URLs.
ios_target_url Optional string A special redirect URL for iOS devices. Must be a valid and safe URL.
android_target_url Optional string A special redirect URL for Android devices. Must be a valid and safe URL.
password Optional string Password protection for the short link. If set, visitors must enter this password to unlock the destination URL.
expiry_hours Optional integer 24 Relative expiration time in hours from creation. Must be between 0 and 876,000. Set to 0 for permanent links (requires authentication).
start_at Optional string The scheduling activation date and time in ISO 8601 format (e.g. 2026-06-05T22:00:00Z). The link remains inactive until this time.
end_at Optional string The scheduling expiration date and time in ISO 8601 format (e.g. 2026-06-30T23:59:59Z). The link becomes inactive after this time.

Response

{
  "short_code": "my-code",
  "short_url": "https://redrx.eu/my-code",
  "long_url": "https://example.com/my-long-link",
  "rotate_targets": ["https://alt1.com", "https://alt2.com"],
  "ios_target_url": "https://apps.apple.com/app/id123",
  "android_target_url": "https://play.google.com/store/apps/details?id=com.example",
  "expires_at": "2026-06-06T22:00:00+00:00",
  "start_at": "2026-06-05T22:00:00+00:00",
  "end_at": "2026-06-30T23:59:59+00:00",
  "password_protected": true,
  "preview_mode": true,
  "stats_enabled": true
}

2. Get Link Info

Retrieve details and statistics for a specific link.

GET /api/v1/<short_code>
curl -X GET https://redrx.eu/api/v1/my-code \
  -H "X-API-KEY: your_api_key_here"
Response
{
  "short_code": "my-code",
  "short_url": "https://redrx.eu/my-code",
  "long_url": "https://example.com/my-long-link",
  "rotate_targets": ["https://alt1.com", "https://alt2.com"],
  "ios_target_url": "https://apps.apple.com/app/id123",
  "android_target_url": "https://play.google.com/store/apps/details?id=com.example",
  "preview_mode": true,
  "stats_enabled": true,
  "clicks_count": 42,
  "clicks": 42,
  "created_at": "2026-06-05T22:00:00+00:00",
  "expires_at": "2026-06-06T22:00:00+00:00",
  "start_at": "2026-06-05T22:00:00+00:00",
  "end_at": "2026-06-30T23:59:59+00:00",
  "active": true
}

3. Metrics & Monitoring

Redrx exports real-time system and application metrics in Prometheus format.

GET /metrics

Custom Metrics Available:

  • redrx_shortened_links_total: Total links created (Web + API).
  • redrx_redirections_total: Total successful link redirections.
  • redrx_ratelimit_hits_total: Total requests blocked by rate limiting (429 errors).
# Example Usage:
curl https://redrx.eu/metrics