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:
- Open the Settings page of the Firebase console. If you are prompted to choose a project, select your Firebase project from the menu.
- Take note of the value of the Web API Key field.
Create a short link from a long link
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.
Create a short link from parameters
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"
}
}
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.
Requests are limited to 50 queries per second and 100,000 queries per day. If exceeded, then the response will return HTTP error code 429. To request for more quota, fill out this form.

