curl --request POST \
--url https://api.nugen.in/api/v3/benchmarks/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form document_id=document_01k4x9m2p7q3r5s8 \
--form 'name=Customer Support Q&A' \
--form 'description=Benchmark for customer support documentation'import requests
url = "https://api.nugen.in/api/v3/benchmarks/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"document_id": "document_01k4x9m2p7q3r5s8",
"name": "Customer Support Q&A",
"description": "Benchmark for customer support documentation"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', 'benchmark_questions.json');
form.append('document_id', 'document_01k4x9m2p7q3r5s8');
form.append('name', 'Customer Support Q&A');
form.append('description', 'Benchmark for customer support documentation');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.nugen.in/api/v3/benchmarks/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nugen.in/api/v3/benchmarks/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nCustomer Support Q&A\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for customer support documentation\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nugen.in/api/v3/benchmarks/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nCustomer Support Q&A\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for customer support documentation\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nugen.in/api/v3/benchmarks/upload")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nCustomer Support Q&A\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for customer support documentation\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nugen.in/api/v3/benchmarks/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nCustomer Support Q&A\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for customer support documentation\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"benchmark_name": "My Benchmark",
"status": "PROCESSING",
"num_questions": 10,
"questions": [
{
"question_num": 123,
"question": "<string>",
"answer": "<string>",
"image_url": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Upload Benchmark
Upload a pre-prepared benchmark file with questions and answers.
This endpoint allows you to upload a JSON file containing benchmark questions and answers, associating it with a specific document for evaluation purposes.
Request Body (multipart/form-data):
file: JSON file containing benchmark questions and answers (required)benchmark_name: Display name for the benchmark (required)document_id: Document ID that this benchmark is based on (required)description(optional): Description of the benchmark
File Format:
The uploaded JSON file should contain an array of question objects. Each question should have:
[
{
"question_num": 1,
"question": "What is...",
"answer": "The answer is..."
}
]
Returns:
benchmark_id: Unique identifier for the uploaded benchmarkbenchmark_name: Name of the benchmarkstatus: Upload status (PROCESSING,READY,FAILED)questions: List of benchmark question objects, each containing:question_num: Question numberquestion: Question textanswer: Expected answer text
num_questions: Total number of questions in the benchmark
Raises:
400: If file format is invalid, JSON structure is incorrect, or document_id is not found413: If file size exceeds limit
Example Request:
POST /api/v3/benchmarks/upload
Headers: {"Authorization": "Bearer <api_key>"}
Content-Type: multipart/form-data
Form Data:
file: benchmark_questions.json
name: "Customer Support Q&A"
document_id: "document_01k4x9m2p7q3r5s8"
description: "Benchmark for customer support documentation"
Example Response:
{
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"benchmark_name": "My Benchmark",
"status": "READY",
"questions": [
{
"question_num": 1,
"question": "How do I reset my password?",
"answer": "You can reset your password by clicking the 'Forgot Password' link on the login page."
},
{
"question_num": 2,
"question": "What are the system requirements?",
"answer": "The system requires a modern web browser with JavaScript enabled."
}
],
"num_questions": 2
}
Notes:
- File must be in valid JSON format with proper question structure
- Each question must include
question_num,question, andanswerfields - The benchmark is immediately available for use in evaluations after upload
- The
document_idprovided in the request is stored internally and will appear as a single-elementdocumentsarray (e.g.,["document_01k4x9m2p7q3r5s8"]) when retrieving the benchmark via/benchmarks/listor/benchmarks/{id}/dataendpoints
curl --request POST \
--url https://api.nugen.in/api/v3/benchmarks/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form document_id=document_01k4x9m2p7q3r5s8 \
--form 'name=Customer Support Q&A' \
--form 'description=Benchmark for customer support documentation'import requests
url = "https://api.nugen.in/api/v3/benchmarks/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"document_id": "document_01k4x9m2p7q3r5s8",
"name": "Customer Support Q&A",
"description": "Benchmark for customer support documentation"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', 'benchmark_questions.json');
form.append('document_id', 'document_01k4x9m2p7q3r5s8');
form.append('name', 'Customer Support Q&A');
form.append('description', 'Benchmark for customer support documentation');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.nugen.in/api/v3/benchmarks/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nugen.in/api/v3/benchmarks/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nCustomer Support Q&A\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for customer support documentation\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nugen.in/api/v3/benchmarks/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nCustomer Support Q&A\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for customer support documentation\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nugen.in/api/v3/benchmarks/upload")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nCustomer Support Q&A\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for customer support documentation\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nugen.in/api/v3/benchmarks/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nCustomer Support Q&A\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for customer support documentation\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"benchmark_name": "My Benchmark",
"status": "PROCESSING",
"num_questions": 10,
"questions": [
{
"question_num": 123,
"question": "<string>",
"answer": "<string>",
"image_url": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
JSON file containing benchmark questions
Document ID that this benchmark is based on
"document_01k4x9m2p7q3r5s8"
Benchmark name. Defaults to the benchmark id if omitted.
"Customer Support Q&A"
Benchmark description
"Benchmark for customer support documentation"
Response
Returns the details of the uploaded benchmark including its unique identifier, name, status, and the list of questions with expected answers
Unique identifier for the benchmark
"benchmark_01k4x9m2p7q3r6a1"
Name of the benchmark
"My Benchmark"
Status of the benchmark
PROCESSING, READY, FAILED, DEPLOYING, EVALUATING, UNDEPLOYED, EVALUATED, STOPPED, QUEUED "PROCESSING"
Number of questions in the benchmark
10
List of uploaded benchmark questions
Show child attributes
Show child attributes
Was this page helpful?