POST/api/v1/feedback/token

Create one-time feedback token

Returns a single-use, signed token for embedding in customer-facing UIs to collect feedback against a specific eval run, trace, or annotation. Token includes orgId, resourceId, and expiry — verified via crypto.timingSafeEqual (ADR-0016).

Authentication

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

Request body required

Example

{
  "resource_type": "eval_run",
  "resource_id": "string",
  "expires_in_seconds": 3600
}
Schema
{
  "application/json": {
    "schema": {
      "type": "object",
      "required": [
        "resource_type",
        "resource_id"
      ],
      "properties": {
        "resource_type": {
          "type": "string",
          "enum": [
            "eval_run",
            "trace",
            "annotation"
          ]
        },
        "resource_id": {
          "type": "string"
        },
        "expires_in_seconds": {
          "type": "integer",
          "default": 3600,
          "maximum": 86400
        }
      }
    }
  }
}

Response

200 example

{
  "token": "string",
  "expires_at": "2026-05-29T20:54:19.746Z"
}

All status codes

200Token created.
400(no description)
401(no description)
429(no description)

Code samples

cURL

curl -X POST \
  https://evalguard.ai/api/v1/feedback/token \
  -H "Authorization: Bearer $EVALGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "resource_type": "eval_run", "resource_id": "string", "expires_in_seconds": 3600 }'

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/feedback/token",
  body: {
    "resource_type": "eval_run",
    "resource_id": "string",
    "expires_in_seconds": 3600
  },
});
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/feedback/token",
    body={
    "resource_type": "eval_run",
    "resource_id": "string",
    "expires_in_seconds": 3600
},
)
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/feedback/token", map[string]any{"resource_type": "eval_run", "resource_id": "string", "expires_in_seconds": 3600})
	if err != nil { panic(err) }
	fmt.Println(resp)
}

Errors

400401429

Other Evals endpoints