Controllers

Last updated on April 09, 2026.

Controllers give you direct, server-side access to your Instance's API endpoint logic from within your Liquid templates. Instead of making an external HTTP request to an API endpoint and waiting for a response over the network, a controller call executes the same logic internally, on the server, with no roundtrip and no authentication overhead.

Why Use Controllers

When you are building pages, partials, or background jobs on your Instance, you often need to interact with the same data and logic that your API endpoints expose. Controllers let you do this natively:

  • No network roundtrip - The request stays on the server. No HTTP overhead, no latency from an external call.
  • No authentication required - Since the call happens internally, you do not need to pass API keys or tokens.
  • Same logic, different access path - A controller executes the exact same business logic as its corresponding API endpoint. The only difference is how you call it.

This makes controllers the preferred approach when you need to access API functionality from within your Instance's own codebase.

How to Use Controllers

Use the function tag to call a controller from any Liquid template:

{% function data = 'modules/module_name/controller_name', param1: value1 %}

The function tag calls the controller and stores the result in the data variable (or whatever variable name you choose). You can then use this variable in your template to access the returned data.

Finding Controller Names

Every Instance has auto-generated API documentation at /admin/api (navigate to API > Insites API Endpoints in the admin). For each endpoint listed there, you will find:

  • Example HTTP Request - Shows how to call the endpoint externally using curl or any HTTP client.
  • Example Controller Request - Shows the exact function tag syntax to call the same endpoint logic directly from Liquid.

Use the controller request examples from your Instance's API documentation as your reference. The module name, controller name, and available parameters are all shown there.

Controller names and parameters vary depending on the modules installed on your Instance. Always check your Instance's API documentation at /admin/api for the exact syntax.

Version History

The controller request syntax changed in API module v5.2.1:

Version Syntax Tag
v5.2.0 {% include 'controller_name' %} include
v5.2.1+ {% function data = 'controller_name', param: value %} function

The function tag is the current and recommended approach. It returns data that you can assign to a variable and use in your templates. The include syntax is deprecated and should not be used in new code.

Related

  • API Documentation - Where to find your Instance's auto-generated API docs, including controller request examples
  • Custom API Endpoints - Creating and managing the API endpoints that controllers call into
Have a suggestion for this page?

Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.