{"openapi":"3.0.0","paths":{"/v0.1/tasks":{"get":{"operationId":"TasksController_getTasks","summary":"Get All Tasks","description":"Retrieves a list of the high-level metadata for all tasks.","parameters":[],"responses":{"200":{"description":"Successfully retrieved all tasks","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TasksResponseDto"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"tags":["Tasks"],"security":[{"x-api-key":[]}]}},"/v0.1/tasks/{id}":{"get":{"operationId":"TasksController_getTaskFromId","summary":"Get Task","description":"Retrieves detailed metadata for the task with provided id (inputs, outputs, etc.).","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully retrieved task from id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskDetailsResponseDto"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"tags":["Tasks"],"security":[{"x-api-key":[]}]},"post":{"operationId":"TasksController_runSingleJobV01","summary":"Run Single Job","description":"Runs a single job with the provided task and inputs and awaits the result. Tasks have a default timeout of 1 minute. For longer running tasks, consider using async batches instead.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskLaunchBodyDto"}}}},"responses":{"200":{"description":"Successfully ran task","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskLaunchResponseDtoV01"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"tags":["Tasks"],"security":[{"x-api-key":[]}]}},"/v0.1/batches":{"get":{"operationId":"BatchesController_getBatches","summary":"Get All Batches","description":"Retrieves a list of the high-level metadata for all batches (paginated).","parameters":[],"responses":{"200":{"description":"Successfully retrieved batches","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetBatchesResponseDto"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"tags":["Batches"],"security":[{"x-api-key":[]}]},"post":{"operationId":"BatchesController_batchLaunch","summary":"Create Batch","description":"Uploads a JSONL file and launches a new batch with the provided data. Returns the batch id.","parameters":[],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/BatchLaunchEndpointDataDto"}}}},"responses":{"201":{"description":"Batch successfully created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LaunchBatchResponseDto"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"tags":["Batches"],"security":[{"x-api-key":[]}]}},"/v0.1/batches/validate-data":{"post":{"operationId":"BatchesController_validateBatchData","summary":"Validate Batch Data","description":"Uploads a JSONL file and validates the data for a new batch with the provided data. Returns the batch id.","parameters":[],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/BatchValidateJobDataDto"}}}},"responses":{"200":{"description":"Batch data successfully validated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateBatchDataResponseDto"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"tags":["Batches"],"security":[{"x-api-key":[]}]}},"/v0.1/batches/{id}":{"get":{"operationId":"BatchesController_getBatchFromId","summary":"Get Batch","description":"Retrieves detailed metadata for the batch with provided id. This includes the batch status, job count, and other metadata.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully retrieved batch from id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetBatchDataWithStatusResponseDto"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"tags":["Batches"],"security":[{"x-api-key":[]}]},"put":{"operationId":"BatchesController_updateBatchById","summary":"Update batch metadata","description":"Updates user-defined metadata fields for the batch with provided id. This includes the webhook_url. Explicitly passing an empty string for webhook_url to the request body will remove/clear any webhook url from the batch.","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchUpdateBodyDataDto"}}}},"responses":{"200":{"description":"Successfully updated batch with provided id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetBatchDataWithStatusResponseDto"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"tags":["Batches"],"security":[{"x-api-key":[]}]}},"/v0.1/batches/{id}/results":{"get":{"operationId":"BatchesController_getBatchResultsV01","summary":"Get Results","description":"Get batch execution results once a batch reaches COMPLETED status. Receive the raw output or data to download depending on flag selection.","parameters":[{"name":"id","required":true,"in":"path","description":"Batch ID to retrieve results from","schema":{"type":"string"}},{"name":"output_type","required":false,"in":"query","description":"Output type (raw, stream, webhook) - default raw","schema":{"enum":["raw","stream","webhook"],"type":"string"}},{"name":"webhook_url","required":false,"in":"query","description":"Webhook URL to send data to (if output_type \"webhook\" is selected. If not set and webhook is selected, it will default to the existing webhook associated with the batch if one exists.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully retrieved batch results","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetResultResponseDtoV01"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseDto"}}}}},"tags":["Batches"],"security":[{"x-api-key":[]}]}}},"info":{"title":"API Documentation","description":"API description","version":"0.1","contact":{}},"tags":[],"servers":[{ "url": "https://api.promptloop.com" }],"components":{"securitySchemes":{"x-api-key":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"TaskSummaryDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"created_at":{"type":"string"},"live_version":{"type":"number"},"max_version":{"type":"number"},"run_count":{"type":"number"}},"required":["id","name","description","created_at","live_version","max_version","run_count"]},"ErrorDetailsDto":{"type":"object","properties":{"code":{"type":"number"},"details":{"type":"string"}},"required":["code","details"]},"TasksResponseDto":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"],"example":"success"},"data":{"type":"array","items":{"$ref":"#/components/schemas/TaskSummaryDto"}},"message":{"type":"string"},"error":{"$ref":"#/components/schemas/ErrorDetailsDto"}},"required":["status","data","message"]},"ErrorResponseDto":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"],"example":"error"},"data":{"type":"object"},"message":{"type":"string"},"error":{"$ref":"#/components/schemas/ErrorDetailsDto"}},"required":["status","data","message"]},"TaskInputDto":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"description":{"type":"string"}},"required":["name","type","description"]},"TaskOutputDto":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]},"TaskDetailsDto":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"created_at":{"type":"string"},"live_version":{"type":"number"},"max_version":{"type":"number"},"inputs":{"type":"array","items":{"$ref":"#/components/schemas/TaskInputDto"}},"outputs":{"type":"array","items":{"$ref":"#/components/schemas/TaskOutputDto"}},"run_count":{"type":"number"}},"required":["id","name","description","created_at","live_version","max_version","inputs","outputs","run_count"]},"TaskDetailsResponseDto":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"],"example":"success"},"data":{"$ref":"#/components/schemas/TaskDetailsDto"},"message":{"type":"string"},"error":{"$ref":"#/components/schemas/ErrorDetailsDto"}},"required":["status","data","message"]},"TaskLaunchBodyDto":{"type":"object","properties":{"inputs":{"description":"The inputs for the task","type":"array","items":{"type":"string"}},"task_version":{"type":"number","description":"The version of the task","default":0}},"required":["inputs","task_version"]},"TaskLaunchDto":{"type":"object","properties":{"data_json":{"type":"array","items":{"type":"object","additionalProperties":{"type":"string"}}},"job_id":{"type":"string"},"error_detected":{"type":"boolean"}},"required":["data_json","job_id","error_detected"]},"TaskLaunchResponseDto":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"],"example":"success"},"data":{"$ref":"#/components/schemas/TaskLaunchDto"},"message":{"type":"string"},"error":{"$ref":"#/components/schemas/ErrorDetailsDto"}},"required":["status","data","message"]},"TaskLaunchDtoV01":{"type":"object","properties":{"data_json":{"type":"object","additionalProperties":{"type":"string"},"example":{"propertyKey":"propertyValue","anotherKey":"anotherValue"},"description":"An object containing key-value string pairs"},"list_data_json":{"type":"array","items":{"type":"object","additionalProperties":{"type":"string"}},"example":[{"column1Key":"row1Value1","column2Key":"row1Value2"},{"column1Key":"row2Value1","column2Key":"row2Value2"}],"description":"Array of objects where each object represents a row with consistent column keys"},"list":{"type":"boolean","example":true,"description":"Indicates if this is a list operation"},"job_id":{"type":"string"},"error_detected":{"type":"boolean"}},"required":["data_json","list_data_json","list","job_id","error_detected"]},"TaskLaunchResponseDtoV01":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"],"example":"success"},"data":{"$ref":"#/components/schemas/TaskLaunchDtoV01"},"message":{"type":"string"},"error":{"$ref":"#/components/schemas/ErrorDetailsDto"}},"required":["status","data","message"]},"BatchDataResponseDto":{"type":"object","properties":{"batch_id":{"type":"string"},"task_id":{"type":"string"},"task_version":{"type":"string"},"batch_name":{"type":"string"},"created_at":{"format":"date-time","type":"string"},"completed":{"type":"boolean"},"cancelled":{"type":"boolean"}},"required":["batch_id","task_id","task_version","batch_name","created_at","completed","cancelled"]},"GetBatchesResponseDto":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"],"example":"success"},"data":{"type":"array","items":{"$ref":"#/components/schemas/BatchDataResponseDto"}},"message":{"type":"string"},"error":{"$ref":"#/components/schemas/ErrorDetailsDto"}},"required":["status","data","message"]},"BatchLaunchEndpointDataDto":{"type":"object","properties":{"batch_input_data":{"type":"string","format":"binary","description":"the path to a JSONL file containing objects with the format: { \"data_uuid\": string, \"inputs\": array }","example":[{"data_uuid":"string","inputs":["string"]}]},"task_id":{"type":"string"},"task_version":{"type":"number","description":"Optional - Version number of the task to be executed. Will default to latest live version.","example":1},"batch_name":{"type":"string","description":"Optional - Name for the batch job","example":"Research 001"},"webhook_url":{"type":"string","description":"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"}},"required":["batch_input_data","task_id"]},"BatchLaunchJobErrorDto":{"type":"object","properties":{"error_index":{"type":"number"},"error_message":{"type":"string"}},"required":["error_index","error_message"]},"BatchLaunchDto":{"type":"object","properties":{"batch_id":{"type":"string"},"jobs_submitted":{"type":"number"},"jobs_added":{"type":"number"},"jobs_failed_error_indexes":{"type":"array","items":{"$ref":"#/components/schemas/BatchLaunchJobErrorDto"}},"estimated_time_to_start":{"format":"date-time","type":"string"},"estimated_time_to_complete":{"format":"date-time","type":"string"}},"required":["batch_id","jobs_submitted","jobs_added"]},"LaunchBatchResponseDto":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"],"example":"success"},"data":{"type":"array","items":{"$ref":"#/components/schemas/BatchLaunchDto"}},"message":{"type":"string"},"error":{"$ref":"#/components/schemas/ErrorDetailsDto"}},"required":["status","data","message"]},"BatchValidateJobDataDto":{"type":"object","properties":{"batch_input_data":{"type":"string","format":"binary","description":"A JSONL file containing objects to validate with the format: { \"data_uuid\": string, \"inputs\": array }","example":[{"data_uuid":"string","inputs":["string"]}]},"task_id":{"type":"string"}},"required":["batch_input_data","task_id"]},"BatchLaunchDataValidationResponseDto":{"type":"object","properties":{"job_count":{"type":"number"},"job_improper_format_count":{"type":"number"},"job_improper_format":{"type":"array","items":{"$ref":"#/components/schemas/BatchLaunchJobErrorDto"}}},"required":["job_count","job_improper_format_count"]},"ValidateBatchDataResponseDto":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"],"example":"success"},"data":{"type":"array","items":{"$ref":"#/components/schemas/BatchLaunchDataValidationResponseDto"}},"message":{"type":"string"},"error":{"$ref":"#/components/schemas/ErrorDetailsDto"}},"required":["status","data","message"]},"BatchDataWithStatusResponseDto":{"type":"object","properties":{"batch_id":{"type":"string"},"task_id":{"type":"string"},"task_version":{"type":"string"},"batch_name":{"type":"string"},"created_at":{"format":"date-time","type":"string"},"completed":{"type":"boolean"},"cancelled":{"type":"boolean"},"jobs_submitted":{"type":"number"},"jobs_completed":{"type":"number"},"job_status":{"type":"string"}},"required":["batch_id","task_id","task_version","batch_name","created_at","completed","cancelled","jobs_submitted","jobs_completed","job_status"]},"GetBatchDataWithStatusResponseDto":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"],"example":"success"},"data":{"$ref":"#/components/schemas/BatchDataWithStatusResponseDto"},"message":{"type":"string"},"error":{"$ref":"#/components/schemas/ErrorDetailsDto"}},"required":["status","data","message"]},"BatchUpdateBodyDataDto":{"type":"object","properties":{"webhook_url":{"type":"string","description":"Webhook url to send data to upon batch completion. Provide an empty string to clear any existing webhook url assigned to the batch execution.","example":"https://api.example.com/updated-webhook/batch-results"}}},"RawBatchResultItemDto":{"type":"object","properties":{"data_uuid":{"type":"string"}},"required":["data_uuid"]},"RawBatchResultDto":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RawBatchResultItemDto"}}},"required":["data"]},"StreamBatchResultDto":{"type":"object","properties":{"file":{"type":"string","format":"binary"}},"required":["file"]},"GetResultResponseDto":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"],"example":"success"},"data":{"$ref":"#/components/schemas/RawBatchResultDto"},"message":{"type":"string"},"error":{"$ref":"#/components/schemas/ErrorDetailsDto"},"file":{"$ref":"#/components/schemas/StreamBatchResultDto"}},"required":["status","data","message"]},"RawBatchResultItemDtoV01":{"type":"object","properties":{"row_id":{"type":"string","example":"a427201b-2340-4f06-ad68-2da8e0fdb120","description":"Unique identifier for the row"},"user_provided_data_uuid":{"type":"string","example":"51","description":"User provided identifier"},"row_data_json":{"type":"object","additionalProperties":{"type":"string"},"example":{"website":"http://www.acmeco.com","site description":"Acme Co is...","contact email":"hello@acmeco.com","pricing page link":"Not Found"},"description":"JSON object containing the row data key-value pairs"},"row_list_data_json":{"type":"array","items":{"type":"object","additionalProperties":{"type":"string"}},"example":[{"name":"Product A","price":"$99","description":"Description for product A"},{"name":"Product B","price":"$149","description":"Description for product B"},{"name":"Product C","price":"$199","description":"Description for product C"}],"description":"Array of objects where each object represents a row with consistent column keys"},"confidence_interval":{"type":"number","example":8,"description":"Confidence score of the results"},"links_crawled":{"type":"array","items":{"type":"string"},"example":["http://www.acmeco.com","http://www.acmeco.com/about"],"description":"List of URLs that were crawled"},"list":{"type":"boolean","example":false,"description":"Indicates if this is a list operation and whether the data is in the row_data_json or row_list_data_json field"},"list_entity_count":{"type":"number","example":0,"description":"Number of entities counted by Promptloop models prior to extraction."},"error":{"type":"boolean","example":true,"description":"Indicates if an error occurred"}},"required":["row_id","user_provided_data_uuid","row_data_json","row_list_data_json","confidence_interval","links_crawled","list","list_entity_count","error"]},"RawBatchResultDtoV01":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RawBatchResultItemDtoV01"}}},"required":["data"]},"GetResultResponseDtoV01":{"type":"object","properties":{"status":{"type":"string","enum":["success","error"],"example":"success"},"data":{"$ref":"#/components/schemas/RawBatchResultDtoV01"},"message":{"type":"string"},"error":{"$ref":"#/components/schemas/ErrorDetailsDto"},"file":{"$ref":"#/components/schemas/StreamBatchResultDto"}},"required":["status","data","message"]}}}}