Create Dynamic Links

There are three ways you can create a Dynamic Link:

  • Using the Firebase console. This is useful if you're creating one-off links to share on social media.
  • Using the REST API. This is the preferred way to dynamically create links in your app for user-to-user sharing or in any situation that requires many links. You can track the performance of Dynamic Links created with the REST API in the Firebase console.
  • Manually. If you don't need to track click data in the Firebase console and you don't care if the links are long, you can manually construct Dynamic Links using URL parameters, and by doing so, avoid an extra network round trip.

Using the REST API

You can create short Dynamic Links with the Firebase Dynamic Links REST API. This API accepts either a long Dynamic Link or an object containing Dynamic Link parameters, and returns a URL like the following example:

https://abc123.app.goo.gl/WXYZ

Before you begin

Get your API key. You will need an API key to authenticate your requests to the API. To find your API key:

  1. Open the Settings page of the Firebase console. If you are prompted to choose a project, select your Firebase project from the menu.
  2. Take note of the value of the Web API Key field.

You can use the Firebase Dynamic Links API to shorten a long Dynamic Link. To do so, make an HTTP POST request to the shortLinks endpoint, specifying the long Dynamic Link in the longDynamicLink parameter. For example:

POST https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=api_key
Content-Type: application/json

{
   "longDynamicLink": "https://abc123.app.goo.gl/?link=https://example.com/&apn=com.example.android&ibi=com.example.ios"
}

See Manually construct a URL to learn how to create long Dynamic Links.

You can also create a short Dynamic Link by specifying the Dynamic Link parameters directly. To do so, make an HTTP POST request to the shortLinks endpoint, specifying the Dynamic Link parameters in the dynamicLinkInfo parameter. For example:

POST https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=api_key
Content-Type: application/json

{
  "dynamicLinkInfo": {
    "dynamicLinkDomain": "abc123.app.goo.gl",
    "link": "https://example.com/",
    "androidInfo": {
      "androidPackageName": "com.example.android"
    },
    "iosInfo": {
      "iosBundleId": "com.example.ios"
    }
  }
}

For a complete specification of the dynamicLinkInfo object, see the API reference.

Set the length of a short Dynamic Link

You can also set the suffix parameter to specify how the path component of the short Dynamic Link is generated.

By default, or if you set the parameter to "UNGUESSABLE", the path component will be a 17-character string, such as in the following example:

https://abc123.app.goo.gl/UVWXYZuvwxyz12345

Such strings are created by base62-encoding randomly generated 96-bit numbers. Use this setting to prevent your Dynamic Links URLs from being guessed and crawled, which can potentially expose sensitive information to unintended recipients.

If you set the parameter to "SHORT", the path component will be a string that is only as long as needed to be unique, with a minimum length of 4 characters.

https://abc123.app.goo.gl/WXYZ

Use this method if sensitive information would not be exposed if a short Dynamic Link URL were guessed.

The following example shows how you can set the suffix parameter:

POST https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=api_key
Content-Type: application/json

{
   "longDynamicLink": "https://abc123.app.goo.gl/?link=http://example.com/&apn=com.example.android&ibi=com.example.ios",
   "suffix": {
     "option": "UNGUESSABLE"
   }
}

Manually constructing a URL

You can also create a Dynamic Link programmatically by constructing a URL with the following form:

https://app_code.app.goo.gl/?link=your_deep_link&apn=package_name[&amv=minimum_version][&al=android_link][&afl=fallback_link]
General parameters
link

The link your app will open. You can specify any URL your app can handle, such as a link to your app's content, or a URL that initiates some app-specific logic such as crediting the user with a coupon, or displaying a specific welcome screen. This link must be a well-formatted URL, be properly URL-encoded, and use the HTTP or HTTPS scheme.

d Instead of loading the Dynamic Link, generate a flowchart you can use to preview your Dynamic Links' behavior on different platforms and configurations.
Android parameters
apn The package name of the Android app to use to open the link. The app must be connected to your project from the Overview page of the Firebase console. Required for the Dynamic Link to open an Android app.
afl The link to open when the app isn't installed. Specify this to do something other than install your app from the Play Store when the app isn't installed, such as open the mobile web version of the content, or display a promotional page for your app.
amv The versionCode of the minimum version of your app that can open the link. If the installed app is an older version, the user is taken to the Play Store to upgrade the app.
iOS parameters
ibi The bundle ID of the iOS app to use to open the link. The app must be connected to your project from the Overview page of the Firebase console. Required for the Dynamic Link to open an iOS app.
ifl The link to open when the app isn't installed. Specify this to do something other than install your app from the App Store when the app isn't installed, such as open the mobile web version of the content, or display a promotional page for your app.
ius Your app's custom URL scheme, if defined to be something other than your app's bundle ID
ipfl The link to open on iPads when the app isn't installed. Specify this to do something other than install your app from the App Store when the app isn't installed, such as open the web version of the content, or display a promotional page for your app.
ipbi The bundle ID of the iOS app to use on iPads to open the link. The app must be connected to your project from the Overview page of the Firebase console.
isi Your app's App Store ID, used to send users to the App Store when the app isn't installed
Social Meta Tag parameters
st The title to use when the Dynamic Link is shared in a social post.
sd The description to use when the Dynamic Link is shared in a social post.
si The URL to an image related to this link.
Analytics parameters
utm_source
utm_medium
utm_campaign
utm_term
utm_content
gclid
Google Play analytics parameters.
at
ct
mt
pt
iTunes Connect analytics parameters.

Next steps

Now that you've created Dynamic Links, you need to set up your app to receive Dynamic Links and send users to the right place in your app after a user opens them.

To receive Dynamic Links in your app, see the documentation for iOS, Android, C++, and Unity.

Send feedback about...

Need help? Visit our support page.