cURL
curl -X POST https://api.liquid.ai/openai/v1/batches/batch_abc123/cancel \
-H "Authorization: Bearer $LIQUID_API_KEY"import requests
url = "https://api.liquid.ai/openai/v1/batches/{id}/cancel"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.liquid.ai/openai/v1/batches/{id}/cancel', 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.liquid.ai/openai/v1/batches/{id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.liquid.ai/openai/v1/batches/{id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.liquid.ai/openai/v1/batches/{id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.liquid.ai/openai/v1/batches/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "batch_abc123",
"object": "batch",
"endpoint": "/v1/chat/completions",
"input_file_id": "file_abc123",
"completion_window": "24h",
"status": "cancelling",
"created_at": 1730419200,
"expires_at": 1730505600,
"request_counts": {
"total": 100,
"completed": 42,
"failed": 0
}
}Batches
Cancel batch
Cancel a running batch. Requests that already finished are still returned.
POST
/
openai
/
v1
/
batches
/
{id}
/
cancel
cURL
curl -X POST https://api.liquid.ai/openai/v1/batches/batch_abc123/cancel \
-H "Authorization: Bearer $LIQUID_API_KEY"import requests
url = "https://api.liquid.ai/openai/v1/batches/{id}/cancel"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.liquid.ai/openai/v1/batches/{id}/cancel', 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.liquid.ai/openai/v1/batches/{id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.liquid.ai/openai/v1/batches/{id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.liquid.ai/openai/v1/batches/{id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.liquid.ai/openai/v1/batches/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "batch_abc123",
"object": "batch",
"endpoint": "/v1/chat/completions",
"input_file_id": "file_abc123",
"completion_window": "24h",
"status": "cancelling",
"created_at": 1730419200,
"expires_at": 1730505600,
"request_counts": {
"total": 100,
"completed": 42,
"failed": 0
}
}Authorizations
Path Parameters
The batch id.
Example:
"batch_abc123"
Response
200 - application/json
Successful response.
The batch id.
Always "batch".
The endpoint each request targets.
The uploaded input file id.
Result file id, once completed.
Error file id, if any requests failed.
One of validating, in_progress, finalizing, completed, failed, expired, cancelling, cancelled.
The requested completion window.
Live counts: { total, completed, failed }.
Unix timestamp (seconds) of creation.
Present when the input failed validation: { object: "list", data: [...] }.
Any metadata supplied at creation.
Was this page helpful?