# Apply a suite template

Create a test suite from a template, with one scenario per template scenario filled from the fit: the agent's name, its tools and what it must never do. The suite name defaults to the template title. An unknown template id answers 404 suite_template_not_found.

> Page: https://langwatch.ai/docs/api-reference/test-suites/apply-a-suite-template
> Source: https://github.com/langwatch/langwatch/blob/main/docs/api-reference/test-suites/apply-a-suite-template.mdx
> Index of all pages: https://langwatch.ai/docs/llms.txt

## Endpoint

`POST https://app.langwatch.ai/api/v1/test-suites/templates/{templateId}/apply`

## Authentication

### project_api_key

Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.

```json
{"id":"project_api_key","type":"apiKey","in":"header","name":"X-Auth-Token"}
```

## Parameters

### templateId (path, required)

```json
{"type":"string","maxLength":80,"pattern":"^[a-z0-9]+(-[a-z0-9]+)*$"}
```

## Request body (required)

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "fit": {
      "type": "object",
      "properties": {
        "agentName": {"type":"string","minLength":1,"maxLength":120},
        "tools": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {"type":"string","minLength":1,"maxLength":120}
        },
        "mustNever": {
          "default": [],
          "maxItems": 50,
          "type": "array",
          "items": {"type":"string","minLength":1,"maxLength":500}
        }
      },
      "required": ["agentName"],
      "additionalProperties": false
    },
    "name": {"type":"string","minLength":1,"maxLength":200}
  },
  "required": ["fit"],
  "additionalProperties": false
}
```

## Request example

```bash
curl --request POST \
  --url 'https://app.langwatch.ai/api/v1/test-suites/templates/<templateId>/apply' \
  --header "X-Auth-Token: $LANGWATCH_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"fit":{"agentName":"string","tools":[],"mustNever":[]},"name":"string"}'
```

## Responses

### 201

Success

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "suiteId": {"type":"string","minLength":1},
    "slug": {"type":"string","minLength":1},
    "name": {"type":"string","minLength":1},
    "scenarioIds": {"type":"array","items":{"type":"string","minLength":1}}
  },
  "required": ["suiteId","slug","name","scenarioIds"],
  "additionalProperties": false
}
```

### 404

Not Found

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "error": {"type":"string"},
    "message": {"type":"string"},
    "code": {"type":"string"}
  },
  "required": ["error","code"],
  "additionalProperties": false
}
```

> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.
