Kirby’s API

Kirby has a mighty API, which you can use in your snippets, templates and plugins to access each and every bit and piece of data and aspect of your site and system.

This section is about to give you a good overview of the most basic things you can do with the API. If you want to dive deeper you can find a full overview of all available API methods on the cheat sheet.

All parts of the API are inspired by the simplicity of jQuery. If you've played with jQuery before you will probably feel at home at once — even if it is PHP.


The $site object represents the root of your site with all the information stored in /content/site.txt. It's also the access point for registered users, available languages on multi-language sites and more.

Learn more about $site


The $pages object contains the first level of pages. It can be used to build the main menu or dive deeper into the structure of your site.

Learn more about $pages


The $page object represents the currently active page. It gives you access to the page's data, attached files, subpages and more.

Learn more about $page