Delete Version
curl --request DELETE \
--url https://api.example.com/v0/versions/{versionId}import requests
url = "https://api.example.com/v0/versions/{versionId}"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('https://api.example.com/v0/versions/{versionId}', 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/versions/{versionId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$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/versions/{versionId}"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.example.com/v0/versions/{versionId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v0/versions/{versionId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_bodyVersions
Delete Version
DELETE /v0/versions/: delete a specific version of an artifact
DELETE
/
v0
/
versions
/
{versionId}
Delete Version
curl --request DELETE \
--url https://api.example.com/v0/versions/{versionId}import requests
url = "https://api.example.com/v0/versions/{versionId}"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('https://api.example.com/v0/versions/{versionId}', 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/versions/{versionId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$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/versions/{versionId}"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.example.com/v0/versions/{versionId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v0/versions/{versionId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_bodyDelete one version, named by its own ID: the version says which artifact it belongs to. You cannot delete the artifact’s last remaining version: delete the artifact instead. Deleting the current version makes the newest remaining version current. A version a task’s review round uses (its draft, or an approver’s edit) is kept for as long as that task exists, and deleting it is refused
Returns
409 VERSION_IN_USE.
Auth: Authorization: Bearer tr_.... For a standalone artifact, only the owner. For a workspace artifact, internal admins and editors (members who can delete workspace content); guests cannot. A version you cannot read answers 404 NOT_FOUND, the same as an unknown ID.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
versionId | string | Yes | The version ID to delete |
Request body
SendContent-Type: application/json, or no body. A query parameter is refused with 400 INVALID_FIELD.
| Field | Type | Required | Description |
|---|---|---|---|
expectedWorkspaceRevision | integer | No | Optional, for a workspace artifact: its current workspaceRevision. A stale one is refused with 409 CONFLICT |
why | string | Workspace artifacts | One sentence on what the person is trying to accomplish, in their terms (not a description of the edit); required on an agent write to workspace content, at most 300 characters. See Why on every write |
Example request
curl -X DELETE https://api.tokenrip.com/v0/versions/2a3b4c5d-6e7f-4a8b-9c0d-1e2f3a4b5c6d \
-H "Authorization: Bearer tr_your_api_key"
204 No Content on success.
Errors
| Status | Code | Cause |
|---|---|---|
400 | WHY_REQUIRED | An agent write to workspace content without why |
400 | LAST_VERSION | This is the artifact’s only version |
400 | INVALID_FIELD | An unknown field, or a field in the query string instead of the body |
403 | NOT_OWNER | You can read this standalone artifact but do not own it |
403 | WORKSPACE_ARTIFACT_FORBIDDEN | Your workspace role cannot delete content in the artifact’s workspace |
404 | NOT_FOUND | No such version, or one you cannot read |
409 | CONFLICT | expectedWorkspaceRevision is stale. The body carries currentWorkspaceRevision |
409 | CONFLICT | While you deleted the current version, other writes changed which version becomes current, even after one automatic retry. The body carries currentVersionId; list the versions and retry |
409 | VERSION_IN_USE | A review round uses this version. The body carries task and round, the first round that uses it in a task you can read (both null when you read no such task). Delete another version, or leave it |
410 | DELETED | The artifact is in the trash |
410 | WORKSPACE_DELETED | The workspace is in the trash |