Examples
Authentication
Test API Key
curl -X GET https://relink.is/api/v1/validate \
-H "Authorization: Bearer rlk_your_api_key_here"
Response:
{
"message": "API key is valid",
"userId": "clp789user123",
"status": "success"
}
Creating Smartlinks
Create App Smartlink (Auto-generated URL)
curl -X POST https://relink.is/api/v1/smartlink \
-H "Authorization: Bearer rlk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"config": {
"smartlinkName": "My Test App",
"smartlinkType": "App"
}
}'
Create App Smartlink (Custom URL)
curl -X POST https://relink.is/api/v1/smartlink \
-H "Authorization: Bearer rlk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"config": {
"smartlinkTempUrl": "myapp1",
"smartlinkName": "My Custom App",
"smartlinkType": "Landing"
}
}'
Updating Smartlinks
Update App Configuration
curl -X PUT https://relink.is/api/v1/smartlink \
-H "Authorization: Bearer rlk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"smartlinkId": "clp123abc456def",
"smartlinkConfig": {
"type": "App"
},
"configuration": {
"smartlinkName": "Updated App Name",
"smartlinkUrl": "myapp1",
"appStoreLink": "https://apps.apple.com/app/myapp",
"googlePlayLink": "https://play.google.com/store/apps/details?id=com.myapp",
"windowsAppLink": "https://www.microsoft.com/store/apps/myapp",
"macOsAppLink": "https://apps.apple.com/app/myapp",
"ipadAppLink": "https://apps.apple.com/app/myapp",
"appGalleryLink": "https://appgallery.huawei.com/app/myapp",
"amazonStoreLink": "https://www.amazon.com/dp/myapp",
"fallBackLink": "https://myapp.com"
},
"openGraph": {
"title": "My Awesome App",
"description": "Download my awesome app now!",
"imageUrl": "https://myapp.com/og-image.jpg",
"metaTags": {
"author": "My Company",
"keywords": "app, mobile, download"
}
},
"customHtml": {
"head": "<meta name=\"theme-color\" content=\"#007bff\">",
"body": "<script>console.log(\"Custom tracking code\");</script>",
"active": true
}
}'
Update Landing Page
curl -X PUT https://relink.is/api/v1/smartlink \
-H "Authorization: Bearer rlk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"smartlinkId": "clp123abc456def",
"smartlinkConfig": {
"type": "Landing"
},
"configuration": {
"smartlinkName": "Updated Landing Page",
"smartlinkUrl": "mypage"
},
"landing": {
"title": "Welcome to My Landing Page",
"description": "This is an awesome landing page created with Relink",
"logoLink": "https://example.com/logo.png",
"themeColor": "#007bff",
"layout": "List",
"theme": "Light"
},
"landingButtons": [
{
"title": "Visit Website",
"link": "https://example.com",
"iconUrl": "https://example.com/icon.png",
"position": 1
},
{
"title": "Contact Us",
"link": "mailto:[email protected]",
"iconUrl": "https://example.com/mail-icon.png",
"position": 2
}
]
}'
Update URL Shortener
curl -X PUT https://relink.is/api/v1/smartlink \
-H "Authorization: Bearer rlk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"smartlinkId": "clp123abc456def",
"smartlinkConfig": {
"type": "Url"
},
"configuration": {
"smartlinkName": "My Short URL",
"smartlinkUrl": "myurl"
},
"shortener": {
"url": "https://very-long-url-that-needs-shortening.com/with/many/parameters?param1=value1¶m2=value2",
"protected": false,
"password": null
}
}'
Update URL Shortener (Password Protected)
curl -X PUT https://relink.is/api/v1/smartlink \
-H "Authorization: Bearer rlk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"smartlinkId": "clp123abc456def",
"smartlinkConfig": {
"type": "Url"
},
"configuration": {
"smartlinkName": "Protected Short URL",
"smartlinkUrl": "secure"
},
"shortener": {
"url": "https://confidential-document.com/secret-content",
"protected": true,
"password": "mySecurePassword123"
}
}'
Update QR Tag
curl -X PUT https://relink.is/api/v1/smartlink \
-H "Authorization: Bearer rlk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"smartlinkId": "clp123abc456def",
"smartlinkConfig": {
"type": "QRTag"
},
"configuration": {
"smartlinkName": "Restaurant QR Menu",
"smartlinkUrl": "menuqr"
},
"qrTag": {
"title": "Our Menu",
"description": "Scan to view our delicious menu",
"logoLink": "https://restaurant.com/logo.png",
"themeColor": "#ff6b35"
},
"qrTagButtons": [
{
"title": "View Menu",
"link": "https://restaurant.com/menu",
"preset": "restaurant",
"position": 1
},
{
"title": "Order Online",
"link": "https://restaurant.com/order",
"preset": "delivery",
"position": 2
},
{
"title": "Call Us",
"link": "tel:+1234567890",
"preset": "phone",
"position": 3
}
]
}'
Update Digital Card
curl -X PUT https://relink.is/api/v1/smartlink \
-H "Authorization: Bearer rlk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"smartlinkId": "clp123abc456def",
"smartlinkConfig": {
"type": "DigiCard"
},
"configuration": {
"smartlinkName": "John Doe\"s Card",
"smartlinkUrl": "johndoe"
},
"digiCard": {
"title": "John Doe",
"jobTitle": "Senior Software Engineer",
"company": "Tech Company Inc.",
"logoLink": "https://techcompany.com/logo.png",
"bgLink": "https://example.com/card-bg.jpg",
"ctaText": "Let\"s Connect!",
"themeColor": "#0077b5"
},
"digiCardButtons": [
{
"title": "Call Me",
"link": "tel:+15551234567",
"preset": "phone",
"position": 1
},
{
"title": "Email Me",
"link": "mailto:[email protected]",
"preset": "email",
"position": 2
},
{
"title": "LinkedIn",
"link": "https://linkedin.com/in/johndoe",
"preset": "linkedin",
"position": 3
},
{
"title": "Website",
"link": "https://johndoe.dev",
"preset": "website",
"position": 4
}
]
}'
Update Text Bin
curl -X PUT https://relink.is/api/v1/smartlink \
-H "Authorization: Bearer rlk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"smartlinkId": "clp123abc456def",
"smartlinkConfig": {
"type": "TxtBin"
},
"configuration": {
"smartlinkName": "JavaScript Code Snippet",
"smartlinkUrl": "jssnippet"
},
"txtBin": {
"title": "React Component Example",
"description": "A simple React functional component with hooks",
"text": "import React, { useState, useEffect } from \"react\";\n\nfunction MyComponent() {\n const [count, setCount] = useState(0);\n\n useEffect(() => {\n document.title = `Count: ${count}`;\n }, [count]);\n\n return (\n <div>\n <h1>Count: {count}</h1>\n <button onClick={() => setCount(count + 1)}>\n Increment\n </button>\n </div>\n );\n}\n\nexport default MyComponent;"
}
}'
Delete Smartlink
curl -X DELETE https://relink.is/api/v1/smartlink \
-H "Authorization: Bearer rlk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"smartlinkId": "clp123abc456def"
}'
Analytics
Get Smartlink Analytics
curl -X GET "https://relink.is/api/v1/smartlink/analytics?id=clp123abc456def" \
-H "Authorization: Bearer rlk_your_api_key_here"
Get All Analytics Summary
curl -X GET https://relink.is/api/v1/analytics/summary \
-H "Authorization: Bearer rlk_your_api_key_here"
Error Testing
Invalid API Key
curl -X GET https://relink.is/api/v1/smartlink \
-H "Authorization: Bearer rlk_invalid_key"
Missing Authorization
curl -X GET https://relink.is/api/v1/smartlink
Duplicate URL Creation
curl -X POST https://relink.is/api/v1/smartlink \
-H "Authorization: Bearer rlk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"config": {
"smartlinkTempUrl": "myapp1",
"smartlinkName": "Duplicate URL Test",
"smartlinkType": "App"
}
}'
Invalid JSON
curl -X POST https://relink.is/api/v1/smartlink \
-H "Authorization: Bearer rlk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{ invalid json }'
Success Response Example
{
"id": "clp123abc456def",
"status": "Active",
"type": "App",
"userId": "clp789user123",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T14:45:00.000Z",
"configuration": {
"id": "clp123abc456def",
"smartlinkName": "My Mobile App",
"smartlinkUrl": "my-mobile-app",
"smartlinkTempUrl": "temp123",
"appStoreLink": "https://apps.apple.com/app/mymobileapp",
"googlePlayLink": "https://play.google.com/store/apps/details?id=com.mymobileapp",
"fallBackLink": "https://mymobileapp.com"
},
"openGraph": {
"id": "clp123abc456def",
"title": "Download My Mobile App",
"description": "The best mobile app for productivity and fun",
"imageUrl": "https://mymobileapp.com/assets/og-image.jpg"
},
"customHtml": {
"id": "clp123abc456def",
"head": "<meta name=\"app-id\" content=\"123456789\">",
"body": "<script>gtag('event', 'smartlink_view', { 'app_name': 'My Mobile App' });</script>",
"active": true,
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T14:45:00.000Z"
},
"analytics": {
"id": "clp123abc456def",
"totalClicks": 1520,
"totalQrCodeScans": 45,
"totalFallBack": 12
}
}