> 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/library/action-nodes/create-shortlink.md).

# Create shortlink

The **Create Shortlink** action node creates a short URL that redirects to a longer one, for example `https://af.link/cnt8J1`. It is available in apps, Services and Flows.

{% hint style="info" %}
Showroom: [Create shortlink example](https://showroom.appfarm.app/action-nodes/create-shortlink), with its setup in Appfarm Create ([register](https://showroom.appfarm.app/sign-up) for access).
{% endhint %}

## Usage

Shortlinks are useful where long URLs break or cost space, such as in [SMS messages](https://docs.appfarm.io/library/action-nodes/send-sms.md). The shortlink is written to a property, and you can then use it in a message, a QR code or a text.

Only shorten URLs that your app builds. A shortlink hides where it leads, so don't create shortlinks from URLs that users type in.

## Properties

| Property         | Description                                                                                                                                                                                                                                                                           |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Target URL**   | The URL the shortlink redirects to. Bind to a String or URL property, or type a URL. It must be a complete URL, for example `https://example.com/page`. If it isn't, the action node fails with the error *Create Shortlink: Invalid URL*.                                            |
| **Shortlink to** | The String or URL property that receives the full shortlink URL. If you bind to a property on a data source, the data source must already hold the object, so create it first. You can also write to an [app variable](https://docs.appfarm.io/reference/apps/data/app-variables.md). |
| **TTL**          | How long the shortlink works, in seconds. Leave empty to use 7 days (`604800`). The longest TTL is 548 days (`47347200`) in Staging and Production and 7 days in Development and Test. Larger values are cut to the longest TTL.                                                      |

## Example

To send an order confirmation by SMS:

1. Build the order URL with a function, for example `https://myapp.appfarm.app/orders?id=` followed by the order ID.
2. Add **Create Shortlink**. Set **Target URL** to the function and **Shortlink to** to a String app variable `Order link`.
3. Add [Send SMS](https://docs.appfarm.io/library/action-nodes/send-sms.md) and include `Order link` in the message.


---

# 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.appfarm.io/library/action-nodes/create-shortlink.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.
