Redirects API

Programmatically create, list, track, and delete HTTP redirects. Each redirect is a short /r/{slug} link that counts every hit and protects your SEO.


Get your API token

Create an account and subscribe ($9/month) to start using the API.

Built-in SEO protection. Every redirect automatically sets X-Robots-Tag: noindex, nofollow and Referrer-Policy: no-referrer. When nofollow: true (default), an intermediate HTML page with <meta name="robots" content="noindex, nofollow"> is served β€” ensuring crawlers never follow the link and your referrer URL is never leaked to the destination.

Endpoints

MethodRouteDescription
POST/api/redirectsCreate a new redirect
GET/api/redirectsList all your redirects
GET/api/redirects/{slug}/statsGet hit count for one redirect
POST/api/redirects/{slug}/reset-statsReset hit counter to 0
DELETE/api/redirects/{slug}Delete a redirect permanently

All endpoints require a valid subscription token. Pass it as ?token=… or Authorization: Bearer ….

POST /api/redirects β€” Create

Request body (JSON or form-data)
FieldTypeRequiredDefaultDescription
urlstringYesβ€”Destination URL. Must be a valid URL. Max 2048 chars.
statusintegerNo302HTTP status code: 301, 302, 307, or 308. Anything else defaults to 302.
nofollowbooleanNotrueServe an intermediate noindex/nofollow HTML page instead of a direct redirect. Recommended for SEO protection.
labelstringNo""Human-readable label for your own reference. Max 255 chars.
tokenstringYes*β€”API token. Can also be passed as Authorization: Bearer ….
Success response 200
{
  "success": true,
  "data": {
    "slug":           "aB3xYz9Q",
    "url":            "https://abesttools.com/r/aB3xYz9Q",
    "target_url":     "https://example.com/landing-page",
    "http_status":    302,
    "nofollow":       true,
    "label":          "Campaign A",
    "redirect_count": 0,
    "created_at":     "2025-04-20 12:00:00"
  }
}
Example
curl -X POST https://abesttools.com/api/redirects \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","status":302,"nofollow":true,"label":"My link","token":"YOUR_TOKEN"}'

GET /api/redirects β€” List all

Returns all redirects for your account, newest first. Same object shape as the create response, wrapped in an array.

curl "https://abesttools.com/api/redirects?token=YOUR_TOKEN"

GET /api/redirects/{slug}/stats

{
  "success": true,
  "data": {
    "slug":           "aB3xYz9Q",
    "redirect_count": 142,
    "created_at":     "2025-04-20 12:00:00"
  }
}

POST /api/redirects/{slug}/reset-stats

Resets the redirect_count to 0.

curl -X POST "https://abesttools.com/api/redirects/aB3xYz9Q/reset-stats?token=YOUR_TOKEN"

DELETE /api/redirects/{slug}

Permanently deletes the redirect. The short link immediately returns a 404-style redirect to the homepage.

curl -X DELETE "https://abesttools.com/api/redirects/aB3xYz9Q?token=YOUR_TOKEN"
# or POST fallback:
curl -X POST "https://abesttools.com/api/redirects/aB3xYz9Q/delete?token=YOUR_TOKEN"

Supported HTTP Status Codes

CodeTypeSEO Juice PassedWhen to Use
301Permanent~90–99%Permanent URL change you own
302TemporaryNone (default)Tracking links, campaigns, unknown permanence
307Temporary (strict)NoneSame as 302 but method must not change (POST stays POST)
308Permanent (strict)~90–99%Same as 301 but method must not change

For tracking/campaign links you should use 302 (default). Use 301 only when you own both origin and destination and intend a permanent redirect.

Live Tester

Create a redirect
List your redirects

What Is a URL Redirect?

A URL redirect (or HTTP redirect) instructs browsers and crawlers to go from one URL to another. Redirects are used for link shortening, campaign tracking, A/B testing, and graceful URL migrations.

Why Use 302 Instead of 301 for Tracking Links?

A 301 (permanent) redirect tells search engines to transfer the original page's ranking signals to the destination. For campaign or tracking links you don't own both ends β€” using 302 prevents unintended PageRank flow. Combine it with nofollow: true and the X-Robots-Tag header for maximum protection.

How Does Nofollow Protection Work?

When nofollow: true, instead of a direct HTTP redirect the server returns a minimal HTML page with <meta name="robots" content="noindex, nofollow"> and a <meta http-equiv="refresh"> tag. Search engine crawlers stop there and never follow the link to the destination. Human visitors are seamlessly forwarded within milliseconds.

What Other Protections Are Applied?

  • X-Robots-Tag: noindex, nofollow β€” HTTP header telling crawlers not to index or follow this URL
  • Referrer-Policy: no-referrer β€” prevents the destination site from seeing your redirect URL in HTTP referrer headers
  • Cache-Control: no-store, no-cache β€” prevents intermediary caches from storing the redirect