Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform
Hi 邱凌东
I just tested below batch translation code in West US 2 region and getting 202 response code instead.
Could you test in West US 2 with below code and let us know your observation.
import requests
import json
# ========= CONFIG =========
TRANSLATOR_KEY = "<apikey>"
TRANSLATOR_ENDPOINT = "https://<translation>.cognitiveservices.azure.com"
API_VERSION = "2025-12-01-preview"
# ✅ SINGLE FILE (not container)
SOURCE_FILE_URL = <SAS URL of file with READ, write, create permission>
TARGET_CONTAINER_URL = <SAS Url of target container Read, write, create>
SOURCE_LANGUAGE = "zh-Hans"
TARGET_LANGUAGE = "ko"
# ========= REQUEST =========
url = f"{TRANSLATOR_ENDPOINT}/translator/document/batches?api-version={API_VERSION}"
headers = {
"Ocp-Apim-Subscription-Key": TRANSLATOR_KEY,
"Content-Type": "application/json"
}
payload = {
"inputs": [
{
"storageType": "File", # ✅ REQUIRED for single file
"source": {
"sourceUrl": SOURCE_FILE_URL,
"language": SOURCE_LANGUAGE,
},
"targets": [
{
"targetUrl": TARGET_CONTAINER_URL,
"language": TARGET_LANGUAGE,
}
]
}
]
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
# ========= RESPONSE =========
print("Status Code:", response.status_code)
if response.status_code == 202:
print("Batch submitted successfully.")
print("Operation-Location:", response.headers.get("Operation-Location"))
else:
print("Error:")
print(response.text)
Thank you.