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.
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
| Method | Route | Description |
|---|---|---|
| POST | /api/redirects | Create a new redirect |
| GET | /api/redirects | List all your redirects |
| GET | /api/redirects/{slug}/stats | Get hit count for one redirect |
| POST | /api/redirects/{slug}/reset-stats | Reset 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)
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | Yes | β | Destination URL. Must be a valid URL. Max 2048 chars. |
status | integer | No | 302 | HTTP status code: 301, 302, 307, or 308. Anything else defaults to 302. |
nofollow | boolean | No | true | Serve an intermediate noindex/nofollow HTML page instead of a direct redirect. Recommended for SEO protection. |
label | string | No | "" | Human-readable label for your own reference. Max 255 chars. |
token | string | Yes* | β | 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
| Code | Type | SEO Juice Passed | When to Use |
|---|---|---|---|
301 | Permanent | ~90β99% | Permanent URL change you own |
302 | Temporary | None (default) | Tracking links, campaigns, unknown permanence |
307 | Temporary (strict) | None | Same as 302 but method must not change (POST stays POST) |
308 | Permanent (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
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 URLReferrer-Policy: no-referrerβ prevents the destination site from seeing your redirect URL in HTTP referrer headersCache-Control: no-store, no-cacheβ prevents intermediary caches from storing the redirect