Documentation

Get Started with Redirectly

Complete guide to integrating Redirectly into your applications. From setup to production deployment.

API Reference

Getting Started

Set up your account and create your first link

1

Get Your API Key

First, you'll need to get your API key from the Redirectly dashboard.

Quick Access

Sign in to your dashboard and your API key will be displayed automatically.

Open Dashboard

Dashboard Screenshot

API Key location will be shown here

2

Create Your Subdomain

Choose a unique username that will become your personal subdomain. Your links will be:

https://your-username.redirectly.app/your-link
Important

Choose carefully - usernames cannot be changed after creation!

Username Selection Screenshot

Username creation dialog will be shown here

Backend Integration

Integrate with popular backend frameworks

Create Links Programmatically

Installation

nodejs
npm install axios
# or
yarn add axios

Configuration

nodejs
const axios = require('axios');

const redirectly = axios.create({
  baseURL: 'https://redirectly.app/api',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
});

Creating Links

nodejs
// Create a permanent link
const createLink = async () => {
  try {
    const response = await redirectly.post('/links', {
      slug: 'my-awesome-link',
      target: 'https://example.com'
    });
    
    console.log('Link created:', response.data.url);
    return response.data;
  } catch (error) {
    console.error('Error:', error.response?.data);
  }
};

// Create a temporary link
const createTempLink = async () => {
  try {
    const response = await redirectly.post('/v1/temp-links', {
      target: 'https://example.com/temp-content',
      ttlSeconds: 3600 // 1 hour
    });
    
    console.log('Temp link:', response.data.url);
    return response.data;
  } catch (error) {
    console.error('Error:', error.response?.data);
  }
};

Mobile Setup

Configure iOS, Android, and Flutter apps for deep linking

🐦

Flutter Integration

1. Add Dependency

yaml
dependencies:
  flutter_redirectly: ^2.0.0

2. Initialize the Plugin

dart
import 'package:flutter_redirectly/flutter_redirectly.dart';

class RedirectlyService {
  static final FlutterRedirectly _redirectly = FlutterRedirectly();
  
  static Future<void> initialize() async {
    await _redirectly.initialize(RedirectlyConfig(
      apiKey: 'YOUR_API_KEY',
      baseUrl: 'https://redirectly.app',
      enableDebugLogging: true,
    ));
  }
  
  static FlutterRedirectly get instance => _redirectly;
}

3. Handle Incoming Links

dart
// Listen for incoming links
class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    _setupLinkHandling();
  }

  void _setupLinkHandling() {
    // Listen to link clicks when app is running
    RedirectlyService.instance.onLinkClick.listen((clickEvent) {
      if (clickEvent.error == null) {
        // Navigate based on username and slug
        Navigator.of(context).pushNamed(
          '/${clickEvent.username}/${clickEvent.slug}'
        );
      } else {
        // Handle error
        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(content: Text('Error: ${clickEvent.error}')),
        );
      }
    });

    // Check for initial link (cold start)
    _checkInitialLink();
  }

  void _checkInitialLink() async {
    final initialLinkEvent = await RedirectlyService.instance.getInitialLink();
    if (initialLinkEvent != null) {
      // Handle initial link same way as above
      Navigator.of(context).pushNamed(
        '/${initialLinkEvent.username}/${initialLinkEvent.slug}'
      );
    }
  }
}

4. Android Configuration

Add the following to your android/app/src/main/AndroidManifest.xml:

xml
<activity
    android:name=".MainActivity"
    android:exported="true"
    android:launchMode="singleTop"
    android:theme="@style/LaunchTheme">
    
    <!-- Existing intent filters -->
    
    <!-- Add this for Redirectly links -->
    <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="https" android:host="YOUR_USERNAME.redirectly.app" />
    </intent-filter>
</activity>

5. iOS Configuration

Add the following to your ios/Runner/Info.plist:

xml
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>redirectly.app</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>https</string>
        </array>
    </dict>
</array>
Pure Dart Implementation

The flutter_redirectly package uses pure Dart code with no native dependencies, making it faster to build and easier to debug!

Testing Your Mobile Setup

1. Create a Test Link

Use your dashboard or API to create a test link like test-mobile

2. Test on Device

Send yourself the link via SMS/email and tap it. Your app should open and handle the link.

3. Test Cold Start

Force-close your app, then tap the link again to test cold start handling.

Best Practices

Tips for production deployment and optimization

Security

  • • Store API keys securely (environment variables)
  • • Never expose API keys in client-side code
  • • Validate URLs before creating links
  • • Implement rate limiting on your endpoints

Performance

  • • Use temporary links for time-sensitive content
  • • Implement caching for frequently accessed links
  • • Monitor click analytics for insights
  • • Set appropriate TTL for temporary links

Mobile

  • • Test deep links on both iOS and Android
  • • Handle app not installed scenarios
  • • Implement fallback web pages
  • • Test cold start and warm start scenarios

Error Handling

  • • Implement proper error handling for API calls
  • • Provide user-friendly error messages
  • • Log errors for debugging and monitoring
  • • Have fallback strategies for failed requests

🎉 You're All Set!

You now have everything you need to integrate Redirectly into your applications. Create powerful, trackable short links with deep linking support across all platforms.