Delete a batch
curl --request DELETE \
--url https://openrouter.ai/api/v1/batches/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://openrouter.ai/api/v1/batches/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://openrouter.ai/api/v1/batches/{id}', 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://openrouter.ai/api/v1/batches/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
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://openrouter.ai/api/v1/batches/{id}"
req, _ := http.NewRequest("DELETE", 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.delete("https://openrouter.ai/api/v1/batches/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/batches/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"deletion": {
"openrouter": "deleted",
"upstream": {
"provider": "OpenAI",
"status": "unsupported"
}
},
"id": "batch_abc123",
"object": "batch"
}{
"error": {
"code": 401,
"message": "No auth credentials found."
}
}{
"error": {
"code": 404,
"message": "Batch not found."
}
}{
"error": {
"code": 409,
"message": "Only completed, failed, expired, or cancelled batches can be deleted. Wait for the batch to finish and try again."
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded."
}
}{
"error": {
"code": 500,
"message": "Internal server error."
}
}{
"error": {
"code": 502,
"message": "Upstream batch-api is unavailable."
}
}Batch
Delete a batch
Deletes a batch in a terminal status (completed, failed, expired, or cancelled) and its stored requests and results. Batches still in progress return 409. Billing and usage records are kept. See the Batch API Quickstart.
DELETE
/
batches
/
{id}
Delete a batch
curl --request DELETE \
--url https://openrouter.ai/api/v1/batches/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://openrouter.ai/api/v1/batches/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://openrouter.ai/api/v1/batches/{id}', 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://openrouter.ai/api/v1/batches/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
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://openrouter.ai/api/v1/batches/{id}"
req, _ := http.NewRequest("DELETE", 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.delete("https://openrouter.ai/api/v1/batches/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openrouter.ai/api/v1/batches/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"deletion": {
"openrouter": "deleted",
"upstream": {
"provider": "OpenAI",
"status": "unsupported"
}
},
"id": "batch_abc123",
"object": "batch"
}{
"error": {
"code": 401,
"message": "No auth credentials found."
}
}{
"error": {
"code": 404,
"message": "Batch not found."
}
}{
"error": {
"code": 409,
"message": "Only completed, failed, expired, or cancelled batches can be deleted. Wait for the batch to finish and try again."
}
}{
"error": {
"code": 429,
"message": "Rate limit exceeded."
}
}{
"error": {
"code": 500,
"message": "Internal server error."
}
}{
"error": {
"code": 502,
"message": "Upstream batch-api is unavailable."
}
}Authorizations
API key as bearer token in Authorization header
Path Parameters
The batch job id returned from submit.
Minimum string length:
1Example:
"batch_abc123"
Response
The batch was deleted; per-target outcomes are reported under deletion.
Confirms a terminal batch was removed from the API and its OpenRouter-held artifacts purged. Deletion is not cancellation and does not erase billing or audit records.
OpenRouter cleanup and, when a provider was assigned, the upstream batch deletion outcome.
Show child attributes
Show child attributes
Example:
{
"openrouter": "deleted",
"upstream": {
"provider": "Anthropic",
"status": "deleted"
}
}
Example:
"batch_abc123"
Available options:
batch