APIリファレンス
バッチを作成する
有効なpurpose=batch FileによってバックアップされたModerationバッチを送信します。
有効なpurpose=batch FileによってバックアップされたModerationバッチを送信します。
エンドポイント
- ベースURL
https://runapi.ai- API バージョン
v1- 認証
Authorization: Bearer YOUR_API_KEY
02
JSONボディリクエスト
指定されたリクエストの場所にのみ値を送信してください。
application/jsonフィールド4件
completion_windowstring
必須
このバッチ機能の完了ウィンドウ。
endpointstring
必須
このバッチ機能で処理されるモデレーションエンドポイント。
input_file_idstring
必須
purpose=batch入力ファイルのRunAPIファイルID。
metadataobject
任意
バッチオブジェクトとともに返されるオプションの呼び出し元メタデータ。
03
HTTP 200成功レスポンス
POST /v1/batches
JSON
{
"completion_window": "24h",
"created_at": 1785196800,
"endpoint": "/v1/moderations",
"id": "batch_abc123",
"input_file_id": "file_batch123",
"metadata": {
"customer_tag": "demo"
},
"object": "batch",
"request_counts": {
"completed": 0,
"failed": 0,
"total": 3
},
"status": "validating"
}
04
HTTP 401エラーレスポンス (401)
レスポンススキーマ
JSON
{
"additionalProperties": true,
"properties": {
"error": {
"additionalProperties": true,
"properties": {
"code": {
"type": [
"string",
"null"
]
},
"message": {
"type": "string"
},
"param": {
"type": [
"string",
"null"
]
},
"type": {
"type": "string"
}
},
"required": [
"message",
"type"
],
"type": "object"
}
},
"required": [
"error"
],
"type": "object"
}
レスポンス例
JSON
{
"error": {
"code": "authentication_error",
"message": "Missing API key",
"param": null,
"type": "authentication_error"
}
}
05
HTTP 400エラーレスポンス (400)
レスポンススキーマ
JSON
{
"additionalProperties": true,
"properties": {
"error": {
"additionalProperties": true,
"properties": {
"code": {
"type": [
"string",
"null"
]
},
"message": {
"type": "string"
},
"param": {
"type": [
"string",
"null"
]
},
"type": {
"type": "string"
}
},
"required": [
"message",
"type"
],
"type": "object"
}
},
"required": [
"error"
],
"type": "object"
}
レスポンス例
JSON
{
"error": {
"code": "invalid_request_error",
"message": "Malformed request",
"param": null,
"type": "invalid_request_error"
}
}
06
HTTP 404エラーレスポンス (404)
レスポンススキーマ
JSON
{
"additionalProperties": true,
"properties": {
"error": {
"additionalProperties": true,
"properties": {
"code": {
"type": [
"string",
"null"
]
},
"message": {
"type": "string"
},
"param": {
"type": [
"string",
"null"
]
},
"type": {
"type": "string"
}
},
"required": [
"message",
"type"
],
"type": "object"
}
},
"required": [
"error"
],
"type": "object"
}
レスポンス例
JSON
{
"error": {
"code": "not_found",
"message": "File not found",
"param": null,
"type": "invalid_request_error"
}
}
07
HTTP 409エラーレスポンス (409)
レスポンススキーマ
JSON
{
"additionalProperties": true,
"properties": {
"error": {
"additionalProperties": true,
"properties": {
"code": {
"type": [
"string",
"null"
]
},
"message": {
"type": "string"
},
"param": {
"type": [
"string",
"null"
]
},
"type": {
"type": "string"
}
},
"required": [
"message",
"type"
],
"type": "object"
}
},
"required": [
"error"
],
"type": "object"
}
レスポンス例
JSON
{
"error": {
"code": "upload_state_conflict",
"message": "Upload state conflict",
"param": null,
"type": "invalid_request_error"
}
}
08
HTTP 402エラーレスポンス (402)
レスポンススキーマ
JSON
{
"additionalProperties": true,
"properties": {
"error": {
"additionalProperties": true,
"properties": {
"code": {
"type": [
"string",
"null"
]
},
"message": {
"type": "string"
},
"param": {
"type": [
"string",
"null"
]
},
"type": {
"type": "string"
}
},
"required": [
"message",
"type"
],
"type": "object"
}
},
"required": [
"error"
],
"type": "object"
}
レスポンス例
JSON
{
"error": {
"code": "payment_required",
"message": "Insufficient balance",
"param": null,
"type": "insufficient_balance"
}
}
09
HTTP 422エラーレスポンス (422)
レスポンススキーマ
JSON
{
"additionalProperties": true,
"properties": {
"error": {
"additionalProperties": true,
"properties": {
"code": {
"type": [
"string",
"null"
]
},
"message": {
"type": "string"
},
"param": {
"type": [
"string",
"null"
]
},
"type": {
"type": "string"
}
},
"required": [
"message",
"type"
],
"type": "object"
}
},
"required": [
"error"
],
"type": "object"
}
レスポンス例
JSON
{
"error": {
"code": "invalid_upload",
"message": "Upload request rejected",
"param": null,
"type": "invalid_request_error"
}
}
10
HTTP 502エラーレスポンス (502)
レスポンススキーマ
JSON
{
"additionalProperties": true,
"properties": {
"error": {
"additionalProperties": true,
"properties": {
"code": {
"type": [
"string",
"null"
]
},
"message": {
"type": "string"
},
"param": {
"type": [
"string",
"null"
]
},
"type": {
"type": "string"
}
},
"required": [
"message",
"type"
],
"type": "object"
}
},
"required": [
"error"
],
"type": "object"
}
レスポンス例
JSON
{
"error": {
"code": "storage_write_failed",
"message": "File storage failed",
"param": null,
"type": "server_error"
}
}
11
cURLの例
CURL
curl -X POST https://runapi.ai/v1/batches \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"input_file_id":"file_batch123","endpoint":"/v1/moderations","completion_window":"24h","metadata":{"customer_tag":"demo"}}'