v3
latestOpenAPI 3.1.02026-07-311,4541,5202.3 MBBulk Create Dataset Logs
Bulk create dataset logs from array of unified format data
Endpoint: POST /api/datasets/{dataset_id}/logs/bulk/
Args (POST body): - logs (array, required): List of log objects in unified format Each log object contains: - input (any): The input data (required) - can be any type (dict, list, string, etc.) - output (any, optional): The output data - can be any type - metadata (object, optional): Additional metadata fields (model, log_type, etc.) - metrics (object, optional): Metric fields (tokens, cost, latency, etc.)
Example Request (Recommended - Top-level expected_output): json { "logs": [ { "input": "What is your return policy?", "expected_output": "You can return within 30 days", "metadata": {"category": "support"} }, { "input": "How do I reset my password?", "expected_output": "Click Forgot Password on login page", "metadata": {"category": "support"} } ] }
Example Request (Legacy - Nested expected_output, auto-extracted): Frontend parses CSV where expected_output is nested in input: json { "logs": [ { "input": { "user_query": "What is your return policy?", "expected_output": "You can return within 30 days", "category": "support" } } ] } Note: Nested expected_output is automatically extracted to top-level field.
Example Request (Direct API usage with expected_output): json { "logs": [ { "input": "What is AI?", "expected_output": "AI is artificial intelligence", "output": "", "metadata": {"category": "qa", "model": "gpt-4"} }, { "input": [{"role": "user", "content": "Hello"}], "expected_output": "A friendly greeting", "output": {"role": "assistant", "content": "Hi there!"}, "metrics": {"tokens": 10, "cost": 0.0001} } ] }
Field Descriptions: - input: The input to be processed (can be string, dict, or array) - expected_output: Expected/ground truth output for evaluation (optional) - output: Actual output from LLM or system (populated during experiments) - metadata: Additional context fields - metrics: Performance metrics (tokens, cost, latency)
Returns (POST 201): json { "success_count": 95, "error_count": 5, "errors": [ {"index": 3, "error": "Invalid input format"}, {"index": 7, "error": "Missing required field"} ] }
Notes: - For UI users: Frontend parses CSV and sends array in unified format - For API users: Send JSON array directly, no CSV conversion needed - Each row of CSV becomes an "input" object in the dataset log - Plan limits are enforced (current dataset log count + new logs <= limit) - Errors are returned for individual logs that fail, successful ones are still created
Path parameters
Headers
Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.