Diff Version
curl --request GET \
--url https://api.example.com/v0/artifacts/{publicId}/versions/{vid}/diffimport requests
url = "https://api.example.com/v0/artifacts/{publicId}/versions/{vid}/diff"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v0/artifacts/{publicId}/versions/{vid}/diff', 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/v0/artifacts/{publicId}/versions/{vid}/diff",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v0/artifacts/{publicId}/versions/{vid}/diff"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v0/artifacts/{publicId}/versions/{vid}/diff")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v0/artifacts/{publicId}/versions/{vid}/diff")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyVersions
Diff Version
GET /v0/artifacts//versions//diff — Diff a version against the previous version
GET
/
v0
/
artifacts
/
{publicId}
/
versions
/
{vid}
/
diff
Diff Version
curl --request GET \
--url https://api.example.com/v0/artifacts/{publicId}/versions/{vid}/diffimport requests
url = "https://api.example.com/v0/artifacts/{publicId}/versions/{vid}/diff"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/v0/artifacts/{publicId}/versions/{vid}/diff', 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/v0/artifacts/{publicId}/versions/{vid}/diff",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v0/artifacts/{publicId}/versions/{vid}/diff"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v0/artifacts/{publicId}/versions/{vid}/diff")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v0/artifacts/{publicId}/versions/{vid}/diff")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_bodyRetrieve the difference between a version and the version immediately before it. Text artifacts (
Text payload (
Rows payload (
markdown, html, code, text, json) return a word-level diff; csv artifacts return a row-level diff. This endpoint is publicly accessible — no authentication required.
The diff is computed on first request and cached, so repeat calls are fast. A diff is always a version against its immediate predecessor — there is no arbitrary version-pair comparison.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
publicId | string | Yes | The public ID of the artifact |
vid | string | Yes | The version ID to diff against its predecessor |
Example Request
curl https://api.tokenrip.com/v0/artifacts/ast_abc123/versions/vid_9kLmN3pQ/diff
Example Response
{
"ok": true,
"data": {
"versionId": "vid_9kLmN3pQ",
"baseVersionId": "vid_7hGfD2sR",
"baseVersion": 2,
"payload": {
"strategy": "text",
"segments": [
{ "op": "equal", "value": "The quick " },
{ "op": "delete", "value": "brown" },
{ "op": "insert", "value": "red" },
{ "op": "equal", "value": " fox" }
],
"stats": { "added": 1, "removed": 1 }
}
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
versionId | string | The version that was diffed |
baseVersionId | string | null | The previous version it was compared against. null for the earliest version. |
baseVersion | integer | null | The sequential number of the previous version |
payload | object | null | The diff. null for the earliest version or a non-diffable type (chart, file, table). |
Text payload (strategy: "text")
| Field | Type | Description |
|---|---|---|
segments | array | Ordered runs of text, each with an op of equal, insert, or delete |
stats.added | integer | Number of inserted words |
stats.removed | integer | Number of removed words |
Rows payload (strategy: "rows")
| Field | Type | Description |
|---|---|---|
rows | array | Ordered CSV rows, each with an op of equal, insert, or delete |
stats.added | integer | Number of inserted rows |
stats.removed | integer | Number of removed rows |
Error Codes
| Error | Description |
|---|---|
NOT_FOUND | No artifact exists with the given publicId, or no version exists with the given vid on this artifact |
⌘I