API-referentie
Een Batch aanmaken
Dien een moderatiebatch in op basis van een geldig bestand met purpose=batch.
Dien een moderatiebatch in op basis van een geldig bestand met purpose=batch.
Eindpunt
- Basis-URL
https://runapi.ai- API-versie
v1- Authenticatie
Authorization: Bearer YOUR_API_KEY
02
JSON-bodyVerzoek
Stuur waarden alleen op de vermelde verzoeklocatie.
application/json4 velden
completion_windowstring
Verplicht
Voltooiingsvenster voor deze Batch-mogelijkheid.
endpointstring
Verplicht
Moderatie-eindpunt verwerkt door deze batchcapaciteit.
input_file_idstring
Verplicht
RunAPI File ID voor een purpose=batch invoerbestand.
metadataobject
Optioneel
Optionele aanroepersmetadata die wordt geretourneerd met het batchobject.
03
HTTP 200Succesvol antwoord
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 401Foutrespons (401)
Responsschema
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"
}
Responsvoorbeeld
JSON
{
"error": {
"code": "authentication_error",
"message": "Missing API key",
"param": null,
"type": "authentication_error"
}
}
05
HTTP 400Foutrespons (400)
Responsschema
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"
}
Responsvoorbeeld
JSON
{
"error": {
"code": "invalid_request_error",
"message": "Malformed request",
"param": null,
"type": "invalid_request_error"
}
}
06
HTTP 404Foutrespons (404)
Responsschema
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"
}
Responsvoorbeeld
JSON
{
"error": {
"code": "not_found",
"message": "File not found",
"param": null,
"type": "invalid_request_error"
}
}
07
HTTP 409Foutrespons (409)
Responsschema
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"
}
Responsvoorbeeld
JSON
{
"error": {
"code": "upload_state_conflict",
"message": "Upload state conflict",
"param": null,
"type": "invalid_request_error"
}
}
08
HTTP 402Foutrespons (402)
Responsschema
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"
}
Responsvoorbeeld
JSON
{
"error": {
"code": "payment_required",
"message": "Insufficient balance",
"param": null,
"type": "insufficient_balance"
}
}
09
HTTP 422Foutrespons (422)
Responsschema
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"
}
Responsvoorbeeld
JSON
{
"error": {
"code": "invalid_upload",
"message": "Upload request rejected",
"param": null,
"type": "invalid_request_error"
}
}
10
HTTP 502Foutrespons (502)
Responsschema
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"
}
Responsvoorbeeld
JSON
{
"error": {
"code": "storage_write_failed",
"message": "File storage failed",
"param": null,
"type": "server_error"
}
}
11
cURL-voorbeeld
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"}}'