# Getting Started with Detour

This guide describes how to set up Detour for your app. You create an
organization, configure an app in the dashboard, integrate the SDK, and test a
deferred link on a real device.

## 1. Create an account

Sign up at the [Detour dashboard](https://godetour.dev/auth/signup) and confirm your email.

## 2. Create or join an organization

Detour is multi-tenant. An **Organization** groups apps, links, and users under one unique subdomain.

- You choose that subdomain while creating the organization: `yourorg.godetour.link`.
- Invited members manage apps and links according to their role: **Owner**, **Admin**, or **Member**.

:::note[Subdomain and links]
The organization subdomain is the base for every generated deferred link. To use your own host instead, see [Custom domain](https://detour.swmansion.com/docs/platform/advanced/custom-domain).
:::

## 3. Create your app

In the dashboard, create a new app by providing an **App Name**. Detour then generates:

- **App ID** — the unique app identifier used by the SDK configuration.
- **Publishable API Key** — the active key used by the SDK configuration.
- **Base deferred link** — `https://<yourorg>.godetour.link/<app_hash>`, or your custom domain if one is attached.

:::note
The **App ID** and **Publishable API Key** are both required by the SDK configuration.
:::

## 4. Configure the app

After you create an app, its details view opens automatically. You can also open it later from the **Apps** list. Complete the three tabs below.

### Link settings

- **Your app link** is generated automatically and is read-only. You can copy it, open its QR code, and manage its metadata, but the base hash segment must stay unchanged.
- Set the **Redirect URL for web fallback**.
- Pick a query-forwarding strategy for that fallback URL: **Don't pass parameters**, **Pass all parameters**, or **Pass specific parameters**.
- Use **Short links** for campaign variants with their own path and query parameters.
- Optionally tune **Matching configuration**. See [Matching](https://detour.swmansion.com/docs/platform/architecture/matching).

### App configuration

Configure **iOS** and **Android** separately.

#### iOS

| Field                    | Format                                     | Where to find it                                                          |
| ------------------------ | ------------------------------------------ | ------------------------------------------------------------------------- |
| Bundle ID                | For example `com.example.app`              | Xcode: target settings → **General** → **Bundle Identifier**              |
| Team ID                  | 10 uppercase letters and digits            | Apple Developer account membership details, or Xcode signing settings     |
| App Store ID             | Numeric                                    | App Store Connect, or your app's App Store URL (`.../id1234567890`)       |
| Enable copy link feature | Optional                                   | —                                                                         |

#### Android

| Field                           | Format                        | Where to find it                                                                                                       |
| ------------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Package name                    | For example `com.example.app` | `applicationId` in `build.gradle`, or `android.package` in an Expo config                                              |
| SHA-256 certificate fingerprint | At least one                  | [Finding your Android SHA-256 fingerprint](https://detour.swmansion.com/docs/platform/fundamentals/universal-app-links#finding-your-android-sha-256-fingerprint) |

The SHA-256 fingerprint must match the key that signed the build you install.
Otherwise links open in the browser instead of the app. Which key that is
depends on how you build.

On save, Detour generates the integration snippets for the app-side setup, filled in with your real host and path values.

### API configuration

- Copy the **Publishable API Key** and **App ID**.
- **Generate new key** rotates the key and revokes the previously active one.

## 5. Integrate the SDK and your app

<ActiveSdkInstallationLinks />

After you install and initialize the SDK:

1. **Register the Detour host**

   Add the snippets from **App configuration**. On iOS that is an Associated
   Domain, on Android an App Link intent filter. Without them, Detour links do
   not open your app when it is already installed. Deferred links work without
   them.

2. **Handle navigation**

   Open the screen for the returned link, as described in the SDK usage guide.

Custom-scheme links need a separate registration. See
[Universal Links & App Links](https://detour.swmansion.com/docs/platform/fundamentals/universal-app-links#app-side-setup).

## 6. Test the deferred-link flow

Which steps apply depends on whether your app is already in the store.

### Before your app is published

This is the usual case at this point, because the build that carries the SDK is
not in a store yet. Only the install step changes, so a simulator or an emulator
works here.

1. Remove any earlier install from the device, simulator or emulator.
2. Open a Detour link in a mobile browser there.
3. Install your development build there and open it.

Detour records the click before the redirect runs, so the redirect ending on the
web fallback or on a listing that does not exist yet does not affect the test.

### After your app is published

This needs a real device.

1. Remove any earlier install from the device.
2. Open a Detour link in a mobile browser there.
3. Follow the redirect into the App Store or Google Play, install the app from
   there, and open it.

In both cases the SDK returns the link you opened, on the first launch after the
install. For the full steps, see
[Testing Deferred Links](https://detour.swmansion.com/docs/platform/fundamentals/testing).

## Related pages

[Dashboard Walkthrough](https://detour.swmansion.com/docs/platform/fundamentals/dashboard/)
  [Universal Links & App Links](https://detour.swmansion.com/docs/platform/fundamentals/universal-app-links/)
  [Click Handling & Redirect Flow](https://detour.swmansion.com/docs/platform/architecture/click-handling/)