# Use your own domain for app links

> Add your own domain for links, verify it, and set the link domains in the iOS, Android, React Native and Flutter SDKs so taps open your app.

Page: https://warplink.app/use-cases/custom-domain-app-links

Add a subdomain such as links.yourapp.com to WarpLink, point it at us with the DNS records we list, and your links are served from it. We generate and host the apple-app-site-association and assetlinks files for that domain, so Universal Links and App Links can verify it for your app.

## How it works

1. **Add a subdomain.** Register a subdomain such as links.yourapp.com in the dashboard or with the API. A root domain cannot point to WarpLink because DNS does not allow a CNAME there.
2. **Add the DNS records.** Add the records the dashboard lists at your DNS provider. WarpLink verifies them and issues the certificate, and the domain shows its status until it is live.
3. **Tell the app about the domain.** Add the domain to the Associated Domains entry on iOS and to the App Links intent filter on Android. Declare it to the SDK with linkDomains so a link resolves on the very first launch.
4. **Create links on the domain.** Set the domain on a link, or make it the default for new links of an app. An explicit domain on a link is not replaced.
5. **Read both association files.** Paste the domain into the deep link checker, or the AASA and assetlinks validators, to read the files the phone reads.
6. **Check the plan terms.** A custom domain serves while your plan includes it, and the Free plan includes a trial. Links on the app's own WarpLink address do not stop.

## Add a domain and declare it to the SDK

### REST API (TypeScript)

```typescript
// Register a subdomain. The response lists the DNS records to add.
const response = await fetch("https://api.warplink.app/v1/domains", {
  method: "POST",
  headers: {
    // API key from Keys > API
    Authorization: "Bearer wl_live_YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ domain: "links.yourapp.com" }),
});

const domain = await response.json();
```

### iOS (Swift)

```swift
WarpLink.configure(
    apiKey: "wl_live_yoursdkkeyhere000000000000000000",
    options: WarpLinkOptions(linkDomains: ["yourapp.aplnk.to", "links.yourapp.com"])
)
```

### Android (Kotlin)

```kotlin
WarpLink.configure(
    context = this,
    apiKey = "wl_live_yoursdkkeyhere000000000000000000",
    options = WarpLinkOptions(linkDomains = listOf("yourapp.aplnk.to", "links.yourapp.com"))
)
```

### React Native

```typescript
WarpLink.configure({
  apiKey: 'wl_live_yoursdkkeyhere000000000000000000',
  linkDomains: ['yourapp.aplnk.to', 'links.yourapp.com'],
})
```

### Flutter

```dart
await WarpLink.configure(
  apiKey: 'wl_live_yoursdkkeyhere000000000000000000',
  linkDomains: ['yourapp.aplnk.to', 'links.yourapp.com'],
);
```

## What you get

- **Linking.** Short links on your own domain, with the association files for iOS and Android hosted for you, and store fallbacks when the app is missing.
- **Attribution.** Installs that follow a tap on a WarpLink link, in any channel, are matched the same way on a custom domain as on the WarpLink address.
- **Analytics.** Clicks, unique clicks and installs for links on the domain, with filters by link, device and country.

## Questions

### Why use a custom domain for app links?

Readers see your brand in the link, and some email and ad systems handle a branded domain better than a shared one. Your app's WarpLink address works too, so a custom domain is a choice, not a requirement.

### Do I have to host the association files myself?

No. WarpLink generates the apple-app-site-association and assetlinks files for the domain from your app registration and serves them. They update when you change the app.

### Why will WarpLink not accept my root domain?

DNS does not allow a CNAME at the root of a domain. Use a subdomain such as links.yourapp.com.

### The app opens for the WarpLink address but not my domain. Why?

The app was not told about the domain, or Apple or Google has not verified it. Add it to the Associated Domains entry or the intent filter, and declare it with linkDomains.

### Can I make the domain the default for new links?

Yes. An owner or admin can set an app's default link domain. A saved default that is no longer live returns an error for a link with no domain, so the link is not created on the wrong host.

## Related

- [Custom domains](https://warplink.app/docs/concepts/custom-domains)
- [Domains API](https://warplink.app/docs/api/domains)
- [AASA validator](https://warplink.app/tools/aasa-validator)
- [Assetlinks validator](https://warplink.app/tools/assetlinks-validator)
- [Test and validate deep links](https://warplink.app/use-cases/test-and-validate-deep-links)
