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

# Test a template

`POST /template/{id}/test`

## Request

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

## Path parameters

- `id` string, required

## Query parameters

- `account_id` string

## Request body `*/*`

- ModelsTemplateTestRequest
  - `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

## 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/:id/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)
