> For the complete documentation index, see [llms.txt](https://docs.snapfix.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snapfix.com/how-the-apps-work/screens/account/deep-link.md).

# Deep link

{% hint style="info" %}
Draft, written by an agent and not yet checked by a person ([how to read these docs](https://docs.snapfix.com/how-to-read.md)). Platforms: web. [Source on GitHub](https://github.com/snapfix/docs/blob/main/spec/screens/account/deep-link.md).
{% endhint %}

The page behind the links in emails and text messages, on `dl.snapfix.com`. It sends a phone to the Snapfix app (and then to the app store), and a computer or a web view to the web app's [Account access](https://docs.snapfix.com/how-the-apps-work/screens/account/account-access.md) page.

* **Where:** web (the separate dynamic-link app) at `dl.snapfix.com`, any path: `/` and every other path show the same page.
* **Who:** anyone with a link from an email or text message. The page is public and calls no API.
* **Feature:** [Email and SMS links](https://docs.snapfix.com/product/features/account/email-links.md)

The links are created with [`POST /v1/app/generate-dynamic-link`](https://docs.snapfix.com/engineering-reference/api/account.md).

![Deep link without a token: the 404 text](https://3653879137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsVVGa79QbcEkJ7n8srxe%2Fuploads%2Fgit-blob-8b3fa3b222cb6fece6f23506e33a1078c33f22d3%2Fdeep-link.png?alt=media)

## Layout

* With a `ctx`: the Snapfix loading animation in the centre.
* Without a `ctx`: "404", "Look like you're lost" and "the page you are looking for not avaible!". The redirect still runs (below).
* On every page: "version: 1.0.1" at the bottom.

## Inputs

| Field                    | Type                | Required                | Default      | Rules and messages                                                                                                                     |
| ------------------------ | ------------------- | ----------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| `ctx` (URL query)        | Text: the link's ID | Yes, for a working link | None         | Passed on as it is, without encoding. Without it the page shows the 404 text and still redirects, with `ctx` as the text `undefined`.  |
| `env` (URL query)        | Text                | No                      | `production` | Picks the web host (below).                                                                                                            |
| `hasWebView` (URL query) | `true` or `1`       | No                      | Off          | Sends the page to [Account access](https://docs.snapfix.com/how-the-apps-work/screens/account/account-access.md), whatever the device. |

| `env`         | Web host                                                                                                                                                                                                                      |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `local`       | `http://localhost:4200`                                                                                                                                                                                                       |
| `test`        | `https://128da6d8-37ea-4133-ad94-91b13afd2bda-test.snapfix.com`                                                                                                                                                               |
| `staging`     | `https://128da6d8-37ea-4133-ad94-91b13afd2bda-staging.snapfix.com`, which is not the web app's staging host `staging.snapfix.com` \[[ASK-8](https://github.com/snapfix/docs/blob/main/ASK.md#ask-8-confirm-the-environments)] |
| anything else | `https://web.snapfix.com`                                                                                                                                                                                                     |

## Actions

The page redirects by itself, in this order:

| Situation                                   | What happens                                                                                                                                                                                                                                                                                                                              |
| ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `hasWebView` is set                         | Goes to `{host}/account-access/?ctx={ctx}`.                                                                                                                                                                                                                                                                                               |
| Not Android and not iOS (by the user agent) | Goes to `{host}/account-access/?ctx={ctx}`. The live app ends on `/account-access?ctx=…`, without the trailing slash.                                                                                                                                                                                                                     |
| Android or iOS                              | Sets the location to `snapfix://open?ctx={ctx}`. 1.5 seconds later it always opens the store, whether or not the app opened, because the page cannot tell: Google Play for `gmail.com.snapfixapp` with `referrer=ctx%3D{ctx}`, or the App Store for app `1083079030` with `?ctx%3D{ctx}`, so on iOS the token sits in the parameter name. |

**Installed apps.** When the app is installed, its own links handle `dl.snapfix.com` and this page is not shown: the iOS universal-link file lists the app for all paths, and the Android app-link file lists package `gmail.com.snapfixapp`.

**Without a token.** A desktop visit to `dl.snapfix.com/` ends on `/account-access?ctx=undefined`, and that page shows "invalid reference" (checked live). Under an iPhone user agent the 404 text shows while the page tries the app (checked live on a desktop browser, where the `snapfix://` attempt fails silently); 1.5 seconds later the code opens the App Store.

## States

* **Loading:** the animation, with a token; the redirect follows at once.
* **Empty:** without a token, the 404 text, until the redirect runs.
* **Error:** none on this page; a bad token fails later, on [Account access](https://docs.snapfix.com/how-the-apps-work/screens/account/account-access.md) or in the app.
* **No permission:** none; the page is public.
* **Offline:** the page does not load.

## Dialogs and sheets

None.

## Platform differences

One web page for every device. Phones are handed to the app or the store; computers and web views go to [Account access](https://docs.snapfix.com/how-the-apps-work/screens/account/account-access.md) \[[ASK-42](https://github.com/snapfix/docs/blob/main/ASK.md#ask-42-are-qr-invitations-meant-for-phones-only)].


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.snapfix.com/how-the-apps-work/screens/account/deep-link.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
