Deep links, deferred deep links and attribution
One SmartLynx link can do the work of three link types. It opens your app with context, sends people who have not installed it yet to the right app store, and records where each install came from. You add the SDK to your app; we run the backend.
Deep links (universal links and app links)
A deep link opens your app with information carried in the link. A user makes a reservation on your website, then taps a link to open your app. The reservation number, and any other fields you choose, travel in the link’s query string, so the app opens straight to the right screen.
Example: https://apps.smartlinks.mobi/mybrand?reservation=A12B34 opens the app and hands it reservation=A12B34. On iOS this uses universal links and on Android it uses app links. We generate and host the verification files for both (apple-app-site-association and assetlinks.json) when you set up your link set. You can also hide the parameters behind a short link.
Deferred deep links
A deferred deep link does everything a deep link does, even when the app is not installed yet. The usual app-open path is lost when someone has to detour through an app store, and a deferred link carries the context across that detour.
- The user taps your link without the app installed. The page they land on records the visit and sends them to the Apple App Store or Google Play, depending on their device.
- They install and open the app.
- On that first launch your app calls checkForLink. The SDK asks our server whether a recent visit from this device matches, and if so it returns the same link, with all its parameters, so your app can show the right screen straight away.
Because the link comes from matching a recent visit rather than from the operating system, the SDK reports a confidence value with each result. See the confidence table on the iOS and Android tabs for the exact values. Deferred links are similar to what many teams used with Firebase Dynamic Links, which has been discontinued.
What your app receives
Both SDKs call you back once with a result that holds the full link (including every query parameter), a confidence value, an open count, and a linkType:
- universal — the app was opened by tapping the link.
- deferred — first launch after an install that followed a link visit.
- previous_universal / previous_deferred — a later launch with no new link, where the stored result from earlier is returned immediately.
- none — no link is known for this device.
Only the first checkForLink on a device waits for the server. After that, answers come from the device immediately, and the server is still contacted in the background so tracking keeps working.
Marketing attribution
Any query parameter starting with utm_ (for example utm_source=newsletter) is recorded when the link is tapped. Your dashboard then shows which sources, mediums and campaigns bring clicks and installs. Because deferred links survive the app store detour, the source of a brand-new install is still known. Turn on Attribution Links in Setup to use this.
What you need to do
- In Setup, tick iOS and/or Android and enter your bundle ID and Team ID, or package name and SHA-256 fingerprint. Copy your mobile API key from there.
- Add the SDK and the one-time platform configuration (associated domain on iOS, intent filter on Android) by following the iOS or Android tab.
- Call checkForLink at launch and when a link opens your app, then use the result to navigate.
- Build your links from the Link builder or by hand: https://apps.smartlinks.mobi/yourbase?your=params. Unless you want short URLs, you never need to call an API to create links.
Optional extras: short links to hide long parameter strings, and remote logging to stream your app’s log lines to the dashboard while you test.
iOS Integration Overview
Adding the SDK to Your Xcode Project
The Smart Links iOS SDK is delivered as a Swift Package. Add it once to your project and it is available to all targets:
- In Xcode, choose File → Add Package Dependencies…
-
Paste the repository URL into the search bar at the top right:
https://github.com/rich-smartlynx/lynxapi-framework - Leave the version rule as Up to Next Major Version starting from 1.1.7 and click Add Package.
- In the package product chooser, make sure lynxapi is ticked and your app target is selected, then click Add Package again.
The package will appear under Package Dependencies in the Project Navigator. Xcode handles downloading, caching, and re-resolving the package automatically — there is nothing to add to a Podfile or Cartfile.
Initializing the Framework
Import lynxapi and create a single top-level Lynx instance with your mobile API key. It is shown in Setup (use the Show button) and is not the same as the short links key described on the Short Links tab. Declare it at file scope (outside any class or struct) so it is accessible from whichever lifecycle callback receives the link:
import lynxapi
let remote = Lynx(apiKey: "YOUR_API_KEY")
Calling checkForLink
remote.checkForLink(userActivity:completion:) is the single method you call in two situations:
- On every app launch — pass nil for userActivity. The framework fingerprints the device and returns any pending deferred link from a previous web visit — even before the user has installed the app.
- When a universal link opens the app — pass the NSUserActivity received from the system. The framework records the link for attribution tracking and returns it as a LinkResults.
The completion block can run on any thread (see Repeat launches below) — dispatch to DispatchQueue.main.async before touching UI. It is safe to do that even if you are already on the main thread.
Repeat Launches: Stored Results
Only the very first checkForLink on a device can depend on finding a deferred link, so the framework does not make you wait on the network after that. Once the server has answered, the framework stores the result on the device and uses it:
- First launch — the completion block is called when the server responds, as described above.
- Later launches with no incoming link — the completion block is called immediately with the stored link and confidence. linkType is reported as previous_deferred or previous_universal, and openCount goes up by one. A device that never had a link gets the same no-link result immediately.
- A universal link opens the app — a normal Smart Link (…/basename?utm_source=…) is returned immediately as the link, with confidence 100 and linkType universal. A short link (…/basename/aB3xY: exactly one extra path segment of 4–7 letters or digits) is the exception. Only the server can expand it into the full link, so the completion block waits for the response.
The network call is still made on every launch, in the background, so attribution tracking and remote logging keep working. Its response refreshes the stored result but does not call your completion block a second time. If the network call fails on the first launch, the completion block is called with nil and the next launch tries again.
Because the answer comes from the device, it can be called on the thread that called checkForLink (usually main), and a change made on the server shows up on the next launch. Deleting the app clears the stored result, so a reinstall starts fresh. This behavior needs iOS SDK 1.1.5 or later.
LinkResults
The completion closure receives an optional LinkResults:
- link: String — the full URL including all query parameters
- confidence: Float — how certain the match is (see table below)
- openCount: Int — number of times checkForLink has been called for this device
- linkType — none, universal, deferred, previous_deferred, or previous_universal. If no link is present on this open but the device was previously seen with one, the last known link is returned.
Confidence Values
| Confidence | Meaning |
|---|---|
| 100 | Universal link — opened directly from a tapped link, no matching uncertainty. |
| 99.99 | Deferred link with virtually no chance of returning the wrong link. |
| ≥ 90 | Very high probability the returned link is the correct one. |
| 50 | A link was found but there is only a 50 % chance it is the correct match — treat with caution. |
| 0 | No link found. The user did not arrive via a Smart Link — this is normal, not an error. |
Attribution Tracking
Any query parameter whose name starts with utm_ is automatically recorded as an attribution parameter. No extra setup is needed — just include them in your Smart Links (e.g. ?utm_source=newsletter&utm_campaign=spring) and they will appear in your dashboard's Attribution Links section.
Entitlements & Associated Domains
iOS only opens a universal link in your app if two things are true: your app declares it can handle the domain, and the server at that domain publishes a file that names your app. Smart Links handles the server side automatically — you just need to configure Xcode.
Step 1 — Add the Associated Domains capability in Xcode:
- Open your project in Xcode and select the project file in the Navigator (the blue icon at the top).
- Select your app target from the target list on the left.
- Click the Signing & Capabilities tab.
- Click + Capability (top-left of the tab) and double-click Associated Domains.
- A new Associated Domains section appears. Click the + button inside it and add:
applinks:apps.smartlinks.mobi
Xcode writes this entry into your target's .entitlements file automatically. You do not need to edit the entitlements file by hand.
Step 2 — Nothing. The AASA file is already there.
iOS requires the server to host an apple-app-site-association (AASA) file at https://apps.smartlinks.mobi/.well-known/apple-app-site-association. This file lists which app bundle IDs and Team IDs are authorised to handle links on that domain. Smart Links generates and hosts this file automatically the moment you create your account — it is updated whenever you change your iOS bundle identifier or Team Identifier in your account settings. There is nothing to upload or configure on the server side.
When your app is installed and iOS sees a link to apps.smartlinks.mobi, it fetches the AASA file in the background, finds your bundle ID and Team ID in it, and from that point on routes matching links directly into your app instead of Safari.
Shared: UniversalLinkRouter.swift
Drop this file into any of the four architecture patterns — the entry-point code is the only thing that changes between them.
Architecture Examples
Choose the pattern that matches your app's lifecycle. The link-handling logic is the same in every case — only the entry point differs.
A complete, buildable Xcode project covering all four patterns is available at github.com/rich-smartlynx/universal-links-demo.
Testing
Universal Links on a Physical Device
Build and install your app, then test a universal link by tapping it from outside your app — Safari, Notes, Mail, or Messages all work. Typing a URL directly into Safari's address bar will not trigger a universal link; iOS only intercepts links that are tapped, not navigated to manually.
When the link fires correctly a banner appears briefly at the top of Safari before the app opens. If the banner doesn't appear and Safari loads the page instead, see Troubleshooting below.
Universal Links in the Simulator
The Simulator supports universal links via the simctl command-line tool. Run this from Terminal — no physical device needed:
xcrun simctl openurl booted "https://apps.smartlinks.mobi/basename?param=value"
Replace basename with your app's base name and add any query parameters you want to test. The Simulator must already have your app installed.
Testing Deferred Links
A deferred link fires when checkForLink(userActivity: nil) is called on launch and the framework finds a fingerprint match from a previous web visit. To set one up:
- Uninstall your app from the device or Simulator (this clears any existing state).
- Open Safari and visit your Smart Link URL (e.g. https://apps.smartlinks.mobi/basename?utm_source=test). Safari (or the device's default browser) will capture a fingerprint and then redirect the user to the App Store, already pointing to your app. If the app is already installed, this same link will act as a universal link and open the app directly instead.
- Install and launch your app. The call to checkForLink(userActivity: nil) in didFinishLaunchingWithOptions (or .task in SwiftUI) will return the link with a confidence value.
You can repeat this cycle as many times as needed — just uninstall between runs to reset the deferred link state. This matters more with stored results: after the first launch, later launches return the stored result immediately (as previous_deferred) and never look for a new deferred link, so you must uninstall to test another one. Each Simulator device has its own independent fingerprint, so you can run multiple scenarios in parallel using different Simulator devices.
Checking the Confidence Value
During development, log the full LinkResults so you can see exactly what the framework returns:
Troubleshooting
Link opens in Safari instead of the app
This is the most common issue. Work through these checks in order:
- Entitlement not saved. Open Xcode → Signing & Capabilities and confirm applinks:apps.smartlinks.mobi is present. It is easy to add it and accidentally close Xcode without the file being written to disk — check that your .entitlements file is committed to source control and contains the entry.
- Bundle ID or Team ID mismatch. The bundle ID and Team ID in your Smart Links account settings must exactly match what is in your Xcode target. A mismatch means the AASA file won't list your app and iOS will fall back to Safari.
- App not installed. Universal links only work when the app is already on the device. If the app is not installed, the link opens in Safari — this is expected iOS behaviour and is precisely why deferred links exist.
- Link tapped from address bar. Typing or pasting a URL into Safari's address bar bypasses universal link routing. The link must be tapped from somewhere — Notes, Mail, Messages, another app, or a web page.
- AASA cache. iOS fetches the AASA file via Apple's own CDN, not directly from the server, and the CDN can cache it for several hours. If you recently updated your bundle ID or Team ID, delete the app and reinstall to force iOS to re-validate the entitlement against the latest AASA.
checkForLink always returns nil or confidence 0
- Wrong API key. Double-check that the key in your code matches the one shown in your Smart Links account settings exactly — it is case-sensitive.
- No prior web visit. For a deferred link to be returned, someone must have visited a Smart Link URL from this device before the app was installed. If you are testing on a fresh Simulator or device without doing the Safari-visit step first, confidence 0 is the correct result.
- Network not available. checkForLink makes a network call. Confirm the device or Simulator has connectivity and that no firewall or VPN is blocking apps.smartlinks.mobi.
Cold launch works but warm resume doesn't (or vice versa)
- SceneDelegate pattern — missing one of the two entry points. With SceneDelegate you must implement both scene(_:willConnectTo:options:) (cold launch) and scene(_:continue:) (warm/background resume). Implementing only one means you will miss links in the other scenario.
- AppDelegate pattern with SceneDelegate present. If your Info.plist contains a scene configuration, iOS routes universal links to the SceneDelegate and application(_:continue:restorationHandler:) in the AppDelegate is never called. Remove the scene configuration or switch to the SceneDelegate pattern.
Universal links tapped inside the app open in Safari
This is intentional iOS behaviour — tapping a universal link within the same app (e.g. in a WKWebView or SFSafariViewController) always opens in Safari. If you need in-app link handling, intercept the URL in the web view's navigation delegate and call checkForLink directly rather than letting the system open it.
Everything looks correct but still not working
Apple provides a built-in diagnostic tool. On a physical device running iOS 16.4 or later, go to Settings → Developer → Universal Links → Diagnostics and enter your URL. It will tell you exactly why the link is or isn't being claimed by your app — including whether the AASA was fetched, whether the entitlement matched, and which app won the claim.
Android Integration Overview
Adding the SDK to Your Project
The Smart Links Android SDK is published on Maven Central. Add a single dependency line to your module-level build.gradle.kts:
dependencies {
implementation("mobi.smartlinks:lynxapi:1.+")
}
The 1.+ version range automatically picks up the latest release within the 1.x series. Gradle resolves it from Maven Central — there is no extra repository to add.
Manifest Permissions
Add the following to your AndroidManifest.xml. The INTERNET permission is required for the checkForLink network call. The <queries> block lets the library detect the device's default browser for fingerprinting:
<!-- Required for checkForLink network calls --> <uses-permission android:name="android.permission.INTERNET" /> <!-- Allow the library to detect the default browser --> <queries> <intent> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="https" /> </intent> </queries>
Initializing the SDK
Import mobi.smartlinks.lynxapi.Lynx and create a single Lynx instance in your launch Activity, passing your mobile API key and the Activity as the context. The key is shown in Setup (use the Show button); it is not the same as the short links key described on the Short Links tab. Declare it as a property of the Activity so it is accessible from both onCreate and onNewIntent:
The context is used for remote logging, which can start before your first checkForLink call. It is safe to construct Lynx in a property initializer — the SDK only keeps the application context. The context is optional (Lynx(apiKey = API_KEY) still works), but without it remote log calls made before checkForLink are ignored.
Calling checkForLink
remote.checkForLink(intent, completion) is the single method you call in two situations (the older checkForLink(context, intent, completion) form still works):
- On every app launch — pass the launching intent from onCreate(). If the intent has no link data, the SDK fingerprints the device and returns any pending deferred link from a previous web visit.
- When an App Link opens the app while it is running — pass the new intent from onNewIntent(). The SDK records the link for attribution tracking and returns it as a LinkResults.
The completion callback can run on any thread (a background thread on the first launch, the calling thread on repeat launches — see below). Use runOnUiThread { } before touching UI; it is safe even if you are already on the main thread.
Repeat Launches: Stored Results
Only the very first checkForLink on a device can depend on finding a deferred link, so the SDK does not make you wait on the network after that. Once the server has answered, the SDK stores the result on the device and uses it:
- First launch — the callback runs when the server responds, as described above.
- Later launches with no incoming link — the callback runs immediately with the stored link and confidence. linkType is reported as PREVIOUS_DEFERRED or PREVIOUS_UNIVERSAL, and openCount goes up by one. A device that never had a link gets the same no-link result immediately.
- An App Link opens the app — a normal Smart Link (…/basename?utm_source=…) is returned immediately as the link, with confidence 100 and linkType UNIVERSAL. A short link (…/basename/aB3xY: exactly one extra path segment of 4–7 letters or digits) is the exception. Only the server can expand it into the full link, so the callback waits for the response.
The network call is still made on every launch, in the background, so attribution tracking and remote logging keep working. Its response refreshes the stored result but does not call your callback a second time. If the network call fails on the first launch, the callback is called with null and the next launch tries again.
Because the answer comes from the device, it can run on the thread that called checkForLink (usually main), and a change made on the server shows up on the next launch. Clearing the app's data or uninstalling it removes the stored result. This behavior needs Android SDK 1.0.6 or later.
LinkResults
The completion lambda receives an optional LinkResults:
- link: String — the full URL including all query parameters
- confidence: Float — how certain the match is (see table below)
- openCount: Int — number of times checkForLink has been called for this install
- linkType: LynkType — NONE, UNIVERSAL, DEFERRED, PREVIOUS_DEFERRED, or PREVIOUS_UNIVERSAL. If no link is present on this open but the device was previously seen with one, the last known link is returned.
Confidence Values
| Confidence | Meaning |
|---|---|
| 100 | App Link — opened directly from a tapped link, no matching uncertainty. |
| 99.99 | Deferred link with virtually no chance of returning the wrong link. |
| ≥ 90 | Very high probability the returned link is the correct one. |
| 50 | A link was found but there is only a 50 % chance it is the correct match — treat with caution. |
| 0 | No link found. The user did not arrive via a Smart Link — this is normal, not an error. |
Attribution Tracking
Any query parameter whose name starts with utm_ is automatically recorded as an attribution parameter. No extra setup is needed — just include them in your Smart Links (e.g. ?utm_source=newsletter&utm_campaign=spring) and they will appear in your dashboard's Attribution Links section.
App Links & Digital Asset Links
Android only opens an App Link directly in your app if two things are true: your manifest declares an intent filter with android:autoVerify="true", and the server at that domain publishes a Digital Asset Links JSON file that names your app. Smart Links handles the server side automatically — you just need to configure your manifest.
Step 1 — Add the App Links intent filter to your Activity:
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTask">
<!-- Standard launcher intent -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- App Links intent filter -->
<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="apps.smartlinks.mobi" />
</intent-filter>
</activity>
The android:launchMode="singleTask" attribute ensures that tapping a link while the app is running calls onNewIntent() rather than creating a second Activity instance.
The android:autoVerify="true" attribute tells the OS to verify your app owns the domain via the Digital Asset Links JSON file at https://apps.smartlinks.mobi/.well-known/assetlinks.json.
Step 2 — Nothing. The assetlinks.json file is already there.
Android requires the server to host an assetlinks.json file at https://apps.smartlinks.mobi/.well-known/assetlinks.json. This file lists which app package names and signing certificate fingerprints are authorised to handle links on that domain. Smart Links generates and hosts this file automatically the moment you create your account — it is updated whenever you change your package name or signing certificate in your account settings. There is nothing to upload or configure on the server side.
When your app is installed, Android fetches the assetlinks.json file, finds your package name and certificate fingerprint in it, and from that point on routes matching links directly into your app instead of Chrome.
Shared: AppLinkRouter.kt
A simple router that parses App Link URIs into a typed data class. The single-Activity demo uses this shared router — the only difference between cold launch and warm resume is where the Intent enters the app.
Architecture Example
Android App Links arrive in two places depending on app state — you must handle both. This maps directly to the iOS SceneDelegate pattern.
A complete, buildable Android Studio project is available at github.com/rich-smartlynx/android-links-demo.
This mirrors the iOS SceneDelegate pattern exactly — onCreate() is the cold-launch path (like scene(_:willConnectTo:options:)) and onNewIntent() is the warm-resume path (like scene(_:continue:)).
Testing
App Links on a Physical Device
Build and install your app, then test an App Link by tapping it from outside your app — Chrome, Gmail, Messages, or any other app. Typing a URL directly into Chrome's address bar will not trigger an App Link; Android only intercepts links that are tapped, not navigated to manually.
When the link fires correctly the app opens immediately — no browser chooser dialog appears. If Chrome opens instead, see Troubleshooting below.
App Links via ADB
You can test App Links from the command line using adb. Run this from Terminal — works with both physical devices and emulators:
adb shell am start -a android.intent.action.VIEW \
-d "https://apps.smartlinks.mobi/basename?param=value" \
your.package.name
Replace basename with your app's base name, your.package.name with your application ID, and add any query parameters you want to test.
Testing Deferred Links
A deferred link fires when checkForLink is called on launch and the SDK finds a fingerprint match from a previous web visit. To set one up:
- Uninstall your app from the device or emulator (this clears any existing state).
- Open Chrome and visit your Smart Link URL (e.g. https://apps.smartlinks.mobi/basename?utm_source=test). Chrome will capture a fingerprint and redirect the user to the Play Store. If the app is already installed, this same link will act as an App Link and open the app directly.
- Install and launch your app. The call to checkForLink in onCreate() will return the link with a confidence value.
You can repeat this cycle as many times as needed — just uninstall (or clear the app's data) between runs to reset the deferred link state. This matters more with stored results: after the first launch, later launches return the stored result immediately (as PREVIOUS_DEFERRED) and never look for a new deferred link. Each emulator AVD has its own independent fingerprint, so you can run multiple scenarios in parallel using different emulators.
Checking the Confidence Value
During development, log the full LinkResults so you can see exactly what the SDK returns:
Troubleshooting
Link opens in Chrome instead of the app
This is the most common issue. Work through these checks in order:
- Intent filter not verified. Open your manifest and confirm the intent filter has android:autoVerify="true" with the correct android:host. The data scheme must be https.
- Package name or certificate mismatch. The package name and signing certificate fingerprint in your Smart Links account settings must exactly match your app. A mismatch means the assetlinks.json file won't list your app and Android will fall back to Chrome.
- App not installed. App Links only work when the app is already on the device. If the app is not installed, the link opens in the browser — this is expected behaviour and is precisely why deferred links exist.
- Debug vs Release signing. If you test with a debug build, the signing certificate is different from your release certificate. Make sure the fingerprint in your Smart Links account matches whichever build type you are testing.
- Link tapped from address bar. Typing or pasting a URL into Chrome's address bar bypasses App Link routing. The link must be tapped from somewhere — Gmail, Messages, another app, or a web page.
checkForLink always returns null or confidence 0
- Wrong API key. Double-check that the key in your code matches the one shown in your Smart Links account settings exactly — it is case-sensitive.
- No prior web visit. For a deferred link to be returned, someone must have visited a Smart Link URL from this device before the app was installed. If you are testing on a fresh emulator without doing the Chrome-visit step first, confidence 0 is the correct result.
- Network not available. checkForLink makes a network call. Confirm the device or emulator has connectivity and that no firewall or VPN is blocking apps.smartlinks.mobi.
- Missing INTERNET permission. Confirm your manifest includes <uses-permission android:name="android.permission.INTERNET" />.
Cold launch works but warm resume doesn't (or vice versa)
- Missing onNewIntent. You must handle both onCreate() (cold launch) and onNewIntent() (warm/background resume). Implementing only one means you will miss links in the other scenario.
- Launch mode not set. Without android:launchMode="singleTask" in your manifest, tapping a link while the app is running creates a second Activity instance instead of calling onNewIntent(). Add the attribute to your Activity declaration.
- setIntent not called. After receiving a new intent in onNewIntent(), call setIntent(intent) to keep getIntent() in sync.
Verifying App Link status
Android provides a built-in diagnostic tool. Run this from Terminal to check whether your app is verified for the domain:
adb shell pm get-app-links your.package.name
Look for apps.smartlinks.mobi in the output with a status of verified. If it shows none or legacy_failure, the assetlinks.json verification failed — check your package name and certificate fingerprint.
Short Links API
Overview
The Short Links API lets you programmatically create shortened Smart Links from your backend server. Each short link maps a compact 4-character code to a full Smart Link URL, preserving all query parameters for deep linking and attribution.
Short links follow the format https://apps.smartlinks.mobi/basename/code — for example https://apps.smartlinks.mobi/myapp/Hg5d. When visited, the short link expands to the original full URL and behaves exactly like a regular Smart Link, including deferred deep linking and attribution tracking.
Security Note: The Short Links API authenticates with your obfuscated API key. This key should only be used from your backend server — never embed it in client-side code (JavaScript, mobile apps, etc.) where it could be inspected or extracted. Keeping the key server-side ensures that only your backend can create short links on behalf of your app.
Endpoint
POST https://apps.smartlinks.mobi/create_short_link
Authentication
Pass your short links API key (the obfuscated key) in the api_key field of the JSON request body. Get it with the button at the bottom of this page. This is a different key from the mobile API key shown in Setup, which only goes into your app’s SDK — the Setup key will not work here.
Request Body
| Field | Type | Description |
|---|---|---|
| api_key | string | Required. Your obfuscated API key (retrieved from your account). |
| url | string | Required. The full Smart Link URL to shorten, including your base name and query parameters — e.g. https://apps.smartlinks.mobi/myapp?utm_source=email&name=Jane |
| redirect_type | int | Optional. 0 (default) = standard: the short link stays the short link and expands on our server. 1 = 301 redirect: the browser is redirected to the full URL. Only applies to apps with an iOS or Android app; ignored for web-only apps. |
Response
On success, the API returns:
| Field | Description |
|---|---|
| success | true |
| short_code | The generated 4-character code (e.g. "Hg5d"). |
| short_url | The complete short URL ready to share (e.g. "https://apps.smartlinks.mobi/myapp/Hg5d"). |
Code Examples
These examples show how to call the API from your backend. Remember — never expose your API key in client-side code.
Redirect Types
Both types are counted and attributed the same way. Every short link goes through the Smart Links backend, and a 301 lands on the full link, which is also a normal request to the backend. The difference is what the user can see.
Standard / passthrough (redirect_type: 0)
The default. The short link stays the short link: nothing is redirected. It expands on our server and is processed as a normal Smart Link (app detection, deferred deep linking, store redirect, attribution). The short link is what appears in a browser’s address bar and history, and the query parameters behind it stay hidden.
301 redirect (redirect_type: 1)
The browser is redirected to the full link, so the full URL — including its query parameters — can show up in the address bar and history, where people can read and copy it. Marketing links are normally tapped rather than typed, so this often doesn’t matter, but choose standard when the parameters shouldn’t be visible. Available only for apps with an iOS or Android app.
Web-only apps
If the app has only a Web Page (no iOS or Android app) there is no choice to make: the short link expands and redirects to the web page with a 302, and redirect_type is ignored.
Your API Key
Click the button below to retrieve your obfuscated API key. Copy it into your backend server code to authenticate Short Link API calls. Do not share this key publicly or embed it in client-side applications.
You must be logged in to retrieve your API key.
Remote Logging
Overview
The Smart Links SDK includes a built-in remote logging facility that streams log messages from your app directly to your Smart Links dashboard. When enabled, every call to remoteLog() in your app sends the message to the server where it can be viewed, filtered, and downloaded.
This is designed for pre-release testing or to temporarily enable on a production build when debugging a specific issue. It is not intended to be left on permanently — it adds a network call for every log message and the server retains logs for a limited time.
Important: Only one app version can have remote logging enabled at a time. When you set a version for iOS or Android, any previously enabled version on that platform is replaced. Turn it off when you are done by clearing the version in the Remote Logging section of your dashboard.
How It Works
- In the Remote Logging section of your dashboard, enter the CFBundleShortVersionString (iOS) or versionName (Android) of the build you want to debug — for example 1.2.3 — and click Set.
- The first time that build calls remoteLog() (or checkForLink, whichever comes first), the SDK sends its app version to the server. If it matches the configured version, the server responds with remoteLogEnabled: true. A log call that triggers this check is held until the answer arrives, so it is not lost.
- From that point on, every remoteLog() call in the app POSTs the message to the Smart Links server, tagged with a short session ID that is the same for every message from one launch of the app. The logs appear in the Remote Logging section of your dashboard.
- When you are done debugging, click Clear for that platform in your dashboard. The next time the app launches, remote logging will be disabled.
Local vs Remote
When remote logging is enabled for the running build, remoteLog() sends the message to the server and, when a level is provided, also writes it to the local device log (Xcode Console / Android Logcat). Omit the level to send remotely without local output.
When remote logging is not enabled for the running build, remoteLog() does nothing — no network call and no local output. This means you can sprinkle remoteLog() calls throughout your code during development and they cost nothing in production until you explicitly turn remote logging on. Use your normal logger for messages that should always appear locally.
Viewing Logs in the Dashboard
- Date — logs are kept for a limited time; pick a day from the last few days.
- Level — the level selector is a minimum. "Warn and above" shows WARN, ERROR, FAULT and ASSERT.
- Session — each line shows its session ID. Click a line to select it, then click Filter for this session to see only that launch of the app. Click Show all sessions to go back.
- Download — saves the lines currently shown (including the session filter) as a text file.
API Reference
iOS — Swift
| OSLogType | Local Logger | Remote Level |
|---|---|---|
| .debug | Logger.debug | DEBUG |
| .info | Logger.info | INFO |
| .default | Logger.notice | NOTICE |
| .error | Logger.error | ERROR |
| .fault | Logger.fault | FAULT |
The level parameter is optional. Omit it to send remotely without writing to the local console.
Android — Kotlin
| Log Constant | Local Logcat | Remote Level |
|---|---|---|
| Log.VERBOSE | Log.v | VERBOSE |
| Log.DEBUG | Log.d | DEBUG |
| Log.INFO | Log.i | INFO |
| Log.WARN | Log.w | WARN |
| Log.ERROR | Log.e | ERROR |
| Log.ASSERT | Log.wtf | ASSERT |
The level parameter is optional. Omit it to send remotely without writing to Logcat.
Usage Examples
Add remoteLog() calls wherever you need visibility. They remain silent in production until you enable the matching version.
Best Practices
When to Use Remote Logging
- Pre-release testing — enable it on your TestFlight or internal test build to verify deep link handling, attribution parameters, and app launch flows without needing the device connected to Xcode or Android Studio.
- Production debugging — if a user reports an issue you cannot reproduce, set their app version as the remote log version, ask them to open the app, and review the logs in your dashboard.
When Not to Use Remote Logging
- Always-on production logging — every remoteLog() call makes a network request. Leaving it enabled permanently wastes bandwidth and battery. Turn it off as soon as you have the information you need.
- Sensitive data — do not log PII, tokens, or credentials via remoteLog(). The messages are transmitted over HTTPS but are stored in plain text on the server.
Tips
- Use meaningful log levels — filter by ERROR or WARN in the dashboard to quickly find problems.
- Include context in your messages (screen name, user action, relevant parameter values) so you can reconstruct what happened without guessing.
- Use the session filter to follow a single launch of the app when several devices are logging at once.
- On Android, pass a Context to the Lynx constructor. Without it, log calls made before checkForLink are ignored. Early remote logging needs iOS SDK 1.1.4 or later and Android SDK 1.0.6 or later.
SmartLynx Demo
One link that handles deep linking, deferred deep linking and marketing attribution all at once. Answer three questions to build a link that carries your answers as parameters.
Try it on a phone. Open the generated link on a mobile device. If you don’t have our demo app installed, you’ll be sent to the app store to download it. Open the app after installing and it shows the name, color and number you entered: that is a deferred deep link in action, with your data carried across the install. If the app is already installed, the link opens it directly with the same information.
How it works
Your answers are encoded into a URL query string, so you can share, bookmark or open the same context anywhere. This is the same mechanism your own links use: whatever you put in the query string is handed to your app by checkForLink.
Live Help
Ask questions about Smart Links integration, the SDK, deep linking, short links, remote logging, or troubleshooting. Powered by AI.
You must be logged in to use Live Help.
© 2026, Smart Lynx LLC