---
title: "Apply Template"
method: POST
path: "/v2/automation/templates/{template_id}/apply"
tags: ["v2", "automation"]
---

# Apply Template

`POST /v2/automation/templates/{template_id}/apply`

## Request

- Base URL: `https://api.mentium.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.mentium.io/v2/automation/templates/{template_id}/apply`
- Auth: HTTP bearer

Apply a template with user-provided variable values.

Returns the resolved trigger configuration with metadata embedded inside
config.metadata for workflow creation (trigger_name, trigger_description, etc.).

## Path parameters

- `template_id` string, required

## Headers

- `mentium-workspace-id` string, nullable

## Request body

- ApplyTemplateRequest: Request to apply a template with variable values.
  - `variable_values` object, required

## Response `200`

Successful Response

- ApplyTemplateResponse: Response after applying a template. The config contains all metadata needed for workflow creation inside config.metadata (trigger_name, trigger_description, trigger_icon, etc.).
  - `config` VortexEventTriggerConfig, required: Complete configuration for an event-driven automation trigger. All conditions are combined with AND logic - trigger fires only if ALL conditions match, and, when ``any_conditions`` is set, at least one of those matches too. ``require_any_condition_transition`` additionally requires one of ``conditions`` to transition from non-matching to matching. Optionally filters by specific TMS integrations.
    - `conditions` EventTriggerCondition[]: List of conditions (all must match - AND logic)
      - `resource_type` 'load' | 'carrier' | 'customer', required: Types of TMS resources that can trigger automations.
      - `type` 'current_state' | 'change_state', required: How to evaluate a condition.
      - `field` string, required: JSONPath-style field path: 'tms_status', 'mentium_status', 'stops[0].city', 'customer.name'
      - `operator` 'equals' | 'not_equals' | 'in' | 'not_in' | 'contains' | 'not_contains' | 'greater_than' | 'less_than' | 'greater_than_or_equal' | 'less_than_or_equal' | 'exists' | 'not_exists', required: Comparison operators for condition evaluation.
      - `value` unknown
      - `from_value` unknown
      - `to_value` unknown
    - `any_conditions` EventTriggerCondition[]: List of conditions of which at least one must match (OR logic); ignored when empty
      - `resource_type` 'load' | 'carrier' | 'customer', required: Types of TMS resources that can trigger automations.
      - `type` 'current_state' | 'change_state', required: How to evaluate a condition.
      - `field` string, required: JSONPath-style field path: 'tms_status', 'mentium_status', 'stops[0].city', 'customer.name'
      - `operator` 'equals' | 'not_equals' | 'in' | 'not_in' | 'contains' | 'not_contains' | 'greater_than' | 'less_than' | 'greater_than_or_equal' | 'less_than_or_equal' | 'exists' | 'not_exists', required: Comparison operators for condition evaluation.
      - `value` unknown
      - `from_value` unknown
      - `to_value` unknown
    - `require_any_condition_transition` boolean: Require at least one condition to transition from non-matching to matching while every condition currently matches.
    - `integration_connection_ids` string[], nullable: Filter by specific TMS integration connections (optional)
    - `metadata` TriggerMetadata: Metadata about the automation trigger for display and tracking. Populated when a template is applied. Contains info about the source template and human-readable descriptions of what the trigger does.
      - `source_template_id` string, nullable: ID of the template this trigger was created from (if any)
      - `trigger_name` string: Display name for this trigger (e.g., 'Load Becomes Active')
      - `trigger_description` string: Human-readable description of what triggers this automation
      - `trigger_icon` string: Icon/emoji for display
      - `trigger_category` string, nullable: Category for organization (status, lane, assignment, etc.)

## Other responses

- `422`: Validation Error

---

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