Skip to content
PATCH/api/v1/security/campaigns/{id}

Update a red-team campaign

Mass-assignment-safe partial update of a campaign scoped to (id, projectId). projectId is required; at least one updatable field must be supplied.

Authentication

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

Request body required

Example

{
  "projectId": "00000000-0000-0000-0000-000000000000",
  "name": "string",
  "description": "string",
  "targetModel": "string",
  "attackPlugins": [
    "string"
  ],
  "schedule": "string",
  "maxRunsPerDay": 1,
  "enabled": false,
  "tags": [
    "string"
  ]
}
Schema
{
  "application/json": {
    "schema": {
      "type": "object",
      "required": [
        "projectId"
      ],
      "properties": {
        "projectId": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string",
          "maxLength": 200
        },
        "description": {
          "type": "string",
          "maxLength": 2000
        },
        "targetModel": {
          "type": "string"
        },
        "attackPlugins": {
          "type": "array",
          "maxItems": 100,
          "items": {
            "type": "string"
          }
        },
        "schedule": {
          "type": "string",
          "maxLength": 100
        },
        "maxRunsPerDay": {
          "type": "integer",
          "minimum": 1
        },
        "enabled": {
          "type": "boolean"
        },
        "tags": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}

Response

200 example

{
  "success": true
}

All status codes

200Updated campaign.
400(no description)
401(no description)
404(no description)
429(no description)

Code samples

cURL

curl -X PATCH \
  https://evalguard.ai/api/v1/security/campaigns/{id} \
  -H "Authorization: Bearer $EVALGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "projectId": "00000000-0000-0000-0000-000000000000", "name": "string", "description": "string", "targetModel": "string", "attackPlugins": [ "string" ], "schedule": "string", "maxRunsPerDay": 1, "enabled": false, "tags": [ "string" ] }'

TypeScript

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

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

const response = await client.request({
  method: "PATCH",
  path: "/api/v1/security/campaigns/{id}",
  body: {
    "projectId": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string",
    "targetModel": "string",
    "attackPlugins": [
      "string"
    ],
    "schedule": "string",
    "maxRunsPerDay": 1,
    "enabled": false,
    "tags": [
      "string"
    ]
  },
});
console.log(response);

Python

from evalguard import EvalGuard
import os

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

response = client.request(
    method="PATCH",
    path="/api/v1/security/campaigns/{id}",
    body={
    "projectId": "00000000-0000-0000-0000-000000000000",
    "name": "string",
    "description": "string",
    "targetModel": "string",
    "attackPlugins": [
        "string"
    ],
    "schedule": "string",
    "maxRunsPerDay": 1,
    "enabled": False,
    "tags": [
        "string"
    ]
},
)
print(response)

Go

package main

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

func main() {
	body := strings.NewReader(`{"projectId":"00000000-0000-0000-0000-000000000000","name":"string","description":"string","targetModel":"string","attackPlugins":["string"],"schedule":"string","maxRunsPerDay":1,"enabled":false,"tags":["string"]}`)
	req, _ := http.NewRequestWithContext(context.Background(), "PATCH", "https://evalguard.ai/api/v1/security/campaigns/{id}", 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 Security endpoints