Lytics Templates API

Create, manage, and test templates.

Operations 8

GET /template List templates
POST /template Create a template
POST /template/test Test a template
DELETE /template/{id} Delete template
GET /template/{id} Get a template
POST /template/{id} Update a template
GET /template/{id}/definition Get a template definition
POST /template/{id}/test Test a template

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/lytics-templates-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

lytics-templates-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  contact:
    email: support@lytics.com
    name: Lytics Support
    url: https://support.lytics.com/hc/en-us
  description: Version 2 of the Lytics API
  termsOfService: https://www.lytics.com/terms-of-service/
  title: Lytics Templates API
  version: '2.0'
servers:
- url: https://api.lytics.io/v2
tags:
- description: Create, manage, and test templates.
  name: Templates
paths:
  /template:
    get:
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      items:
                        $ref: '#/components/schemas/models.TemplateMetadata'
                      type: array
                  type: object
          description: Template Metadata
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: List templates
      tags:
      - Templates
    post:
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The template name
        in: query
        name: name
        required: true
        schema:
          type: string
      - description: A description of the template
        in: query
        name: description
        schema:
          type: string
      - description: The template type
        in: query
        name: type
        required: true
        schema:
          enum:
          - '"jsonnet"'
          - '"handlebars"'
          type: string
      requestBody:
        content:
          '*/*':
            schema:
              description: Adhoc template definition
              type: string
        description: The template definition
        required: true
        x-originalParamName: definition
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      $ref: '#/components/schemas/models.TemplateMetadata'
                  type: object
          description: Template Metadata
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Create a template
      tags:
      - Templates
  /template/test:
    post:
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      requestBody:
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/models.AdhocTemplateTestRequest'
        description: The template request
        required: true
        x-originalParamName: request
      responses:
        '200':
          content:
            application/json:
              schema:
                type: string
          description: Template output
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Test a template
      tags:
      - Templates
  /template/{id}:
    delete:
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The template ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Delete template
      tags:
      - Templates
    get:
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The template ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      $ref: '#/components/schemas/models.TemplateMetadata'
                  type: object
          description: Template Metadata
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Get a template
      tags:
      - Templates
    post:
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The template id
        in: path
        name: id
        required: true
        schema:
          type: string
      - description: The template name
        in: query
        name: name
        required: true
        schema:
          type: string
      - description: A description of the template
        in: query
        name: description
        schema:
          type: string
      - description: The template type
        in: query
        name: type
        required: true
        schema:
          enum:
          - '"jsonnet"'
          - '"handlebars"'
          type: string
      requestBody:
        content:
          '*/*':
            schema:
              description: Adhoc template definition
              type: string
        description: The template definition
        required: true
        x-originalParamName: definition
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      $ref: '#/components/schemas/models.TemplateMetadata'
                  type: object
          description: Template Metadata
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Update a template
      tags:
      - Templates
  /template/{id}/definition:
    get:
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The template ID
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/models.ApiResponse'
                - properties:
                    data:
                      type: string
                  type: object
          description: Template Definition
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Get a template definition
      tags:
      - Templates
  /template/{id}/test:
    post:
      parameters:
      - description: The account ID. Defaults to the user's default account.
        in: query
        name: account_id
        schema:
          type: string
      - description: The template id
        in: path
        name: id
        required: true
        schema:
          type: string
      requestBody:
        content:
          '*/*':
            schema:
              $ref: '#/components/schemas/models.TemplateTestRequest'
        description: The template request
        required: true
        x-originalParamName: request
      responses:
        '200':
          content:
            application/json:
              schema:
                type: string
          description: Template output
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Not Found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.ApiErrorResponse'
          description: Internal Server Error
      security:
      - ApiKeyAuth: []
      summary: Test a template
      tags:
      - Templates
components:
  schemas:
    models.ApiErrorResponse:
      properties:
        errors:
          description: Lytics API Errors
          items:
            $ref: '#/components/schemas/lioerrors.ApiV2ErrorOut'
          type: array
        request_id:
          type: string
        status:
          description: HTTP Status Code
          type: integer
      type: object
    models.TemplateMetadata:
      properties:
        author_id:
          type: string
        created:
          type: string
        description:
          type: string
        desired_format:
          type: string
        field_filter:
          items:
            type: string
          type: array
        id:
          type: string
        lytics_managed:
          description: undocumented, sysadmin-use only
          type: boolean
        name:
          type: string
        target:
          type: string
        type:
          type: string
        updated:
          type: string
      type: object
    models.SampleSegmentsInput:
      properties:
        as:
          description: where membership is surfaced to the template; omit for neither
          enum:
          - env
          - entity
          type: string
        names:
          description: audience names the entity is in; sample slugs are approximated from these, not the stored slug
          items:
            type: string
          type: array
      type: object
    lioerrors.ApiV2ErrorOut:
      properties:
        code:
          description: Lytics Error Code
          enum:
          - UNKNOWN-000
          - BADREQ-001
          - JOB-BADREQ-002
          - NOTFOUND-003
          - JOB-NOTFOUND-004
          - WF-NOTFOUND-005
          - AUTH-NOTFOUND-006
          - AUTHTYPE-NOTFOUND-007
          - AUTH-BADREQ-008
          - TABLE-NOTFOUND-009
          - SCHEMA-NOTFOUND-010
          - SCHEMAVERSION-NOTFOUND-011
          - ENTITY-NOTFOUND-012
          - QUERY-NOTFOUND-013
          - STREAM-NOTFOUND-014
          - PROVIDER-BADREQ-015
          - PROVIDER-NOTFOUND-016
          - UNAUTHORIZED-017
          - SCHEMA-INVALID-018
          - INTERNAL-019
          - ROUTERULE-NOTFOUND-020
          - ACCOUNT-NOTFOUND-021
          - JOB-FAULT-022
          - USER-NOTFOUND-023
          - USER-BADREQ-024
          - JSON-BADREQ-025
          - FORBIDDEN-026
          type: string
        level:
          description: When the error was generated
          type: string
        message:
          description: A description of the error that occurred
          type: string
        timestamp:
          description: The time the error occurred
          format: date-time
          type: string
      type: object
    models.ApiResponse:
      properties:
        _meta:
          additionalProperties: true
          description: Response Metadata
          type: object
        data:
          description: Response Payload
          type: object
        request_id:
          type: string
        status:
          description: HTTP Status Code
          type: integer
      type: object
    models.TemplateTestRequest:
      properties:
        entity:
          additionalProperties: true
          type: object
        job_config:
          additionalProperties: true
          type: object
        sample_segments:
          $ref: '#/components/schemas/models.SampleSegmentsInput'
      type: object
    models.AdhocTemplateTestRequest:
      properties:
        entity:
          additionalProperties: true
          type: object
        job_config:
          additionalProperties: true
          type: object
        sample_segments:
          $ref: '#/components/schemas/models.SampleSegmentsInput'
        template_definition:
          description: Adhoc template definition
          type: string
        template_type:
          description: Adhoc template type
          enum:
          - jsonnet
          - handlebars
          type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      in: header
      name: Authorization
      type: apiKey