Is it possible to fetch languages from cockpit?

Is there any way to fetch the available languages from cockpit?

There is no entrypoint in the core, but you can create your own own. Create a file path/to/cockpit/config/api/getLanguages.php.

<?php
return $this['languages'];

Now fetch it with https://cockpit-url.com/api/getLanguages?token=xxtokenxx.

This does not work for me, my config.php looks like this:

<?php

return [
    # define the languages you want to manage
    'languages' => [
        'default' => 'English',
        'de' => 'Deutsch'
    ],
];

and I added the getLanguages.php-file as you said.

I added an access key for /getLanguages, but the endpoint still returns 404 Not Found.

It seems, that $app is not available in the custom api endpoints. Use $this instead. I updated my previous post.

If it still doesn’t work, you may have to change your custom api key from /getLanguages to /api/getLanguages.

And if you want to allow public access without any api key, just move the file into config/api/public/getLanguages.php and fetch it via example.com/api/public/getLanguages.

That was it, working like a charm now! Thanks a bunch. Also for the /public hint!