---
title: "Test a template"
method: POST
path: "/template/test"
tags: ["Templates"]
---

# Test a template

`POST /template/test`

## Request

- Base URL: `https://api.lytics.io/v2`
- URL: `https://api.lytics.io/v2/template/test`
- Auth: API key in header `Authorization`

## Query parameters

- `account_id` string

## Request body `*/*`

- ModelsAdhocTemplateTestRequest
  - `entity` object
  - `job_config` object
  - `sample_segments` ModelsSampleSegmentsInput
    - `as` 'env' | 'entity': where membership is surfaced to the template; omit for neither
    - `names` string[]: audience names the entity is in; sample slugs are approximated from these, not the stored slug
  - `template_definition` string: Adhoc template definition
  - `template_target` 'stream' | 'entql' | 'enrich'
  - `template_type` 'jsonnet' | 'handlebars' | 'js1': Adhoc template type

## Response `200`

Template output

- string

## Other responses

- `400`: Bad Request
- `404`: Not Found
- `500`: Internal Server Error

## Changes

- **2026-11-03** `d8e975057aec`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/lytics/apis/lytics-api/changes/template/test/post.md)

---

[API](https://skmtc.dev/lytics/apis/lytics-api.md) - [All operations](https://skmtc.dev/lytics/apis/lytics-api/llms.txt) - [OpenAPI document](https://skmtc.dev/lytics/apis/lytics-api/revisions/d8e975057aec?raw)
