Skip to main content
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>"
}
'
{
  "runId": "<string>",
  "status": "<string>",
  "diff": {}
}

Request

POST /api/platform/diffRun

Body Parameters

runId
string
required
Run ID from startRun

Example 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

runId
string
Run identifier
status
string
Run status: "completed"
diff
object
Computed diff with inserts, updates, and deletes

Example 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

  1. After snapshot: Current database state is captured
  2. Diff computed: Before/after states compared
  3. Results returned: Full diff returned immediately
  4. Replication stopped: WAL capture ends
Use this when you want the raw diff without running assertions. For evaluation with assertions, use evaluateRun instead.

Errors

ErrorStatusDescription
run_not_found404Run doesn’t exist
run_already_completed400Run 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}")