Datasets
Create dataset
POST
/
api
/
datasets
/
Create dataset
curl --request POST \
--url https://api.keywordsai.co/api/datasets/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"sampling": 123,
"start_time": "<string>",
"end_time": "<string>",
"is_empty": true,
"initial_log_filters": {}
}
'import requests
url = "https://api.keywordsai.co/api/datasets/"
payload = {
"name": "<string>",
"description": "<string>",
"sampling": 123,
"start_time": "<string>",
"end_time": "<string>",
"is_empty": True,
"initial_log_filters": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
sampling: 123,
start_time: '<string>',
end_time: '<string>',
is_empty: true,
initial_log_filters: {}
})
};
fetch('https://api.keywordsai.co/api/datasets/', 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.keywordsai.co/api/datasets/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'sampling' => 123,
'start_time' => '<string>',
'end_time' => '<string>',
'is_empty' => true,
'initial_log_filters' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.keywordsai.co/api/datasets/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"sampling\": 123,\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\",\n \"is_empty\": true,\n \"initial_log_filters\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.keywordsai.co/api/datasets/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"sampling\": 123,\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\",\n \"is_empty\": true,\n \"initial_log_filters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.keywordsai.co/api/datasets/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"sampling\": 123,\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\",\n \"is_empty\": true,\n \"initial_log_filters\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "6d0b2c7e-3a6a-4c09-9c7e-1f2d9e2d3f0a",
"name": "Support Conversations - July",
"description": "Sampled support chats for July",
"type": "sampling",
"status": "ready",
"log_count": 250,
"created_at": "2025-07-26T00:00:00Z"
}
{
"id": "6d0b2c7e-3a6a-4c09-9c7e-1f2d9e2d3f0a",
"name": "Custom Workflow Logs",
"description": "Manually curated logs for workflow analysis",
"type": "sampling",
"status": "ready",
"log_count": 0,
"created_at": "2025-12-09T10:00:00Z"
}
Creates a new dataset, either populated with existing logs or empty for manual population. You can specify filters and sampling rate to select which logs to include, or create an empty dataset to add logs manually later.
Authentication
All endpoints require API key authentication:Authorization: Bearer YOUR_API_KEY
Parameters
string
required
The name of the dataset.
string
A description of the dataset.
integer
default:"100"
Percentage of logs to include (0-100).
string
ISO 8601 timestamp for log filtering. Required when
is_empty is false or not provided. Ignored when is_empty is true.string
ISO 8601 timestamp for log filtering. Required when
is_empty is false or not provided. Ignored when is_empty is true.boolean
default:"false"
Create empty dataset. When
true, start_time and end_time are ignored.object
Filters to apply to select logs for the dataset.
Example
Example
{
"id": {
"operator": "in",
"value": ["log_id_1", "log_id_2"]
}
}
Request Examples
import requests
import json
url = "https://api.keywordsai.co/api/datasets/"
payload = json.dumps({
"name": "Support Conversations - July",
"description": "Sampled support chats for July",
"sampling": 40,
"start_time": "2025-07-01T00:00:00Z",
"end_time": "2025-07-31T23:59:59Z",
"initial_log_filters": {
"status_code": {
"operator": "eq",
"value": 200
}
}
})
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
import requests
import json
url = "https://api.keywordsai.co/api/datasets/"
payload = json.dumps({
"name": "Custom Workflow Logs",
"description": "Manually curated logs for workflow analysis",
"is_empty": true
})
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Response
{
"id": "6d0b2c7e-3a6a-4c09-9c7e-1f2d9e2d3f0a",
"name": "Support Conversations - July",
"description": "Sampled support chats for July",
"type": "sampling",
"status": "ready",
"log_count": 250,
"created_at": "2025-07-26T00:00:00Z"
}
{
"id": "6d0b2c7e-3a6a-4c09-9c7e-1f2d9e2d3f0a",
"name": "Custom Workflow Logs",
"description": "Manually curated logs for workflow analysis",
"type": "sampling",
"status": "ready",
"log_count": 0,
"created_at": "2025-12-09T10:00:00Z"
}
Was this page helpful?
⌘I
Create dataset
curl --request POST \
--url https://api.keywordsai.co/api/datasets/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"sampling": 123,
"start_time": "<string>",
"end_time": "<string>",
"is_empty": true,
"initial_log_filters": {}
}
'import requests
url = "https://api.keywordsai.co/api/datasets/"
payload = {
"name": "<string>",
"description": "<string>",
"sampling": 123,
"start_time": "<string>",
"end_time": "<string>",
"is_empty": True,
"initial_log_filters": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
sampling: 123,
start_time: '<string>',
end_time: '<string>',
is_empty: true,
initial_log_filters: {}
})
};
fetch('https://api.keywordsai.co/api/datasets/', 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.keywordsai.co/api/datasets/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'sampling' => 123,
'start_time' => '<string>',
'end_time' => '<string>',
'is_empty' => true,
'initial_log_filters' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.keywordsai.co/api/datasets/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"sampling\": 123,\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\",\n \"is_empty\": true,\n \"initial_log_filters\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.keywordsai.co/api/datasets/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"sampling\": 123,\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\",\n \"is_empty\": true,\n \"initial_log_filters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.keywordsai.co/api/datasets/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"sampling\": 123,\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\",\n \"is_empty\": true,\n \"initial_log_filters\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "6d0b2c7e-3a6a-4c09-9c7e-1f2d9e2d3f0a",
"name": "Support Conversations - July",
"description": "Sampled support chats for July",
"type": "sampling",
"status": "ready",
"log_count": 250,
"created_at": "2025-07-26T00:00:00Z"
}
{
"id": "6d0b2c7e-3a6a-4c09-9c7e-1f2d9e2d3f0a",
"name": "Custom Workflow Logs",
"description": "Manually curated logs for workflow analysis",
"type": "sampling",
"status": "ready",
"log_count": 0,
"created_at": "2025-12-09T10:00:00Z"
}