Create, manage, and analyze your short links programmatically with our powerful REST API
Get up and running with the Redirectly API in minutes. All endpoints require authentication via API key.
https://redirectly.app/api
application/json
All API requests require authentication using your API key as a Bearer token in the Authorization header.
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://redirectly.app/api/links
Keep your API key secure and never expose it in client-side code. Generate new keys from your dashboard if compromised.
Invalid input or missing required fields
Missing or invalid API key
Access denied for this resource
Requested resource does not exist
Resource already exists (e.g. duplicate username)
Rate limit exceeded
Something went wrong on our end
{ "error": "Unauthorized", "message": "Invalid API key provided" }
Manage your permanent short links
Retrieve all your permanent links
GET /api/links
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://redirectly.app/api/links
[ { "slug": "my-awesome-link", "target": "https://example.com", "click_count": 42, "url": "https://yourname.redirectly.app/my-awesome-link", "created_at": "2024-06-01T12:00:00Z", "updated_at": "2024-06-01T12:00:00Z" } ]
Create a new permanent short link
POST /api/links
{ "slug": "my-awesome-link", "target": "https://example.com" }
curl -X POST \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"slug": "my-awesome-link", "target": "https://example.com"}' \ https://redirectly.app/api/links
{ "slug": "my-awesome-link", "target": "https://example.com", "url": "https://yourname.redirectly.app/my-awesome-link", "click_count": 0, "created_at": "2024-06-01T12:00:00Z" }
Update the target URL of a permanent link
PUT /api/links/[slug]
slug
(path parameter) - The slug of the link to update{ "target": "https://new-example.com" }
curl -X PUT \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"target": "https://new-example.com"}' \ https://redirectly.app/api/links/my-awesome-link
{ "slug": "my-awesome-link", "target": "https://new-example.com", "user_id": "user-uuid", "created_at": "2024-06-01T12:00:00Z", "updated_at": "2024-06-01T12:00:00Z" }
Remove a permanent link
DELETE /api/links/[slug]
slug
(path parameter) - The slug of the link to deletecurl -X DELETE \ -H "Authorization: Bearer YOUR_API_KEY" \ https://redirectly.app/api/links/my-awesome-link
{ "message": "Link deleted successfully" }
Create expiring short links
Generate temporary links with expiration
POST /api/v1/temp-links
{ "target": "https://example.com", "slug": "optional-custom-slug", "ttlSeconds": 900 }
target
(required) - The URL to redirect toslug
(optional) - Custom slug, auto-generated if not providedttlSeconds
(optional) - Time to live in seconds, defaults to 900 (15 minutes)curl -X POST \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"target": "https://example.com", "ttlSeconds": 3600}' \ https://redirectly.app/api/v1/temp-links
{ "slug": "abc123", "target": "https://example.com", "url": "https://yourname.redirectly.app/abc123", "expires_at": "2024-06-01T12:15:00Z", "created_at": "2024-06-01T12:00:00Z" }
Track link performance
Access detailed analytics and metrics
GET /api/stats
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://redirectly.app/api/stats
{ "dailyStats": [ { "day": "2024-06-01", "total": 45 }, { "day": "2024-06-02", "total": 38 }, { "day": "2024-06-03", "total": 52 } ], "totalClicks": 1250, "totalLinks": 15 }
User account management
Retrieve user profile information
GET /api/profile
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://redirectly.app/api/profile
{ "id": "user-uuid", "username": "yourname", "created_at": "2024-06-01T12:00:00Z", "updated_at": "2024-06-01T12:00:00Z" }
Update user profile settings
POST /api/profile
{ "username": "new-username" }
username
(required) - 3-20 characters, alphanumeric and hyphens onlycurl -X POST \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"username": "new-username"}' \ https://redirectly.app/api/profile
{ "id": "user-uuid", "username": "new-username", "created_at": "2024-06-01T12:00:00Z", "updated_at": "2024-06-01T12:00:00Z" }
Mobile app deep linking
iOS app site association
Android app verification
Check out our dashboard for more tools, or contact our support team if you need assistance.