Developers · APIs
Controllers
Last updated 18 November 2026
Controllers give you direct, server-side access to your Site'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 Site, 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 Site's own codebase.
How to Use Controllers
Use the function tag to call a controller from any Liquid template:
{% function data = 'crm/controller/contacts/create', params: params %}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 Site 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
functiontag syntax to call the same endpoint logic directly from Liquid.
Use the controller request examples from your Site's API documentation as your reference. The module name, controller name, and available parameters are all shown there.
Note
Controller names and parameters depend on the versions of the modules installed on your Site. Always check your Site's API documentation at /admin/api for the exact syntax.
Call Controllers with function
Call every controller with the function tag and its alias, as shown in your /admin/api. Do not call a controller with include: include throws away the return value and can change your page’s status code and content type.
The function tag returns the controller’s data into your variable. Use the alias shown in /admin/api, not the file path. The alias stays the same between module versions; the file behind it can move.
Related
- API Documentation - Where to find your Site's auto-generated API docs, including controller request examples
- Custom API Endpoints - Creating and managing the API endpoints that controllers call into