Site · API
Authorization Policies Introduction
Last updated 18 November 2026
Yes-or-no rules that decide whether a request to a page, endpoint or form may continue.
An authorization policy is a yes-or-no rule that decides whether a request may continue. You attach policies to pages, Custom API Endpoints and forms. When a policy says no, the request stops before the page or endpoint runs. The visitor is sent to the address the policy names.
Use a policy to keep an endpoint for signed-in users only, to require the site API key, or to admit only administrators.
Where to manage them
In the admin, open API and choose Authorization Policies. Each policy has a Details tab, with its name and file path, and a Body tab with its Liquid. The same policies also appear in the CMS. Policies that ship with Insites modules are not listed for editing.
What a policy holds
| Part | Meaning |
|---|---|
| Name | The display name in the list |
| File path | Where the policy lives, under app/authorization_policies/ |
| Body | Liquid that prints true to allow the request or false to refuse it |
| Redirect | Where a refused visitor is sent. Insites adds a return_to value with the address they asked for |
| Flash alert | A message shown to a refused visitor |
Example policy
app/authorization_policies/members_signed_in.liquid
---
name: members_signed_in
redirect_to: /sign-in
flash_alert: Please sign in first.
---
{%- if context.current_user.id != blank -%}
true
{%- else -%}
false
{%- endif -%}The docs.insites.io site holds two policies, read on 1 November 2026: one from the CRM module, and only_allowed_if_ins_administrator, which sends refused visitors to admin/401.
Common mistakes
- Letting one path print nothing. Every path must print
trueorfalse, so the refusal is clear to anyone reading it. - Leaving a Custom API Endpoint with no policy. The form lets you save one, and it is then open to anyone.
- Writing data or sending email from a policy. A policy only decides; it should have no side effects.
- Attaching several policies with different redirects. When more than one refuses, the one created first decides the redirect.