curl --request POST \
--url https://api.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"discard": false
}
'import requests
url = "https://api.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync"
payload = { "discard": False }
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({discard: false})
};
fetch('https://api.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync', 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.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync",
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([
'discard' => false
]),
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.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync"
payload := strings.NewReader("{\n \"discard\": false\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.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"discard\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync")
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 \"discard\": false\n}"
response = http.request(request)
puts response.read_body{
"sync_id": "<string>",
"state": "<string>",
"head_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"failure": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Sync Volume Endpoint
Sync one attached volume of a running VM sandbox to its committed head.
Read-only and discard syncs unmount and re-attach without publishing. A
read-write sync unmounts, publishes this sandbox’s own writes if the
unmount reports dirty blocks and waits for their merge, then
re-attaches. Poll the sync GET until state is DONE or FAILED.
curl --request POST \
--url https://api.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"discard": false
}
'import requests
url = "https://api.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync"
payload = { "discard": False }
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({discard: false})
};
fetch('https://api.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync', 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.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync",
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([
'discard' => false
]),
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.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync"
payload := strings.NewReader("{\n \"discard\": false\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.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"discard\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.primeintellect.ai/api/v1/sandbox/{sandbox_id}/volumes/{name}/sync")
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 \"discard\": false\n}"
response = http.request(request)
puts response.read_body{
"sync_id": "<string>",
"state": "<string>",
"head_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"failure": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Body
Response
Successful Response
One attachment's sync state machine row.
state is null before the first sync; head_id is the attachment's current head (the synced head once state is DONE); updated_at is the last transition time. failure says why the sync failed (BUSY, PUBLISH_FAILED, MERGE_FAILED, DEADLINE, NODE_ERROR or ROLLBACK_FAILED); it is set from the moment the sync starts rolling back and stays set when the sandbox itself leaves RUNNING mid-rollback.
Was this page helpful?