> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dashlink.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating app dynamic links

> Per-platform behaviour, store fallbacks, and deep link targets.

```bash cURL theme={null}
curl -X POST "https://api.dashlink.ai/api/v1/shortlinks/create_dynamic_link" \
  -H "X-API-Key: $DASHLINK_API_KEY" \
  -F 'title=Spring sale' \
  -F "destination_url=https://example.com/spring-sale" \
  -F "apple_behaviour=open_app" \
  -F "apple_intent_url=myapp://sale/spring" \
  -F "apple_no_app_behaviour=store" \
  -F "apple_store_url=https://apps.apple.com/app/id123456" \
  -F "android_behaviour=open_app" \
  -F "android_intent_url=myapp://sale/spring" \
  -F "android_no_app_behaviour=store" \
  -F "android_store_url=https://play.google.com/store/apps/details?id=com.example"
```

```javascript Node.js theme={null}
const body = new FormData();
body.append("title", "Spring sale");
body.append("destination_url", "https://example.com/spring-sale");
body.append("apple_behaviour", "open_app");
body.append("apple_intent_url", "myapp://sale/spring");
body.append("apple_no_app_behaviour", "store");
body.append("apple_store_url", "https://apps.apple.com/app/id123456");
body.append("android_behaviour", "open_app");
body.append("android_intent_url", "myapp://sale/spring");
body.append("android_no_app_behaviour", "store");
body.append("android_store_url", "https://play.google.com/store/apps/details?id=com.example");

const response = await fetch("https://api.dashlink.ai/api/v1/shortlinks/create_dynamic_link", {
  method: "POST",
  headers: { "X-API-Key": process.env.DASHLINK_API_KEY },
  body,
});
const payload = await response.json();
```

```python Python theme={null}
import os
import requests

response = requests.post(
    'https://api.dashlink.ai/api/v1/shortlinks/create_dynamic_link',
    headers={'X-API-Key': os.environ["DASHLINK_API_KEY"]},
    data={
        'title': 'Spring sale',
        'destination_url': 'https://example.com/spring-sale',
        'apple_behaviour': 'open_app',
        'apple_intent_url': 'myapp://sale/spring',
        'apple_no_app_behaviour': 'store',
        'apple_store_url': 'https://apps.apple.com/app/id123456',
        'android_behaviour': 'open_app',
        'android_intent_url': 'myapp://sale/spring',
        'android_no_app_behaviour': 'store',
        'android_store_url': 'https://play.google.com/store/apps/details?id=com.example',
    },
)
payload = response.json()
```

```go Go theme={null}
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"net/url"
	"strings"
)

func main() {
	endpoint0 := "https://api.dashlink.ai/api/v1/shortlinks/create_dynamic_link"
	form0 := url.Values{
		"title": {"Spring sale"},
		"destination_url": {"https://example.com/spring-sale"},
		"apple_behaviour": {"open_app"},
		"apple_intent_url": {"myapp://sale/spring"},
		"apple_no_app_behaviour": {"store"},
		"apple_store_url": {"https://apps.apple.com/app/id123456"},
		"android_behaviour": {"open_app"},
		"android_intent_url": {"myapp://sale/spring"},
		"android_no_app_behaviour": {"store"},
		"android_store_url": {"https://play.google.com/store/apps/details?id=com.example"},
	}
	req0, err0 := http.NewRequest("POST", endpoint0, strings.NewReader(form0.Encode()))
	if err0 != nil {
		panic(err0)
	}
	req0.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req0.Header.Set("X-API-Key", os.Getenv("DASHLINK_API_KEY"))
	resp0, err0b := http.DefaultClient.Do(req0)
	if err0b != nil {
		panic(err0b)
	}
	defer resp0.Body.Close()
	body0, _ := io.ReadAll(resp0.Body)
	fmt.Println(string(body0))
}

```

```ruby Ruby theme={null}
require "net/http"
require "json"
require "uri"

uri0 = URI("https://api.dashlink.ai/api/v1/shortlinks/create_dynamic_link")
request0 = Net::HTTP::Post.new(uri0)
request0["X-API-Key"] = ENV.fetch("DASHLINK_API_KEY")
request0.set_form_data("title" => "Spring sale", "destination_url" => "https://example.com/spring-sale", "apple_behaviour" => "open_app", "apple_intent_url" => "myapp://sale/spring", "apple_no_app_behaviour" => "store", "apple_store_url" => "https://apps.apple.com/app/id123456", "android_behaviour" => "open_app", "android_intent_url" => "myapp://sale/spring", "android_no_app_behaviour" => "store", "android_store_url" => "https://play.google.com/store/apps/details?id=com.example")
response0 = Net::HTTP.start(uri0.hostname, uri0.port, use_ssl: true) do |http|
  http.request(request0)
end
payload0 = JSON.parse(response0.body)
```

