Skip to content

Site · API

Custom API Endpoints Introduction

Last updated 18 November 2026

Addresses on your site that other programs call for JSON, each with its own body and policy.

A Custom API Endpoint is an address on your site that another program can call to read or change your data. Each endpoint is a page that answers in JSON, with its own Liquid body and its own authorization policy. Use one to give a partner system, a mobile app or a script exactly the data it needs, and nothing more.

Where to find them

In the admin, open API and choose Custom API Endpoints. The list shows JSON pages from across your site in one place. Each endpoint has a Details tab and a Body tab.

FieldMeaning
NameThe display name in the list
SlugThe address, for example api/orders/recent
Request methodGET, POST, PUT, PATCH or DELETE. One method per endpoint
Authorization policyWho may call it. Choose a policy, or Site API Key
BodyThe Liquid that builds the response

Example: a GET endpoint

app/views/pages/api/pages/count.liquid

---
slug: api/pages/count
format: json
layout: ''
authorization_policies:
  - modules/insites_crm/has_valid_instance_api_authorization
---
{%- graphql r -%}
  query { admin_pages(per_page: 1) { total_entries } }
{%- endgraphql -%}
{ "pages": {{ r.admin_pages.total_entries }} }

The admin_pages query in this body returned 63 when run read-only on the docs.insites.io site on 1 November 2026. Callers send the site API key in the Authorization header.

Warning

The form lets you save an endpoint with no policy. That endpoint is then open to anyone on the internet. Always choose a policy.

Common mistakes

  • Handling two methods in one endpoint. A page has one request method; make a second endpoint for the write.
  • POSTing to a GET endpoint. The site answers with its Not Found page and status 200, which looks like a missing page.
  • Expecting module endpoints in the list. Endpoints shipped by Insites modules are listed in the site API reference at /admin/api.