Kirby API returns unauthenticated

I have created API in kirby. I am calling it from postman. But getting below response:

    "status": "error",
    "message": "Unauthenticated",
    "code": 403,
    "exception": "Kirby\\Exception\\PermissionException",
    "key": "error.permission",
    "file": "/kirby/config/api/authentication.php",
    "line": 11,
    "details": [],
    "route": "faqs"

API code is site/plugins/api/index.php as below:


Kirby::plugin('my/api', [
  'api' => [
    'routes' => [
        'pattern' => 'faqs',
        'action'  => function () {
          return [
            'hello' => 'sunny'

How to fix this

Calls to Kirby’s API endpoint have to be authenticated, i.e either a user must be logged in for the request to work (if you are inside a session) or you have to send authentication data.

So that means that if you call the API from Postman or a similar tool, you have to send your authentication data (user name and password) with the request.

The alternative would be an non-api route if you don’t need authentication if the route should be openly accessible.