Update a link
method
PATCH
host
strait.
version
/v1
resource
/
PATCH /v1/links/{slug}
Auth: secret key as Authorization: Bearer. Server-side only.
Request
Send only the fields to change. null clears expiresAt (never expires), expiredAction (back to the workspace setting), expiredUrl, startsAt (live now), notLiveAction (the coming-soon page), notLiveUrl and countryRules (null or [] = none; a list replaces all rules). isActive is sent on its own: false pauses the link (same as DELETE). true answers the active link with this slug if there is one (safe to retry; check its longUrl), else turns the most recently paused one back on (taps follow within 30 seconds, like any edit). A link disabled for abuse cannot be turned back on (409 link_blocked).
Parameters
slugrequired string path- The link's slug: the part after your link domain, e.g.
summer
Body (JSON)
longUrlstring- https only
titlestringtagsstring[]expiresAtobjectexpiredAction"page" | "store" | "url" | "null"- Where taps go once the link has expired (see NewLink); null = the workspace setting.
expiredUrlstring,null- https; required when expiredAction is url.
startsAtobject- Scheduled go-live (see NewLink); null = live now.
notLiveAction"page" | "store" | "url" | "null"- Where taps go before startsAt (see NewLink); null = the coming-soon page.
notLiveUrlstring,null- https; required when notLiveAction is url.
isActiveboolean- Send alone. false = pause, true = turn the paused link back on.
webTapIdboolean,null- strait_click on web pages for this link (see NewLink); null = follow the workspace setting.
countryRulesarray,null- Replaces all country rules (see NewLink); null or [] removes them.
Response
- 200 Updated
- 400 Invalid field, isActive sent with other fields, or destination_blocked (a URL failed the unsafe-destination check;
fieldnames which one; with isActive: true the link stays paused) - 404 Not found (with isActive: true: no paused or active link with this slug)
- 409 isActive: true refused: link_blocked (disabled for abuse) or slug_in_use (the database refused: a link created at the same moment, or the same Firebase link is on)
curl -X PATCH https://strait.link/v1/links/summer \
-H "Authorization: Bearer $SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"longUrl": "https://shop.example.com/sale/summer-v2",
"expiresAt": "2026-12-31T23:59:59Z"
}'const res = await fetch('https://strait.link/v1/links/summer', {
method: 'PATCH',
headers: { Authorization: `Bearer ${process.env.SECRET_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
"longUrl": "https://shop.example.com/sale/summer-v2",
"expiresAt": "2026-12-31T23:59:59Z"
}),
});
const data = await res.json();
console.log(res.status, data);import os
import requests
res = requests.patch(
"https://strait.link/v1/links/summer",
headers={"Authorization": f"Bearer {os.environ['SECRET_KEY']}"},
json={
"longUrl": "https://shop.example.com/sale/summer-v2",
"expiresAt": "2026-12-31T23:59:59Z",
},
)
print(res.status_code, res.json())<?php
// Plain PHP with ext-curl, no packages. In Laravel, Http::withToken($secretKey)->patch($url, $body) sends the same request.
$ch = curl_init('https://strait.link/v1/links/summer');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SECRET_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'longUrl' => 'https://shop.example.com/sale/summer-v2',
'expiresAt' => '2026-12-31T23:59:59Z',
], JSON_THROW_ON_ERROR),
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
echo $status, PHP_EOL;
print_r(json_decode($response, true));import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
// Java 17+, java.net.http only (no dependencies).
public class Main {
public static void main(String[] args) throws Exception {
String body = """
{
"longUrl": "https://shop.example.com/sale/summer-v2",
"expiresAt": "2026-12-31T23:59:59Z"
}
""";
HttpRequest request = HttpRequest.newBuilder(URI.create("https://strait.link/v1/links/summer"))
.header("Authorization", "Bearer " + System.getenv("SECRET_KEY"))
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> res = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(res.statusCode() + " " + res.body());
}
}package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"strings"
)
func main() {
body := strings.NewReader(`{
"longUrl": "https://shop.example.com/sale/summer-v2",
"expiresAt": "2026-12-31T23:59:59Z"
}`)
req, err := http.NewRequest(http.MethodPatch, "https://strait.link/v1/links/summer", body)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("SECRET_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
log.Fatal(err)
}
fmt.Println(res.StatusCode, string(data))
}The response, printed
{
"id": "lnk_5f0c2a8e-3b1d-4f6a-9c7e-2d8b1a0e4f63",
"tenantId": "0b8f6d2e-7a41-4c39-9e15-3f2a6c8d1b70",
"slug": "summer",
"shortUrl": "https://hilltop.strait.link/summer",
"longUrl": "https://shop.example.com/sale/summer-v2",
"isActive": true,
"title": "Summer sale",
"campaign": "summer-2026",
"tags": [
"sale"
],
"expiresAt": 1798761599000
}