> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Apply a template handler

> **Required scope:** write

**Required scope:** `write`

### Path parameters

**slug** `string` *required*

Template slug

### Query parameters

**mode** `string`

additive or replace

### Response

`ApplyTemplateResponse`

**entities\_created** `integer` *required*

**entities\_skipped** `integer` *required*

**errors** `string[]` *required*

**input\_predicates** `string[]`

The facts this rulebook now needs to reach a verdict — supply these (per decision via `facts`, or as KB triples) to drive it. Closes the apply→supply→decide loop so the caller isn't left guessing.

**mode** `string` *required*

**rules\_created** `integer` *required*

**rules\_skipped** `integer` *required*

**template\_slug** `string` *required*

### Status codes

| Code | Meaning |
| - | - |
| `200` | Template applied; returns per-item counts |
| `401` | Unauthorized — missing or invalid credentials |
| `402` | Quota exceeded |
| `403` | Forbidden — the key/token lacks the required scope |
| `404` | Template not found |
| `429` | Rate limited — see Retry-After / X-RateLimit-Reset |

```bash cURL theme={null}
curl --request POST \
  --url 'https://api.nsr.stateset.com/api/v1/templates/{slug}/apply' \
  --header "X-API-Key: $STATESET_NSR_API_KEY"
```

```json 200 theme={null}
{
  "entities_created": 1,
  "entities_skipped": 1,
  "errors": [
    "string"
  ],
  "input_predicates": [
    "string"
  ],
  "mode": "string",
  "rules_created": 1,
  "rules_skipped": 1,
  "template_slug": "string"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.