POST/api/v1/prompts/{promptVersionId}/labels

Attach or detach labels on a prompt version (role-gated)

Add/remove labels on a prompt version. If any requested label is in the project's prompt_protected_labels registry, the caller must have at least the registry's min_required_role on the project's org. Returns 403 PROTECTED_LABEL on violation.

Authentication

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

Parameters

promptVersionId in pathrequired
string

Request body required

Example

{
  "add": [
    "string"
  ],
  "remove": [
    "string"
  ]
}
Schema
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "add": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "type": "string",
            "maxLength": 60
          }
        },
        "remove": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "type": "string",
            "maxLength": 60
          }
        }
      }
    }
  }
}

Response

All status codes

200Updated label set + add/remove echo
400(no description)
401(no description)
403PROTECTED_LABEL or NOT_A_MEMBER
404Prompt version not found
409MISSING_ORG — prompt's project has no org binding
429(no description)
500DB_ERROR

Code samples

cURL

curl -X POST \
  https://evalguard.ai/api/v1/prompts/{promptVersionId}/labels \
  -H "Authorization: Bearer $EVALGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "add": [ "string" ], "remove": [ "string" ] }'

TypeScript

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

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

const response = await client.request({
  method: "POST",
  path: "/api/v1/prompts/{promptVersionId}/labels",
  body: {
    "add": [
      "string"
    ],
    "remove": [
      "string"
    ]
  },
});
console.log(response);

Python

from evalguard import EvalGuard
import os

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

response = client.request(
    method="POST",
    path="/api/v1/prompts/{promptVersionId}/labels",
    body={
    "add": [
        "string"
    ],
    "remove": [
        "string"
    ]
},
)
print(response)

Go

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/evalguard/evalguard-go"
)

func main() {
	client := evalguard.NewClient(os.Getenv("EVALGUARD_API_KEY"))
	resp, err := client.Request(context.Background(), "POST", "/api/v1/prompts/{promptVersionId}/labels", map[string]any{"add": []any{"string"}, "remove": []any{"string"}})
	if err != nil { panic(err) }
	fmt.Println(resp)
}

Errors

400401403404409429500

Other Prompts endpoints