Experiments
Create a experiment
Create a new experiment
POST
/
v4
/
experiments
Create a experiment
curl --request POST \
--url https://gentrace.ai/api/v4/experiments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"pipelineId": "123e4567-e89b-12d3-a456-426614174000",
"name": "OpenAI o3-mini prompt",
"metadata": {
"promptTemplate": {
"type": "string",
"value": "Hello, {{ name }}!"
}
}
}
'import requests
url = "https://gentrace.ai/api/v4/experiments"
payload = {
"pipelineId": "123e4567-e89b-12d3-a456-426614174000",
"name": "OpenAI o3-mini prompt",
"metadata": { "promptTemplate": {
"type": "string",
"value": "Hello, {{ name }}!"
} }
}
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({
pipelineId: '123e4567-e89b-12d3-a456-426614174000',
name: 'OpenAI o3-mini prompt',
metadata: {promptTemplate: {type: 'string', value: 'Hello, {{ name }}!'}}
})
};
fetch('https://gentrace.ai/api/v4/experiments', 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://gentrace.ai/api/v4/experiments",
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([
'pipelineId' => '123e4567-e89b-12d3-a456-426614174000',
'name' => 'OpenAI o3-mini prompt',
'metadata' => [
'promptTemplate' => [
'type' => 'string',
'value' => 'Hello, {{ name }}!'
]
]
]),
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://gentrace.ai/api/v4/experiments"
payload := strings.NewReader("{\n \"pipelineId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"name\": \"OpenAI o3-mini prompt\",\n \"metadata\": {\n \"promptTemplate\": {\n \"type\": \"string\",\n \"value\": \"Hello, {{ name }}!\"\n }\n }\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://gentrace.ai/api/v4/experiments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"pipelineId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"name\": \"OpenAI o3-mini prompt\",\n \"metadata\": {\n \"promptTemplate\": {\n \"type\": \"string\",\n \"value\": \"Hello, {{ name }}!\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gentrace.ai/api/v4/experiments")
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 \"pipelineId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"name\": \"OpenAI o3-mini prompt\",\n \"metadata\": {\n \"promptTemplate\": {\n \"type\": \"string\",\n \"value\": \"Hello, {{ name }}!\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"createdAt": "2025-04-01T00:00:00.000Z",
"updatedAt": "2025-04-01T00:00:00.000Z",
"name": "OpenAI o3-mini prompt",
"pipelineId": "123e4567-e89b-12d3-a456-426614174000",
"metadata": {
"key": "value"
}
}{
"message": "Invalid parameters: 'name' field is required"
}{
"message": "Invalid or expired API key"
}{
"message": "Resource with ID '123e4567-e89b-12d3-a456-426614174000' not found"
}{
"message": "Internal server error occurred while processing the request"
}Authorizations
Enter Gentrace API key (Format: Authorization: Bearer )
Body
application/json
Creates a new experiment with the given pipeline ID
The ID of the pipeline to create the experiment for
Example:
"123e4567-e89b-12d3-a456-426614174000"
Friendly experiment name
Example:
"OpenAI o3-mini prompt"
Optional metadata for the experiment
Example:
{ "promptTemplate": { "type": "string", "value": "Hello, {{ name }}!" } }
Response
Successful response
Experiment UUID
Example:
"123e4567-e89b-12d3-a456-426614174000"
Creation timestamp (ISO 8601)
Example:
"2025-04-01T00:00:00.000Z"
Last update timestamp (ISO 8601)
Example:
"2025-04-01T00:00:00.000Z"
Friendly experiment name
Example:
"OpenAI o3-mini prompt"
Pipeline UUID
Example:
"123e4567-e89b-12d3-a456-426614174000"
Metadata
Example:
{ "key": "value" }
⌘I
Create a experiment
curl --request POST \
--url https://gentrace.ai/api/v4/experiments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"pipelineId": "123e4567-e89b-12d3-a456-426614174000",
"name": "OpenAI o3-mini prompt",
"metadata": {
"promptTemplate": {
"type": "string",
"value": "Hello, {{ name }}!"
}
}
}
'import requests
url = "https://gentrace.ai/api/v4/experiments"
payload = {
"pipelineId": "123e4567-e89b-12d3-a456-426614174000",
"name": "OpenAI o3-mini prompt",
"metadata": { "promptTemplate": {
"type": "string",
"value": "Hello, {{ name }}!"
} }
}
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({
pipelineId: '123e4567-e89b-12d3-a456-426614174000',
name: 'OpenAI o3-mini prompt',
metadata: {promptTemplate: {type: 'string', value: 'Hello, {{ name }}!'}}
})
};
fetch('https://gentrace.ai/api/v4/experiments', 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://gentrace.ai/api/v4/experiments",
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([
'pipelineId' => '123e4567-e89b-12d3-a456-426614174000',
'name' => 'OpenAI o3-mini prompt',
'metadata' => [
'promptTemplate' => [
'type' => 'string',
'value' => 'Hello, {{ name }}!'
]
]
]),
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://gentrace.ai/api/v4/experiments"
payload := strings.NewReader("{\n \"pipelineId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"name\": \"OpenAI o3-mini prompt\",\n \"metadata\": {\n \"promptTemplate\": {\n \"type\": \"string\",\n \"value\": \"Hello, {{ name }}!\"\n }\n }\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://gentrace.ai/api/v4/experiments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"pipelineId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"name\": \"OpenAI o3-mini prompt\",\n \"metadata\": {\n \"promptTemplate\": {\n \"type\": \"string\",\n \"value\": \"Hello, {{ name }}!\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gentrace.ai/api/v4/experiments")
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 \"pipelineId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"name\": \"OpenAI o3-mini prompt\",\n \"metadata\": {\n \"promptTemplate\": {\n \"type\": \"string\",\n \"value\": \"Hello, {{ name }}!\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"createdAt": "2025-04-01T00:00:00.000Z",
"updatedAt": "2025-04-01T00:00:00.000Z",
"name": "OpenAI o3-mini prompt",
"pipelineId": "123e4567-e89b-12d3-a456-426614174000",
"metadata": {
"key": "value"
}
}{
"message": "Invalid parameters: 'name' field is required"
}{
"message": "Invalid or expired API key"
}{
"message": "Resource with ID '123e4567-e89b-12d3-a456-426614174000' not found"
}{
"message": "Internal server error occurred while processing the request"
}