Deferred test mode: claim a test tap
Deferred test mode: claim a test tap (debug builds).
method
POST
host
strait.
version
/v1
resource
/
POST /v1/test-mode/match
Auth: publishable key as publishableKey in the JSON body. Safe in apps and websites.
Request
Lets a debug build prove a deferred link without reinstalling. The SDK sends its debug device id; if a workspace writer opened a 15-minute test window in the dashboard and tapped a link, the answer carries that link (matchMethod: test, test: true). Never touches production matching. Only mounted when the engine runs with TEST_MODE=on (otherwise 404). Publishable key, current key only.
Body (JSON)
publishableKeyrequired stringdeviceIdrequired string- The SDK debug device id
platformstring
Response
- 200 Matched (
longUrl,linkId,clickId) or not (matched: falsewith areason) - 400 deviceId missing or malformed
- 401 Missing, invalid or rotated publishable key
- 404 Test mode is off on this engine
- 429 Rate limited (per IP)
curl -X POST https://strait.link/v1/test-mode/match \
-H "Content-Type: application/json" \
-d '{
"publishableKey": "st_pub_live_…",
"deviceId": "dbg_3f9a2c7e",
"platform": "android"
}'const res = await fetch('https://strait.link/v1/test-mode/match', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"publishableKey": "st_pub_live_…",
"deviceId": "dbg_3f9a2c7e",
"platform": "android"
}),
});
const data = await res.json();
console.log(res.status, data);import requests
res = requests.post(
"https://strait.link/v1/test-mode/match",
json={
"publishableKey": "st_pub_live_…",
"deviceId": "dbg_3f9a2c7e",
"platform": "android",
},
)
print(res.status_code, res.json())<?php
// Plain PHP with ext-curl, no packages. In Laravel, Http::post($url, $body) sends the same request.
$ch = curl_init('https://strait.link/v1/test-mode/match');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'publishableKey' => 'st_pub_live_…',
'deviceId' => 'dbg_3f9a2c7e',
'platform' => 'android',
], 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 = """
{
"publishableKey": "st_pub_live_…",
"deviceId": "dbg_3f9a2c7e",
"platform": "android"
}
""";
HttpRequest request = HttpRequest.newBuilder(URI.create("https://strait.link/v1/test-mode/match"))
.header("Content-Type", "application/json")
.POST(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"
"strings"
)
func main() {
body := strings.NewReader(`{
"publishableKey": "st_pub_live_…",
"deviceId": "dbg_3f9a2c7e",
"platform": "android"
}`)
req, err := http.NewRequest(http.MethodPost, "https://strait.link/v1/test-mode/match", body)
if err != nil {
log.Fatal(err)
}
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
{
"matched": true,
"longUrl": "https://shop.example.com/sale/summer",
"linkId": "lnk_…",
"clickId": "c_…",
"matchMethod": "test",
"reasons": [
"test_mode"
],
"test": true
}