```php PHP theme={null}
<?php
$ch0 = curl_init('https://api.dashlink.ai/api/v1/shortlinks/create_dynamic_link');
curl_setopt($ch0, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch0, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch0, CURLOPT_HTTPHEADER, [
    "X-API-Key: " . getenv("DASHLINK_API_KEY"),
]);
curl_setopt($ch0, CURLOPT_POSTFIELDS, http_build_query(['title' => 'Spring sale', 'destination_url' => 'https://example.com/spring-sale', 'apple_behaviour' => 'open_app', 'apple_intent_url' => 'myapp://sale/spring', 'apple_no_app_behaviour' => 'store', 'apple_store_url' => 'https://apps.apple.com/app/id123456', 'android_behaviour' => 'open_app', 'android_intent_url' => 'myapp://sale/spring', 'android_no_app_behaviour' => 'store', 'android_store_url' => 'https://play.google.com/store/apps/details?id=com.example']));
$payload0 = json_decode(curl_exec($ch0), true);
curl_close($ch0);
```

`title` and `destination_url` are required. `destination_url` is what desktop visitors get, and what mobile visitors get if nothing else applies — it is the most-used path, not a fallback afterthought.

## The fields

Each platform takes the same four, prefixed `apple_` or `android_`:

| Field | Does |
| - | - |
| `*_behaviour` | `open_app`, `custom_url`, or `web` |
| `*_intent_url` | The deep link into your app (custom scheme or `https://`) |
| `*_no_app_behaviour` | `store` or `custom`, when the app is not installed |
| `*_store_url` | App Store or Play listing |

`*_custom_url` is used when `*_behaviour` is `custom_url` or when `*_no_app_behaviour` is `custom`.

When `*_no_app_behaviour` is unset and neither store nor custom URL is configured, visitors without the app go to `destination_url` (the web destination).

## Deep link to the right screen

The value of `*_intent_url` is the difference between a link that works and one that technically works.

```
myapp://sale/spring
```

