# Send short links in texts

Send approval, capture and hosted page links by text as a short link on the main domain that expires with the page it opens.

Use short links to keep a text to one line a person can read. When Provenance texts an approval, a cart approval or a capture link, the text carries a short link such as `provenanceauth.com/c/tQ7mXk2pRw9L` in place of the long one. It opens the same page, and it expires when that page does.

**Before you begin:** a request sent by text: a [capture request](https://provenanceauth.com/docs/attest/guides/capture-requests.md), a [mandate approval](https://provenanceauth.com/docs/mandate/guides/route-approvals.md) or a [cart approval](https://provenanceauth.com/docs/authorize/guides/ask-your-own-customer.md). There's nothing to turn on per request.

## 1. Send the request as you do today

Create the request with a phone contact. The text goes out with a short link, and the API answer is unchanged. In the sandbox the text is recorded as a [test text](https://provenanceauth.com/docs/messaging/test-texts.md) and never sent:

```text
Larkmoor Bank needs your ID and a selfie. Open within 24 hours: provenanceauth.com/c/tQ7mXk2pRw9L
```

| Part | What it is |
| --- | --- |
| `provenanceauth.com/c/` | Provenance's main domain, the same for every company. |
| `t` | The environment: `t` for the sandbox, `l` for live. |
| `Q7mXk2pRw9L` | 11 random letters and digits, made for this one text. |

A short link points only at a Provenance page: an approval page, a capture link or a hosted page. A capture link that opens your own app (a capture app link on your account) stays as you set it.

## 2. Text a hosted page yourself

When you send a [hosted page](https://provenanceauth.com/docs/embeds/hosted-page.md) link through your own texts, use its `short_url`. [`POST /v1/embed/links`](https://provenanceauth.com/docs/api/embeds.md#post-v1-embed-links) answers it beside `url`:

**curl**

```bash norun
curl -s -X POST $PROVENANCE_API/v1/embed/links \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "widget": "capture_result", "object_id": "capr_01M7JDNVW9Y267T8JEKZHVYP7G" }'
```

**Node**

```ts
const link = await prov.embed.createLink({ widget: "capture_result", objectId: requestId });
const forText = link.shortUrl ?? link.url;
```

**Python**

```python
link = prov.embed.create_link(widget="capture_result", object_id=request_id)
for_text = link.get("short_url", link["url"])
```

```json
{
  "id": "01M7KCG7JZ4PJHKB38QFV7FR74",
  "object": "embed_link",
  "url": "https://app.provenanceauth.com/r?t=embl_BteyFysm89vLOrxixijtnuDO9ZMKLtfBKxSFSE5rqMM",
  "short_url": "https://provenanceauth.com/c/tQ7mXk2pRw9L",
  "widget": "capture_result",
  "object_id": "capr_01M7JDNVW9Y267T8JEKZHVYP7G",
  "mode": "view",
  "expires_at": "2026-11-17T00:08:57.087Z",
  "session_ttl": 3600
}
```

Both are shown once. The short link opens once within the link's `ttl`, as the long one does.

## 3. What happens when someone opens it

| Case | What the person sees |
| --- | --- |
| The page is still open | They land on the page the text was for, in one step. |
| The page has expired | "This link has expired", and nothing opens. |
| The code is mistyped | "This link isn't valid", and nothing opens. |

The short link holds no token. The page it opens keeps its own single-use value, so a short link to an approval that was already decided shows that approval's own final state.

## 4. Look up a code

Your support team can check where a code points with `GET /v1/public/short_links`. It takes no key:

**curl**

```bash norun
curl "$PROVENANCE_API/v1/public/short_links?code=tQ7mXk2pRw9L"
```

**Node**

```ts
const link = await (await fetch(`${process.env.PROVENANCE_API}/v1/public/short_links?code=tQ7mXk2pRw9L`)).json();
```

**Python**

```python
link = httpx.get(f"{api}/v1/public/short_links", params={"code": "tQ7mXk2pRw9L"}).json()
```

```json
{
  "object": "short_link",
  "kind": "capture",
  "url": "https://app.provenanceauth.com/capture/Xq3vW9bT2mK7sYd4cFjLhN6gAe1nR5xZpQ8uVw0yB2c",
  "expires_at": "2026-11-19T00:08:57.087Z"
}
```

The `url` is a live link to the page. Open it or pass it on; don't store it.

## Errors you might see

| Status | Code | When |
| --- | --- | --- |
| 404 | [`short_link_missing`](https://provenanceauth.com/docs/platform/errors.md#short_link_missing) | No short link has this code in this environment. |
| 400 | [`short_link_expired`](https://provenanceauth.com/docs/platform/errors.md#short_link_expired) | The page it pointed to has expired. |
| 503 | [`short_link_unavailable`](https://provenanceauth.com/docs/platform/errors.md#short_link_unavailable) | The look-up couldn't run. The long link in the request still works. |

## See also

- [Hosted page for results](https://provenanceauth.com/docs/embeds/hosted-page.md)
- [Consent to text](https://provenanceauth.com/docs/messaging/text-consent.md)
- [Test texts in the sandbox](https://provenanceauth.com/docs/messaging/test-texts.md)
