Skip to main content
POST
/
v1
/
sessions
/
{session_id}
/
chunks
/
{chunk_id}
/
re-edit
Re-apply the AI's intended edit on top of the user's current version of one section.
curl --request POST \
  --url https://api.example.com/v1/sessions/{session_id}/chunks/{chunk_id}/re-edit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "user_current_html": "<string>",
  "ai_original_old_html": "<string>",
  "ai_proposed_new_html": "<string>",
  "ai_explanation": "<string>",
  "model_tier": "<string>",
  "mode": "redo"
}
'
import requests

url = "https://api.example.com/v1/sessions/{session_id}/chunks/{chunk_id}/re-edit"

payload = {
"user_current_html": "<string>",
"ai_original_old_html": "<string>",
"ai_proposed_new_html": "<string>",
"ai_explanation": "<string>",
"model_tier": "<string>",
"mode": "redo"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user_current_html: '<string>',
ai_original_old_html: '<string>',
ai_proposed_new_html: '<string>',
ai_explanation: '<string>',
model_tier: '<string>',
mode: 'redo'
})
};

fetch('https://api.example.com/v1/sessions/{session_id}/chunks/{chunk_id}/re-edit', 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/v1/sessions/{session_id}/chunks/{chunk_id}/re-edit",
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([
'user_current_html' => '<string>',
'ai_original_old_html' => '<string>',
'ai_proposed_new_html' => '<string>',
'ai_explanation' => '<string>',
'model_tier' => '<string>',
'mode' => 'redo'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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/v1/sessions/{session_id}/chunks/{chunk_id}/re-edit"

payload := strings.NewReader("{\n \"user_current_html\": \"<string>\",\n \"ai_original_old_html\": \"<string>\",\n \"ai_proposed_new_html\": \"<string>\",\n \"ai_explanation\": \"<string>\",\n \"model_tier\": \"<string>\",\n \"mode\": \"redo\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
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/v1/sessions/{session_id}/chunks/{chunk_id}/re-edit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_current_html\": \"<string>\",\n \"ai_original_old_html\": \"<string>\",\n \"ai_proposed_new_html\": \"<string>\",\n \"ai_explanation\": \"<string>\",\n \"model_tier\": \"<string>\",\n \"mode\": \"redo\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/sessions/{session_id}/chunks/{chunk_id}/re-edit")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_current_html\": \"<string>\",\n \"ai_original_old_html\": \"<string>\",\n \"ai_proposed_new_html\": \"<string>\",\n \"ai_explanation\": \"<string>\",\n \"model_tier\": \"<string>\",\n \"mode\": \"redo\"\n}"

response = http.request(request)
puts response.read_body
{
  "chunk_id": "<string>",
  "new_html": "<string>",
  "error": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

authorization
string | null

Path Parameters

session_id
string
required
chunk_id
string
required

Body

application/json

Re-apply the AI's intended change on the user's current section HTML, OR (mode='merge') combine the user's version and the AI's version into one.

user_current_html
string
required
ai_original_old_html
string | null
ai_proposed_new_html
string | null
ai_explanation
string | null
model_tier
string | null
mode
string | null
default:redo

Response

Successful Response

chunk_id
string
required
new_html
string | null
error
string | null