I am using the same BATCH_NAME to query/delete/cancel. Querying works normally, but deleting/cancelling results in a 400 error.
echo $BATCH_NAME
batches/01fzn77cxwy1xyrq9zvr8uthc2flk8dt55j7
curl https://generativelanguage.googleapis.com/v1beta/$BATCH_NAME \
-H "x-goog-api-key: $GEMINI_API_KEY"
{
"name": "batches/01fzn77cxwy1xyrq9zvr8uthc2flk8dt55j7",
"metadata": {
"@type": "type.googleapis.com/google.ai.generativelanguage.v1main.GenerateContentBatch",
"model": "models/gemini-2.5-flash",
"displayName": "my-batch-requests",
"createTime": "2025-08-13T06:52:44.322831654Z",
"updateTime": "2025-08-13T06:52:44.322831654Z",
"batchStats": {
"requestCount": "2",
"pendingRequestCount": "2"
},
"state": "BATCH_STATE_PENDING",
"name": "batches/01fzn77cxwy1xyrq9zvr8uthc2flk8dt55j7"
}
}
curl https://generativelanguage.googleapis.com/v1beta/$BATCH_NAME:cancel \
-H "x-goog-api-key: $GEMINI_API_KEY"
{
"error": {
"code": 400,
"message": "Could not parse the batch name",
"status": "INVALID_ARGUMENT"
}
}
curl https://generativelanguage.googleapis.com/v1beta/$BATCH_NAME:delete \
-H "x-goog-api-key: $GEMINI_API_KEY"
{
"error": {
"code": 400,
"message": "Could not parse the batch name",
"status": "INVALID_ARGUMENT"
}
}