Skip to content
POST/api/v1/templates

Create custom template

Builds and returns a merged test-suite config from catalogue selections — nothing is stored, and no template is submitted to the org or to any community catalogue. Body: any of `domain`, `compliance[]`, `attacks[]` (at least one required, else 400 NO_SELECTION), plus optional `riskLevel` and `format` ('yaml' default, or 'json'). Returns `{config, metadata:{test_count, sources, unavailable, format, mode:'template'}}`, where `unavailable` names selected templates that have no loadable test content so a partial suite is never mistaken for the full selection. 404 NO_TESTS when the selection resolves to zero tests. Rate limit 20/min.

Authentication

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

Request body required

Example

{
  "templateId": "string",
  "format": "json"
}
Schema
{
  "application/json": {
    "schema": {
      "type": "object",
      "required": [
        "templateId"
      ],
      "properties": {
        "templateId": {
          "type": "string"
        },
        "format": {
          "type": "string",
          "enum": [
            "json",
            "yaml"
          ],
          "default": "json"
        }
      }
    }
  }
}

Response

200 example

{
  "success": true
}

All status codes

200Exported config + metadata. config field is string when format=yaml, object when format=json.
400Invalid params.
401Unauthorized — no valid credential was presented (AUTH_REQUIRED).
403Forbidden — the credential is valid but lacks the API-key scope, member role, or plan entitlement this operation requires.
404Not Found — NO_TESTS.
429Too Many Requests — the per-key or per-organization rate limit was exceeded. Honour the Retry-After header.
500Internal Server Error — an unhandled error was converted to the standard error envelope (INTERNAL_ERROR).

Code samples

cURL

curl -X POST \
  https://evalguard.ai/api/v1/templates \
  -H "Authorization: Bearer $EVALGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "templateId": "string", "format": "json" }'

TypeScript

// The TypeScript SDK (@evalguard/sdk) exposes TYPED methods — runEval,
// getEval, runSecurityScan, checkFirewall, … — not a generic request().
// For an arbitrary endpoint, call it directly:

const res = await fetch("https://evalguard.ai/api/v1/templates", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.EVALGUARD_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "templateId": "string",
    "format": "json"
  }),
});
console.log(res.status, await res.json());

Python

# The Python SDK (pip install evalguardai) exposes TYPED methods on
# EvalGuardClient — run_eval, get_eval, … — not a generic request().
# For an arbitrary endpoint, call it directly:

import os
import requests

headers = {"Authorization": f"Bearer {os.environ['EVALGUARD_API_KEY']}"}
headers["Content-Type"] = "application/json"

response = requests.request(
    "POST",
    "https://evalguard.ai/api/v1/templates",
    headers=headers,
    json={
    "templateId": "string",
    "format": "json"
},
)
print(response.status_code, response.json())

Go

package main

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

func main() {
	body := strings.NewReader(`{"templateId":"string","format":"json"}`)
	req, _ := http.NewRequestWithContext(context.Background(), "POST", "https://evalguard.ai/api/v1/templates", 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

400401403404429500

Other Evals endpoints