Automations
Update automation
PATCH
/
automation
/
automations
/
{automation_id}
/
Update Automation
curl --request PATCH \
--url https://api.keywordsai.co/automation/automations/{automation_id}/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.keywordsai.co/automation/automations/{automation_id}/"
headers = {"Authorization": "Bearer <token>"}
response = requests.patch(url, headers=headers)
print(response.text)const options = {method: 'PATCH', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.keywordsai.co/automation/automations/{automation_id}/', 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/automation/automations/{automation_id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.keywordsai.co/automation/automations/{automation_id}/"
req, _ := http.NewRequest("PATCH", url, nil)
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.patch("https://api.keywordsai.co/automation/automations/{automation_id}/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.keywordsai.co/automation/automations/{automation_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "auto-eval-001",
"automation_slug": "prod_quality_monitor",
"name": "Production Quality Monitor",
"automation_type": "online_eval",
"condition": {
"id": "cond-12345",
"condition_slug": "success_logs",
"name": "Successful Requests",
"condition_type": "single_log"
},
"evaluator_ids": [
"eval-quality-uuid"
],
"evaluator_details": [
{
"id": "eval-quality-uuid",
"name": "Response Quality Evaluator",
"evaluator_slug": "response_quality",
"eval_class": "keywordsai_custom_evaluator"
}
],
"is_enabled": true,
"configuration": {
"evaluator_ids": [
"eval-quality-uuid"
],
"sampling_rate": 0.15
},
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T11:00:00Z"
}
Updates specific fields of an existing automation. Use this to enable/disable automations, change sampling rates, or update evaluator lists.
Note: Use your API Key (not JWT token) for all requests. You can find your API keys in the Keywords AI platform under Settings > API Keys.
Authentication
All endpoints require API key authentication:Authorization: Bearer YOUR_API_KEY
Path Parameters
| Parameter | Type | Description |
|---|---|---|
automation_id | string | The unique ID or slug of the automation to update |
Request Body
All fields are optional - only include the fields you want to update.| Field | Type | Description |
|---|---|---|
is_enabled | boolean | Whether automation is active |
configuration.sampling_rate | number | Sampling rate between 0.0-1.0 |
evaluator_ids | array[string] | Array of evaluator UUIDs to run |
Examples
Enable/Disable Automation
import requests
automation_id = "auto-eval-001"
url = f"https://api.keywordsai.co/automation/automations/{automation_id}/"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
# Disable automation
data = {
"is_enabled": False
}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
curl -X PATCH "https://api.keywordsai.co/automation/automations/auto-eval-001/" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"is_enabled": false
}'
Update Sampling Rate
# Update sampling rate to 20%
data = {
"configuration": {
"sampling_rate": 0.2
}
}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
curl -X PATCH "https://api.keywordsai.co/automation/automations/auto-eval-001/" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"configuration": {
"sampling_rate": 0.2
}
}'
Update Evaluator List
# Add a new evaluator to the list
data = {
"evaluator_ids": [
"eval-quality-uuid",
"eval-safety-uuid",
"eval-hallucination-uuid"
]
}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
curl -X PATCH "https://api.keywordsai.co/automation/automations/auto-eval-001/" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"evaluator_ids": [
"eval-quality-uuid",
"eval-safety-uuid",
"eval-hallucination-uuid"
]
}'
Update Multiple Fields
# Update multiple fields at once
data = {
"is_enabled": True,
"configuration": {
"sampling_rate": 0.15
},
"evaluator_ids": [
"eval-quality-uuid"
]
}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
curl -X PATCH "https://api.keywordsai.co/automation/automations/auto-eval-001/" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"is_enabled": true,
"configuration": {
"sampling_rate": 0.15
},
"evaluator_ids": [
"eval-quality-uuid"
]
}'
Reduce Sampling Rate for Cost Savings
# Reduce from 10% to 1% sampling
data = {
"configuration": {
"sampling_rate": 0.01
}
}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
curl -X PATCH "https://api.keywordsai.co/automation/automations/auto-eval-001/" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"configuration": {
"sampling_rate": 0.01
}
}'
Response
Status: 200 OK{
"id": "auto-eval-001",
"automation_slug": "prod_quality_monitor",
"name": "Production Quality Monitor",
"automation_type": "online_eval",
"condition": {
"id": "cond-12345",
"condition_slug": "success_logs",
"name": "Successful Requests",
"condition_type": "single_log"
},
"evaluator_ids": [
"eval-quality-uuid"
],
"evaluator_details": [
{
"id": "eval-quality-uuid",
"name": "Response Quality Evaluator",
"evaluator_slug": "response_quality",
"eval_class": "keywordsai_custom_evaluator"
}
],
"is_enabled": true,
"configuration": {
"evaluator_ids": [
"eval-quality-uuid"
],
"sampling_rate": 0.15
},
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T11:00:00Z"
}
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique automation identifier |
automation_slug | string | URL-friendly identifier |
name | string | Display name of the automation |
automation_type | string | Type of automation ("online_eval") |
condition | object | Condition object with details |
evaluator_ids | array[string] | Updated list of evaluator UUIDs |
evaluator_details | array[object] | Detailed information about each evaluator |
is_enabled | boolean | Updated enabled status |
configuration | object | Updated configuration including sampling rate |
created_at | string | ISO timestamp of creation |
updated_at | string | ISO timestamp of last update |
Update Behavior
- Partial Updates: Only the fields you provide will be updated
- Configuration Merging: The
configurationobject is merged with existing values - Evaluator List Replacement: Providing
evaluator_idsreplaces the entire list (not appended) - Validation: All validation rules from the create endpoint apply to updates
Error Responses
400 Bad Request - Invalid Evaluator
{
"evaluator_ids": [
"Evaluators not found: invalid-uuid-123"
]
}
400 Bad Request - Invalid Sampling Rate
{
"configuration": {
"sampling_rate": [
"Sampling rate must be between 0.0 and 1.0"
]
}
}
400 Bad Request - Empty Evaluator List
{
"evaluator_ids": [
"At least one evaluator is required"
]
}
401 Unauthorized
{
"detail": "Authentication credentials were not provided."
}
404 Not Found
{
"detail": "Automation not found"
}
Was this page helpful?
⌘I
Update Automation
curl --request PATCH \
--url https://api.keywordsai.co/automation/automations/{automation_id}/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.keywordsai.co/automation/automations/{automation_id}/"
headers = {"Authorization": "Bearer <token>"}
response = requests.patch(url, headers=headers)
print(response.text)const options = {method: 'PATCH', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.keywordsai.co/automation/automations/{automation_id}/', 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/automation/automations/{automation_id}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.keywordsai.co/automation/automations/{automation_id}/"
req, _ := http.NewRequest("PATCH", url, nil)
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.patch("https://api.keywordsai.co/automation/automations/{automation_id}/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.keywordsai.co/automation/automations/{automation_id}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "auto-eval-001",
"automation_slug": "prod_quality_monitor",
"name": "Production Quality Monitor",
"automation_type": "online_eval",
"condition": {
"id": "cond-12345",
"condition_slug": "success_logs",
"name": "Successful Requests",
"condition_type": "single_log"
},
"evaluator_ids": [
"eval-quality-uuid"
],
"evaluator_details": [
{
"id": "eval-quality-uuid",
"name": "Response Quality Evaluator",
"evaluator_slug": "response_quality",
"eval_class": "keywordsai_custom_evaluator"
}
],
"is_enabled": true,
"configuration": {
"evaluator_ids": [
"eval-quality-uuid"
],
"sampling_rate": 0.15
},
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T11:00:00Z"
}