Introduction
Endpoints
There are a large number of endpoints, split into the following areas:
Authentication
Every API request requires authentication. We offer session-based authentication or HTTP Basic auth. Read more ›
Language
In a multi-language site it is necessary to specify the language for which you want to use the API. This is done by sending an X-Language
header containing the desired language code with your request.
Errors
Example error
In debug mode
When debug mode is activated in your config, you will get a more detailed error response with the exception type, file and line.
To activate the debug mode, add the following to your config:
Please make sure to disable debug
mode in production! Displaying PHP errors on a public server can be a serious security risk:
- Error messages are displayed with detailed information about the code structure (e.g. file path, class, method)
- With Whoops enabled, there will be even more detailed information about the code structure
- Detailed error messages for login failures could leak information to attackers
In a production environment, always log errors to your PHP error logs.
Custom API location
Kirby can be configured to host the API at a different location. This can be set up in your config.
All API endpoints are now available at https://yourdomain.com/rest
. The Panel will automatically switch to the new API location.
Further customize the API
Find out how you can define custom endpoints, data functions, models etc. either via your config options › or in a plugin ›.