You can also use an `https://` URL (Universal Link on iOS, App Link on Android). Installed users open only when the **Dynamic Link domain** is associated — Chrome self-handles an https `intent://`, so the browser cannot launch the app. See [App association](https://docs.dashlink.ai/guides/app-dynamic-links/app-association.md).

Dropping someone on your home screen when they clicked a link about a specific product means they have to find it again, and most will not. Point the intent URL at the actual content.

### How https fallbacks work

| Effective no-app target | Android | iOS |
| - | - | - |
| Web (`destination_url` only) | Direct redirect to the https intent (browser when the app is absent; verified App Link when installed) | Same |
| Store or custom URL | **https App Link:** 302 to the store or custom URL. Installed users never reach this if the OS intercepted the tap. **Custom scheme:** `intent://` with Play/custom as `S.browser_fallback_url`. In-app WebViews skip `intent://` and go to the fallback. | Custom scheme uses a short “Opening app…” interstitial, then store or custom |

The domain passed to create must have `link_usage` of Dynamic Links. Shared shortlink domains are rejected.

Create and update accept the same password and expiration fields as shortlinks: `password_protected`, `password`, `link_expiration_enabled`, `expires_at`, and `expiration_url`. Password protection requires Growth or above, and link expiration requires a paid plan. Omit the fields on update to leave the stored password and expiration unchanged. Send `password_protected=false` or `link_expiration_enabled=false` to clear them. The response never includes the password hash.

When the OS delivers the short URL to the app, call `GET /{back_half}?format=json` so the app can read `app_url` and the click is recorded as `app_open`.

## Where fallbacks go

Three cases, and all three are worth setting deliberately:

| Situation | Controlled by | Sensible value |
| - | - | - |
| App installed | `*_behaviour` + `*_intent_url` | The matching screen |
| App not installed | `*_no_app_behaviour` + `*_store_url` | The store listing |
| Desktop | `destination_url` | The web equivalent |

> [!TIP]
>
> Point desktop at the web version of the same content, not your homepage. Someone opening the link on a laptop still wants the thing the link was about.

## Updating

```bash cURL theme={null}
curl -X POST "https://api.dashlink.ai/api/v1/shortlinks/update_dynamic_link" \
  -H "X-API-Key: $DASHLINK_API_KEY" \
  -F "name=SHORT-0042" \
  -F "apple_intent_url=myapp://sale/summer"
```

```javascript Node.js theme={null}
const body = new FormData();
body.append("name", "SHORT-0042");
body.append("apple_intent_url", "myapp://sale/summer");

const response = await fetch("https://api.dashlink.ai/api/v1/shortlinks/update_dynamic_link", {
  method: "POST",
  headers: { "X-API-Key": process.env.DASHLINK_API_KEY },
  body,
});
const payload = await response.json();
```

```python Python theme={null}
import os
import requests

response = requests.post(
    'https://api.dashlink.ai/api/v1/shortlinks/update_dynamic_link',
    headers={'X-API-Key': os.environ["DASHLINK_API_KEY"]},
    data={
        'name': 'SHORT-0042',
        'apple_intent_url': 'myapp://sale/summer',
    },
)
payload = response.json()
```

```go Go theme={null}
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"net/url"
	"strings"
)

func main() {
	endpoint0 := "https://api.dashlink.ai/api/v1/shortlinks/update_dynamic_link"
	form0 := url.Values{
		"name": {"SHORT-0042"},
		"apple_intent_url": {"myapp://sale/summer"},
	}
	req0, err0 := http.NewRequest("POST", endpoint0, strings.NewReader(form0.Encode()))
	if err0 != nil {
		panic(err0)
	}
	req0.Header.Set("Content-Type", "application/x-www-form-urlencoded")
	req0.Header.Set("X-API-Key", os.Getenv("DASHLINK_API_KEY"))
	resp0, err0b := http.DefaultClient.Do(req0)
	if err0b != nil {
		panic(err0b)
	}
	defer resp0.Body.Close()
	body0, _ := io.ReadAll(resp0.Body)
	fmt.Println(string(body0))
}

```

```ruby Ruby theme={null}
require "net/http"
require "json"
require "uri"

uri0 = URI("https://api.dashlink.ai/api/v1/shortlinks/update_dynamic_link")
request0 = Net::HTTP::Post.new(uri0)
request0["X-API-Key"] = ENV.fetch("DASHLINK_API_KEY")
request0.set_form_data("name" => "SHORT-0042", "apple_intent_url" => "myapp://sale/summer")
response0 = Net::HTTP.start(uri0.hostname, uri0.port, use_ssl: true) do |http|
  http.request(request0)
end
payload0 = JSON.parse(response0.body)
```

```php PHP theme={null}
<?php
$ch0 = curl_init('https://api.dashlink.ai/api/v1/shortlinks/update_dynamic_link');
curl_setopt($ch0, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch0, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch0, CURLOPT_HTTPHEADER, [
    "X-API-Key: " . getenv("DASHLINK_API_KEY"),
]);
curl_setopt($ch0, CURLOPT_POSTFIELDS, http_build_query(['name' => 'SHORT-0042', 'apple_intent_url' => 'myapp://sale/summer']));
$payload0 = json_decode(curl_exec($ch0), true);
curl_close($ch0);
```

## Listing

```bash cURL theme={null}
curl -X GET "https://api.dashlink.ai/api/v1/shortlinks/get_dynamic_links?per_page=50" \
  -H "X-API-Key: $DASHLINK_API_KEY"
```

```javascript Node.js theme={null}
const response = await fetch("https://api.dashlink.ai/api/v1/shortlinks/get_dynamic_links?per_page=50", {
  headers: { "X-API-Key": process.env.DASHLINK_API_KEY },
});
const payload = await response.json();
```

```python Python theme={null}
import os
import requests

response = requests.get(
    'https://api.dashlink.ai/api/v1/shortlinks/get_dynamic_links?per_page=50',
    headers={'X-API-Key': os.environ["DASHLINK_API_KEY"]},
)
payload = response.json()
```

```go Go theme={null}
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	endpoint0 := "https://api.dashlink.ai/api/v1/shortlinks/get_dynamic_links?per_page=50"
	req0, err0 := http.NewRequest("GET", endpoint0, nil)
	if err0 != nil {
		panic(err0)
	}
	req0.Header.Set("X-API-Key", os.Getenv("DASHLINK_API_KEY"))
	resp0, err0b := http.DefaultClient.Do(req0)
	if err0b != nil {
		panic(err0b)
	}
	defer resp0.Body.Close()
	body0, _ := io.ReadAll(resp0.Body)
	fmt.Println(string(body0))
}

```

```ruby Ruby theme={null}
require "net/http"
require "json"
require "uri"

uri0 = URI("https://api.dashlink.ai/api/v1/shortlinks/get_dynamic_links?per_page=50")
request0 = Net::HTTP::Get.new(uri0)
request0["X-API-Key"] = ENV.fetch("DASHLINK_API_KEY")
response0 = Net::HTTP.start(uri0.hostname, uri0.port, use_ssl: true) do |http|
  http.request(request0)
end
payload0 = JSON.parse(response0.body)
```

```php PHP theme={null}
<?php
$ch0 = curl_init('https://api.dashlink.ai/api/v1/shortlinks/get_dynamic_links?per_page=50');
curl_setopt($ch0, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch0, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch0, CURLOPT_HTTPHEADER, [
    "X-API-Key: " . getenv("DASHLINK_API_KEY"),
]);
$payload0 = json_decode(curl_exec($ch0), true);
curl_close($ch0);
```

## Testing before you ship

Test on real devices, in all four states. Simulators do not exercise app association the way a real device does.

**1. iOS, app installed**

OS should open the app with no Safari flash; the app calls JSON resolve.

**2. iOS, app not installed**

Should reach the App Store listing.

**3. Android, both states**

Same two checks, including from an in-app browser such as WhatsApp or Instagram.

**4. Desktop**

Should reach `destination_url`.

> [!WARNING]
>
> If a link opens the browser on a device that has the app, the problem is almost always [app association](https://docs.dashlink.ai/guides/app-dynamic-links/app-association.md), not the link.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.