> For the complete documentation index, see [llms.txt](https://docs.appfarm.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appfarm.io/how-to/enhance-your-app/deep-links.md).

# Add deep links

Deep linking allows you to specify query parameters in your app's URL and load data based on those parameters. This is handy for restoring state if the app is refreshed, or for users to share links.

As an example, say you have an app with a view that lists events and another view that shows the details of a single event. As a user navigates from the list of events to a specific event, you can populate the URL parameters with the ID of that event. The resulting URL would look as follows: [https://thirty50.appfarm.app/onboard-events/event?id=624704724506ff7e268ae2b9](https://thirty50-dev.appfarm.app/onboard-events/event?id=624704724506ff7e268ae2b9).

You can then configure your app, using the On App Load event handler, to load the event with the specified ID and display that to the user. This way, if they refresh the app, or send the URL to a friend, the app knows which event to show.

## Configuring a deep link

Follow these steps to create a URL parameter and build the logic for a deep link. You can create as many URL parameters as you need.

### Create a URL parameter

1. In **App Data**, go to **URL Parameters**
2. Click **Add Property** and provide:
   1. A **Key**, which is the name of the parameter ("id" in the above example)
   2. A **Data Type**. If you want to reference a specific object, choose the appropriate Object Class ("Event" in the above example).

### Populate the URL parameter on navigation

In the action that navigates to the view you wish to implement the parameter on, you should have:

* A **Set Selection** action node that selects the object you wish to display.
* A **Navigate** action node that navigates to the detail view.

To populate the URL parameter when the user navigates to the detail view:

1. Edit the **Navigate** action node and set the value of the URL parameter using the selected object.

### Load data on refresh using On App Load

For your app to load data based on URL parameters, you need to configure an action that runs when the app itself is loaded.

1. Create or edit the action attached to the **On App Load** event handler in **App Settings**.
2. Add an **If** action node that checks if your URL parameter has a value
3. Add a **Set Selection** action node to run if the condition is true, with a filter to select the object based on the value of the URL parameter.

Now, your app should populate the URL parameter as the user navigates and load the specified data when the app is refreshed.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.appfarm.io/how-to/enhance-your-app/deep-links.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
