Skip to main content
Batches

获取错误文件

GET /api/v1/forward/batches/{batch_id}/error 获取 Batch error.jsonl 的签名下载链接。Batch 必须处于终态。没有符合条件的最终失败任务时不生成 error.jsonl,本接口返回 404 error_file_not_found

请求头

Header是否必填说明
AuthorizationBearer <PAT>

路径参数

参数类型是否必填说明
batch_idstringBatch ID。

示例请求

curl -s -X GET 'https://api.qoder.com.cn/api/v1/forward/batches/batch_failed001/error' \
  -H "Authorization: Bearer $QODER_ACCESS_TOKEN"

示例响应

HTTP 200 OK
{
  "url": "https://cloud-agents-storage.oss-cn-beijing.aliyuncs.com/files%2F<user_id>%2F<file_id>%2Fcontent?Expires=1783685162&OSSAccessKeyId=<ak>&Signature=<sig>&response-content-disposition=attachment%3B%20filename%3Dbatch-batch_failed001-error.jsonl",
  "expires_at": "2026-07-10T12:06:02Z"
}

下载文件

error_url="$(
  curl -fsS \
    "${FORWARD_BASE_URL}/api/v1/forward/batches/${BATCH_ID}/error" \
    -H "Authorization: Bearer ${QODER_ACCESS_TOKEN}" \
  | jq -er '.url'
)"

curl -fL \
  --output "batch-${BATCH_ID}-error.jsonl" \
  "${error_url}"
unset error_url
签名 URL 包含临时访问凭据,不要打印、记录或提交该 URL,也不要在启用 set -x 时执行上述命令。 Batch 生成的 output_file_id / error_file_id 是内部结果文件标识,不登记为 Forward 通用文件资源,因此不能通过 /api/v1/forward/files/{file_id}/content 获取。

错误码

HTTPTypeCode触发条件
400invalid_request_errorbatch_not_readyBatch 未处于终态。
404not_found_errorbatch_not_foundBatch 不存在或跨用户访问。
404not_found_errorerror_file_not_foundBatch 未生成 error.jsonl
410not_found_errorfile_expired错误文件超过 30 天保留期已被清理。
401authentication_errorauthentication_requiredPAT 无效或已过期。

相关