Platform Endpoints
Diff Run
Complete a run and get the computed diff
POST
/
api
/
platform
/
diffRun
Diff Run
curl --request POST \
--url https://api.example.com/api/platform/diffRun \
--header 'Content-Type: application/json' \
--data '
{
"runId": "<string>"
}
'import requests
url = "https://api.example.com/api/platform/diffRun"
payload = { "runId": "<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({runId: '<string>'})
};
fetch('https://api.example.com/api/platform/diffRun', 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/diffRun",
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([
'runId' => '<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/diffRun"
payload := strings.NewReader("{\n \"runId\": \"<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/diffRun")
.header("Content-Type", "application/json")
.body("{\n \"runId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/platform/diffRun")
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 \"runId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"runId": "<string>",
"status": "<string>",
"diff": {}
}Request
POST /api/platform/diffRun
Body Parameters
Run ID from
startRunExample Request
curl -X POST https://api.agentdiff.dev/api/platform/diffRun \
-H "X-API-Key: ad_live_sk_..." \
-H "Content-Type: application/json" \
-d '{
"runId": "run-xyz789"
}'
Response
Run identifier
Run status:
"completed"Computed diff with
inserts, updates, and deletesExample Response
{
"runId": "run-xyz789",
"status": "completed",
"diff": {
"inserts": [
{
"__table__": "messages",
"message_id": "1732645891.000200",
"channel_id": "C01GENERAL99",
"user_id": "U01AGENBOT9",
"message_text": "Hello World!",
"created_at": "2025-11-26T15:31:31"
}
],
"updates": [
{
"__table__": "channels",
"before": {
"last_message_at": null
},
"after": {
"last_message_at": "2025-11-26T15:31:31"
}
}
],
"deletes": []
}
}
Diff Structure
Inserts
New records created during the run:{
"__table__": "messages",
"message_id": "...",
"channel_id": "...",
"message_text": "Hello!"
}
Updates
Modified records with before/after values:{
"__table__": "channels",
"before": { "message_count": 5 },
"after": { "message_count": 6 }
}
Deletes
Records removed during the run:{
"__table__": "messages",
"message_id": "1234567890.000100"
}
What Happens
- After snapshot: Current database state is captured
- Diff computed: Before/after states compared
- Results returned: Full diff returned immediately
- Replication stopped: WAL capture ends
Use this when you want the raw diff without running assertions. For evaluation with assertions, use
evaluateRun instead.Errors
| Error | Status | Description |
|---|---|---|
run_not_found | 404 | Run doesn’t exist |
run_already_completed | 400 | Run already completed |
SDK Usage
diff = client.diff_run(runId=run.runId)
print(f"Inserts: {len(diff.diff['inserts'])}")
print(f"Updates: {len(diff.diff['updates'])}")
print(f"Deletes: {len(diff.diff['deletes'])}")
for insert in diff.diff['inserts']:
print(f" + [{insert['__table__']}] {insert}")
const diff = await client.diffRun({ runId: run.runId });
console.log(`Inserts: ${diff.diff.inserts.length}`);
console.log(`Updates: ${diff.diff.updates.length}`);
console.log(`Deletes: ${diff.diff.deletes.length}`);
diff.diff.inserts.forEach(insert => {
console.log(` + [${insert.__table__}]`, insert);
});
⌘I
Diff Run
curl --request POST \
--url https://api.example.com/api/platform/diffRun \
--header 'Content-Type: application/json' \
--data '
{
"runId": "<string>"
}
'import requests
url = "https://api.example.com/api/platform/diffRun"
payload = { "runId": "<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({runId: '<string>'})
};
fetch('https://api.example.com/api/platform/diffRun', 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/diffRun",
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([
'runId' => '<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/diffRun"
payload := strings.NewReader("{\n \"runId\": \"<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/diffRun")
.header("Content-Type", "application/json")
.body("{\n \"runId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/platform/diffRun")
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 \"runId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"runId": "<string>",
"status": "<string>",
"diff": {}
}