Create Batch
curl --request POST \
--url https://api.promptloop.com/v0.1/batches \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <api-key>' \
--form batch_input_data='@example-file' \
--form 'task_id=<string>'import requests
url = "https://api.promptloop.com/v0.1/batches"
files = { "batch_input_data": ("example-file", open("example-file", "rb")) }
payload = { "task_id": "<string>" }
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('batch_input_data', '{
"data_uuid": "string",
"inputs": [
"string"
]
}');
form.append('task_id', '<string>');
const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
options.body = form;
fetch('https://api.promptloop.com/v0.1/batches', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"status": "success",
"data": {
"batch_id": "<string>",
"jobs_submitted": 123,
"jobs_added": 123,
"jobs_failed_error_indexes": [
{
"error_index": 123,
"error_message": "<string>"
}
],
"estimated_time_to_start": "2023-11-07T05:31:56Z",
"estimated_time_to_complete": "2023-11-07T05:31:56Z",
"webhook_url": "<string>"
},
"message": "<string>",
"error": {
"code": 123,
"details": "<string>"
},
"request_id": "<string>"
}{
"status": "error",
"data": {},
"message": "<string>",
"error": {
"code": 123,
"details": "<string>"
},
"request_id": "<string>"
}{
"status": "error",
"data": {},
"message": "<string>",
"error": {
"code": 123,
"details": "<string>"
},
"request_id": "<string>"
}{
"status": "error",
"data": {},
"message": "<string>",
"error": {
"code": 123,
"details": "<string>"
},
"request_id": "<string>"
}Batches
Create Batch
Uploads a JSONL file and launches a new batch with the provided data. Returns the batch id.
POST
/
v0.1
/
batches
Create Batch
curl --request POST \
--url https://api.promptloop.com/v0.1/batches \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <api-key>' \
--form batch_input_data='@example-file' \
--form 'task_id=<string>'import requests
url = "https://api.promptloop.com/v0.1/batches"
files = { "batch_input_data": ("example-file", open("example-file", "rb")) }
payload = { "task_id": "<string>" }
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('batch_input_data', '{
"data_uuid": "string",
"inputs": [
"string"
]
}');
form.append('task_id', '<string>');
const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
options.body = form;
fetch('https://api.promptloop.com/v0.1/batches', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"status": "success",
"data": {
"batch_id": "<string>",
"jobs_submitted": 123,
"jobs_added": 123,
"jobs_failed_error_indexes": [
{
"error_index": 123,
"error_message": "<string>"
}
],
"estimated_time_to_start": "2023-11-07T05:31:56Z",
"estimated_time_to_complete": "2023-11-07T05:31:56Z",
"webhook_url": "<string>"
},
"message": "<string>",
"error": {
"code": 123,
"details": "<string>"
},
"request_id": "<string>"
}{
"status": "error",
"data": {},
"message": "<string>",
"error": {
"code": 123,
"details": "<string>"
},
"request_id": "<string>"
}{
"status": "error",
"data": {},
"message": "<string>",
"error": {
"code": 123,
"details": "<string>"
},
"request_id": "<string>"
}{
"status": "error",
"data": {},
"message": "<string>",
"error": {
"code": 123,
"details": "<string>"
},
"request_id": "<string>"
}Authorizations
Body
multipart/form-data
the path to a JSONL file containing objects with the format: { "data_uuid": string, "inputs": array }
Optional - Version number of the task to be executed. Will default to latest live version.
Example:
1
Optional - Name for the batch job
Example:
"Research 001"
Optional - Webhook URL to receive results and success status on completion. Data will be sent as a POST request with the data under body.data as an array of objects.
Example:
"https://api.example.com/webhook/batch-results"
