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={
"data_uuid": "string",
"inputs": [
"string"
]
}' \
--form 'task_id=<string>'import requests
url = "https://api.promptloop.com/v0.1/batches"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"batch_input_data\"\r\n\r\n{\r\n \"data_uuid\": \"string\",\r\n \"inputs\": [\r\n \"string\"\r\n ]\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
headers = {
"x-api-key": "<api-key>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, 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={
"data_uuid": "string",
"inputs": [
"string"
]
}' \
--form 'task_id=<string>'import requests
url = "https://api.promptloop.com/v0.1/batches"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"batch_input_data\"\r\n\r\n{\r\n \"data_uuid\": \"string\",\r\n \"inputs\": [\r\n \"string\"\r\n ]\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"task_id\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
headers = {
"x-api-key": "<api-key>",
"Content-Type": "multipart/form-data"
}
response = requests.post(url, data=payload, 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"
