Skip to content
PUT/api/v1/prompts/experiments

Update a prompt experiment (run / complete / cancel / set-splits)

Transitions an experiment's status or sets its traffic splits. trafficSplits is required when action=set-splits. Cross-tenant guarded via the experiment owner's org.

Authentication

Send Authorization: Bearer YOUR_API_KEY on every request. Generate API keys at /dashboard/api-keys.

Request body required

Example

{
  "experimentId": "00000000-0000-0000-0000-000000000000",
  "action": "run"
}
Schema
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "experimentId": {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        "action": {
          "type": "string",
          "enum": [
            "run",
            "complete",
            "cancel",
            "set-splits"
          ]
        },
        "trafficSplits": {
          "description": "Required when action=set-splits."
        }
      },
      "required": [
        "experimentId",
        "action"
      ],
      "additionalProperties": false
    }
  }
}

Response

200 example

{
  "success": true
}

All status codes

200Updated experiment.
400(no description)
401(no description)
404Experiment not found.
429(no description)

Code samples

cURL

curl -X PUT \
  https://evalguard.ai/api/v1/prompts/experiments \
  -H "Authorization: Bearer $EVALGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "experimentId": "00000000-0000-0000-0000-000000000000", "action": "run" }'

TypeScript

import { EvalGuard } from "@evalguard/sdk";

const client = new EvalGuard({ apiKey: process.env.EVALGUARD_API_KEY });

const response = await client.request({
  method: "PUT",
  path: "/api/v1/prompts/experiments",
  body: {
    "experimentId": "00000000-0000-0000-0000-000000000000",
    "action": "run"
  },
});
console.log(response);

Python

from evalguard import EvalGuard
import os

client = EvalGuard(api_key=os.environ["EVALGUARD_API_KEY"])

response = client.request(
    method="PUT",
    path="/api/v1/prompts/experiments",
    body={
    "experimentId": "00000000-0000-0000-0000-000000000000",
    "action": "run"
},
)
print(response)

Go

package main

import (
	"context"
	"fmt"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{"experimentId":"00000000-0000-0000-0000-000000000000","action":"run"}`)
	req, _ := http.NewRequestWithContext(context.Background(), "PUT", "https://evalguard.ai/api/v1/prompts/experiments", body)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("EVALGUARD_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil { panic(err) }
	defer resp.Body.Close()
	fmt.Println(resp.Status)
}

Errors

400401404429

Other Prompts endpoints