Shinkarenko
Menu

Project

LinkExpand API

An API that follows short links and redirect chains safely and returns the final URL, every hop and a risk analysis of the destination.

LinkExpand is a URL expander and redirect checker API for developers who handle links they did not write: messaging and moderation tools, link previews, security checks and analytics. One request follows a short or tracking link hop by hop and answers where it really leads, which status codes it passed through and whether the destination looks suspicious, without anyone clicking it.

What one request returns

  • POST /v1/expand: the final URL and domain, its status code, the number of redirects, whether it uses HTTPS and, on plans that include it, the full redirect chain with every hop’s status code.
  • POST /v1/analyze: the same expansion plus a risk analysis, also for links whose expansion failed, because a link that times out or loops is itself a finding.
  • An Idempotency-Key header makes retries safe: a repeated request returns the original answer instead of being processed and billed again.

Safe to point at any link

Following a link someone else supplied is a classic server-side request forgery risk: a redirect can lead to an internal service or a cloud metadata address. LinkExpand checks every hop before it connects.

  • Every hop’s DNS answers are checked: private, loopback, link-local, multicast and cloud-metadata addresses and internal host names are refused, only ports 80 and 443 are used, and credentials in a URL are rejected.
  • Redirects, time and response sizes are bounded, and response bodies are never followed for meta refresh or scripts.
  • A firewall on the server blocks internal and metadata addresses for the API’s outgoing traffic as a second layer, verified by real connection attempts from inside the container.

An honest risk analysis

The analysis scores what the chain shows, such as an IP address instead of a domain, a downgrade from HTTPS to HTTP, a changed domain or a redirect loop, and turns the score into a level. It never calls a link safe on heuristics alone: without an answer from a threat-intelligence source, an unsuspicious link is reported as “unknown”, not “low”.

Built to be sold

  • Two channels: API keys issued directly, on credit-based plans, and RapidAPI, which authenticates and bills its consumers per request.
  • Plans decide features: on RapidAPI, BASIC (free, 500 requests a month) returns the final URL, and PRO ($9.99 a month, 20,000 requests) adds the full redirect chain.
  • Direct billing is a PostgreSQL ledger that is only ever appended to: a URL costs one credit once network work has started, cached results and inputs blocked before any connection are free, and an Idempotency-Key guarantees at most one charge.
  • Rate limits per account and plan, and a limit on URLs processed at once, keep their state in Redis, so several API processes enforce one limit.

Load test on the production server

failed requests in 10,096 expansions
0 %
median processing time of a three-hop chain
≈30 ms
requests per second sustained on a shared 2-vCPU server
15–20

k6 run of 28 November 2026 against a real three-hop redirect chain behind Cloudflare, every request uncached.

Operations

The API runs in Docker on an Oracle Cloud server in Frankfurt behind Caddy and Cloudflare, with a database role that cannot alter the ledger, Redis with authentication and persistence, encrypted off-site backups with a tested restore, and a post-deploy check of the public endpoint. More than 900 automated tests run without touching a real network: DNS and hosts are simulated.

Type
Own product · REST API
Channels
Direct API keys · RapidAPI
Contract
OpenAPI 3.1, contract-tested
Hosting
Oracle Cloud, Frankfurt (EU)
Stack
TypeScript, Node.js, Fastify, PostgreSQL, Drizzle ORM, Redis, Docker, Caddy, Cloudflare, Vitest, k6