Programmatically manage redirects, import/export data, and integrate with your applications
API access is available on Pro, Business, and Enterprise plans. Webhook functionality requires Business plan or higher.
View pricingThe RedirectFlow API uses API keys for authentication. Include your API key in the Authorization header of every request.
Authorization: Bearer rf_your_api_key_here
Content-Type: application/json
User-Agent: YourApp/1.0Rate limits are enforced per user account and vary by subscription plan. Limits reset every minute.
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200
HTTP/1.1 429 Too Many Requests
{
"error": "Rate limit exceeded",
"limit": 1000,
"reset": 1640995200
}Import up to 1,000,000 redirects in a single API call (Enterprise plan). Data is processed in batches for optimal performance.
POST https://redirectflow.com/api/v1/redirects/bulk
Authorization: Bearer rf_your_api_key_here
Content-Type: application/json
{
"website_id": "123",
"redirects": [
{
"old_path": "/old-page",
"new_path": "/new-page",
"status_code": 301
},
{
"old_path": "/another-old-page",
"new_path": "/another-new-page",
"status_code": 302
}
],
"group_id": "migration-2024",
"target_environments": ["production", "staging"]
}{
"success": true,
"import_id": "imp_1234567890",
"summary": {
"total_submitted": 2,
"created": 2,
"updated": 0,
"errors": 0
},
"processing_time": "1.2s",
"batch_info": {
"batch_size": 1000,
"total_batches": 1
}
}Export all redirects for a website or specific groups. Supports various formats and filtering options.
GET https://redirectflow.com/api/v1/redirects/bulk/export?website_id=123&format=json&group_id=migration-2024
Authorization: Bearer rf_your_api_key_here{
"export_id": "exp_1234567890",
"website": {
"id": "123",
"name": "My Website"
},
"filters": {
"group_id": "migration-2024"
},
"redirects": [
{
"id": "456",
"old_path": "/old-page",
"new_path": "/new-page",
"status_code": 301,
"group_id": "migration-2024",
"created_at": "2024-01-15T10:30:00Z",
"deployed_to_prod": "2024-01-15T11:00:00Z"
}
],
"total_count": 1,
"exported_at": "2024-01-16T14:30:00Z"
}Access read-only analytics data for your redirects. Get insights into deployment stats, redirect performance, and usage patterns.
GET https://redirectflow.com/api/v1/analytics?website_id=123&start_date=2024-01-01&end_date=2024-01-31&group_by=day
Authorization: Bearer rf_your_api_key_here{
"website": {
"id": "123",
"name": "My Website"
},
"date_range": {
"start_date": "2024-01-01",
"end_date": "2024-01-31"
},
"analytics": {
"overview": {
"total_redirects": 1500,
"deployed_redirects": 1450,
"total_groups": 12
},
"time_series": [
{
"period": "2024-01-01",
"redirect_count": 50,
"deployed_count": 48
}
],
"top_groups": [
{
"group_id": "migration-2024",
"redirect_count": 500,
"deployed_count": 495
}
],
"environments": {
"production_deployed": 1450,
"staging_deployed": 1500,
"development_deployed": 1200
}
}
}Webhooks allow you to receive real-time notifications when events occur in your RedirectFlow account. Available on Business and Enterprise plans.
POST https://redirectflow.com/api/webhooks
Authorization: Bearer rf_your_api_key_here
Content-Type: application/json
{
"name": "Deployment Notifications",
"url": "https://your-app.com/webhooks/redirectflow",
"events": [
"deployment.completed",
"deployment.failed",
"bulk_import.completed"
]
}{
"webhook": {
"id": "wh_1234567890",
"name": "Deployment Notifications",
"url": "https://your-app.com/webhooks/redirectflow",
"events": ["deployment.completed", "deployment.failed", "bulk_import.completed"],
"secret": "whsec_abc123def456...",
"is_active": true,
"created_at": "2024-01-15T10:30:00Z"
}
}redirect.createdNew redirect added
redirect.updatedRedirect modified
redirect.deletedRedirect removed
deployment.startedDeployment initiated
deployment.completedDeployment finished successfully
deployment.failedDeployment encountered errors
bulk_import.completedBulk import process finished
bulk_export.completedBulk export process finished
{
"event": "deployment.completed",
"timestamp": "2024-01-15T11:00:00Z",
"data": {
"deployment": {
"website_id": "123",
"environment": "production",
"redirect_count": 150,
"deployed_at": "2024-01-15T11:00:00Z"
}
}
}Verify webhook authenticity using the signature in the X-RedirectFlow-Signature header.
const crypto = require('crypto');
function verifyWebhookSignature(payload, signature, secret) {
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
const receivedSignature = signature.replace('sha256=', '');
return crypto.timingSafeEqual(
Buffer.from(expectedSignature, 'hex'),
Buffer.from(receivedSignature, 'hex')
);
}
// Express.js example
app.post('/webhooks/redirectflow', (req, res) => {
const signature = req.headers['x-redirectflow-signature'];
const payload = JSON.stringify(req.body);
if (!verifyWebhookSignature(payload, signature, process.env.WEBHOOK_SECRET)) {
return res.status(401).send('Invalid signature');
}
// Process webhook event
const { event, data } = req.body;
console.log('Received webhook:', event, data);
res.status(200).send('OK');
});The RedirectFlow API uses conventional HTTP response codes to indicate success or failure of requests.
{
"error": "Invalid request parameters",
"details": "website_id is required",
"code": "MISSING_PARAMETER",
"timestamp": "2024-01-15T10:30:00Z"
}const fetch = require('node-fetch');
class RedirectFlowClient {
constructor(apiKey) {
this.apiKey = apiKey;
this.baseUrl = 'https://redirectflow.com/api/v1';
}
async bulkImport(websiteId, redirects, groupId = null) {
const response = await fetch(`${this.baseUrl}/redirects/bulk`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${this.apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
website_id: websiteId,
redirects,
group_id: groupId
})
});
if (!response.ok) {
const error = await response.json();
throw new Error(`API Error: ${error.error}`);
}
return await response.json();
}
async getAnalytics(websiteId, startDate, endDate) {
const params = new URLSearchParams({
website_id: websiteId,
start_date: startDate,
end_date: endDate
});
const response = await fetch(`${this.baseUrl}/analytics?${params}`, {
headers: {
'Authorization': `Bearer ${this.apiKey}`
}
});
return await response.json();
}
}
// Usage
const client = new RedirectFlowClient('rf_your_api_key_here');
async function example() {
try {
// Import redirects
const result = await client.bulkImport('123', [
{ old_path: '/old', new_path: '/new', status_code: 301 }
], 'migration-2024');
console.log('Import successful:', result);
// Get analytics
const analytics = await client.getAnalytics('123', '2024-01-01', '2024-01-31');
console.log('Analytics:', analytics);
} catch (error) {
console.error('Error:', error.message);
}
}
example();import requests
import json
from datetime import datetime
class RedirectFlowClient:
def __init__(self, api_key):
self.api_key = api_key
self.base_url = 'https://redirectflow.com/api/v1'
self.session = requests.Session()
self.session.headers.update({
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
})
def bulk_import(self, website_id, redirects, group_id=None):
payload = {
'website_id': website_id,
'redirects': redirects,
'group_id': group_id
}
response = self.session.post(
f'{self.base_url}/redirects/bulk',
json=payload
)
response.raise_for_status()
return response.json()
def get_analytics(self, website_id, start_date, end_date):
params = {
'website_id': website_id,
'start_date': start_date,
'end_date': end_date
}
response = self.session.get(
f'{self.base_url}/analytics',
params=params
)
response.raise_for_status()
return response.json()
# Usage
client = RedirectFlowClient('rf_your_api_key_here')
try:
# Import redirects
redirects = [
{'old_path': '/old-page', 'new_path': '/new-page', 'status_code': 301}
]
result = client.bulk_import('123', redirects, 'migration-2024')
print(f'Import successful: {result}')
# Get analytics
analytics = client.get_analytics('123', '2024-01-01', '2024-01-31')
print(f'Analytics: {analytics}')
except requests.exceptions.HTTPError as e:
print(f'HTTP Error: {e.response.status_code} - {e.response.text}')
except Exception as e:
print(f'Error: {str(e)}')# Bulk import redirects
curl -X POST https://redirectflow.com/api/v1/redirects/bulk \
-H "Authorization: Bearer rf_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"website_id": "123",
"redirects": [
{
"old_path": "/old-page",
"new_path": "/new-page",
"status_code": 301
}
],
"group_id": "migration-2024"
}'
# Get analytics
curl -X GET "https://redirectflow.com/api/v1/analytics?website_id=123&start_date=2024-01-01&end_date=2024-01-31" \
-H "Authorization: Bearer rf_your_api_key_here"
# Export redirects
curl -X GET "https://redirectflow.com/api/v1/redirects/bulk/export?website_id=123&format=json" \
-H "Authorization: Bearer rf_your_api_key_here"
# Create webhook
curl -X POST https://redirectflow.com/api/webhooks \
-H "Authorization: Bearer rf_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Deployment Notifications",
"url": "https://your-app.com/webhooks/redirectflow",
"events": ["deployment.completed", "bulk_import.completed"]
}'Official and community-maintained SDKs and libraries to integrate RedirectFlow into your applications.
Official Node.js SDK with TypeScript support
npm install @redirectflow/sdkOfficial Python package for RedirectFlow API
pip install redirectflow-pythonCommunity-maintained PHP library
composer require redirectflow/php-sdkCommunity-maintained Ruby gem
gem install redirectflow-rubyWe're working on additional SDKs for Go, Rust, and .NET. Want to contribute?Get in touch.
Our support team is here to help you integrate the RedirectFlow API successfully.