Platform Endpoints
Start Run
Start a test run and capture the ‘before’ snapshot
POST
/
api
/
platform
/
startRun
Start Run
curl --request POST \
--url https://api.example.com/api/platform/startRun \
--header 'Content-Type: application/json' \
--data '
{
"envId": "<string>",
"testId": "<string>",
"testSuiteId": "<string>"
}
'import requests
url = "https://api.example.com/api/platform/startRun"
payload = {
"envId": "<string>",
"testId": "<string>",
"testSuiteId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({envId: '<string>', testId: '<string>', testSuiteId: '<string>'})
};
fetch('https://api.example.com/api/platform/startRun', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/platform/startRun",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'envId' => '<string>',
'testId' => '<string>',
'testSuiteId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/platform/startRun"
payload := strings.NewReader("{\n \"envId\": \"<string>\",\n \"testId\": \"<string>\",\n \"testSuiteId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/platform/startRun")
.header("Content-Type", "application/json")
.body("{\n \"envId\": \"<string>\",\n \"testId\": \"<string>\",\n \"testSuiteId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/platform/startRun")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"envId\": \"<string>\",\n \"testId\": \"<string>\",\n \"testSuiteId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"runId": "<string>",
"status": "<string>",
"beforeSnapshot": "<string>"
}Request
POST /api/platform/startRun
Body Parameters
Environment ID from
initEnvOptional test ID for evaluation against assertions
Optional test suite ID for grouping results
Example Request
curl -X POST https://api.agentdiff.dev/api/platform/startRun \
-H "X-API-Key: ad_live_sk_..." \
-H "Content-Type: application/json" \
-d '{
"envId": "abc123def456",
"testId": "test-789"
}'
Response
Unique run identifier
Run status:
"running"Snapshot ID for the ‘before’ state
Example Response
{
"runId": "run-xyz789",
"status": "running",
"beforeSnapshot": "snapshot_abc123_1732645800"
}
What Happens
- Snapshot captured: Current database state is recorded
- Replication started: WAL changes begin being captured
- Run created: Test run record created in database
After
startRun, all changes to the environment are tracked until diffRun or evaluateRun is called.Errors
| Error | Status | Description |
|---|---|---|
environment_not_found | 404 | Environment doesn’t exist or expired |
run_already_exists | 400 | A run is already active for this environment |
SDK Usage
run = client.start_run(
envId=env.environmentId,
testId="test-123" # Optional
)
print(f"Run ID: {run.runId}")
const run = await client.startRun({
envId: env.environmentId,
testId: 'test-123' // Optional
});
console.log(`Run ID: ${run.runId}`);
⌘I
Start Run
curl --request POST \
--url https://api.example.com/api/platform/startRun \
--header 'Content-Type: application/json' \
--data '
{
"envId": "<string>",
"testId": "<string>",
"testSuiteId": "<string>"
}
'import requests
url = "https://api.example.com/api/platform/startRun"
payload = {
"envId": "<string>",
"testId": "<string>",
"testSuiteId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({envId: '<string>', testId: '<string>', testSuiteId: '<string>'})
};
fetch('https://api.example.com/api/platform/startRun', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/platform/startRun",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'envId' => '<string>',
'testId' => '<string>',
'testSuiteId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/platform/startRun"
payload := strings.NewReader("{\n \"envId\": \"<string>\",\n \"testId\": \"<string>\",\n \"testSuiteId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/platform/startRun")
.header("Content-Type", "application/json")
.body("{\n \"envId\": \"<string>\",\n \"testId\": \"<string>\",\n \"testSuiteId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/platform/startRun")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"envId\": \"<string>\",\n \"testId\": \"<string>\",\n \"testSuiteId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"runId": "<string>",
"status": "<string>",
"beforeSnapshot": "<string>"
}