Dry-run a tap
Dry-run a tap (playground).
method
GET
host
strait.
version
/v1
resource
/
GET /v1/simulate
Auth: secret key as Authorization: Bearer, or the publishable key as the publishableKey query parameter.
Request
What a tap on url with this user agent would do — the exact decision the link makes — without recording a tap, firing webhooks or counting toward your plan. Authenticate with your secret key (Bearer) or publishableKey; the link must belong to that workspace. Hand-off URLs carry a placeholder tap id (00000000-0000-4000-8000-000000000000).
Parameters
urlrequired string query- The full short link, e.g. https://you.strait.link/summer
uarequired string query- A preset (android, iphone, ipad, desktop, instagram-ios, instagram-android, facebook-android, whatsapp-android, bot) or a raw User-Agent
publishableKeystring query- Instead of a secret key: the workspace publishable key
countrystring query- Simulate a tap from this country (ISO 3166-1 alpha-2, e.g. IN) to test the link's countryRules. Real taps use Cloudflare's country.
Response
- 200 The decision
- 400 Missing/invalid url or ua
- 401 No valid key
- 404 No such link in the key's workspace
curl -X GET "https://strait.link/v1/simulate?url=https%3A%2F%2Fhilltop.strait.link%2Fsummer&ua=iphone" \
-H "Authorization: Bearer $SECRET_KEY"const res = await fetch('https://strait.link/v1/simulate?url=https%3A%2F%2Fhilltop.strait.link%2Fsummer&ua=iphone', {
headers: { Authorization: `Bearer ${process.env.SECRET_KEY}` },
});
const data = await res.json();
console.log(res.status, data);import os
import requests
res = requests.get(
"https://strait.link/v1/simulate?url=https%3A%2F%2Fhilltop.strait.link%2Fsummer&ua=iphone",
headers={"Authorization": f"Bearer {os.environ['SECRET_KEY']}"},
)
print(res.status_code, res.json())<?php
// Plain PHP with ext-curl, no packages. In Laravel, Http::withToken($secretKey)->get($url) sends the same request.
$ch = curl_init('https://strait.link/v1/simulate?url=https%3A%2F%2Fhilltop.strait.link%2Fsummer&ua=iphone');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SECRET_KEY'),
],
]);
$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 {
HttpRequest request = HttpRequest.newBuilder(URI.create("https://strait.link/v1/simulate?url=https%3A%2F%2Fhilltop.strait.link%2Fsummer&ua=iphone"))
.header("Authorization", "Bearer " + System.getenv("SECRET_KEY"))
.GET()
.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"
)
func main() {
req, err := http.NewRequest(http.MethodGet, "https://strait.link/v1/simulate?url=https%3A%2F%2Fhilltop.strait.link%2Fsummer&ua=iphone", nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("SECRET_KEY"))
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
{
"platform": "ios",
"deviceClass": "phone",
"inAppBrowser": null,
"isBot": false,
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1",
"slug": "summer",
"decision": "interstitial",
"sentTo": "app_store_page",
"location": "https://apps.apple.com/app/id123456789?pt=lnk_123&ct=summer",
"reason": "iPhone browser: the app did not open by itself (not installed), so it shows the \"Get the app\" page; the tap on it goes to the App Store and saves the deferred-match fingerprint",
"passwordProtected": false,
"abTest": false
}