# Access over API with PHP (with token)

**URL:** <https://discourse.getcockpit.com/t/access-over-api-with-php-with-token/2646>\
**Category:** Cockpit v2\
**Created:** [December 22, 2022, 5:13pm UTC](https://discourse.getcockpit.com/t/access-over-api-with-php-with-token/2646 "2022-12-22T17:13:40Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![letima](https://avatars.discourse-cdn.com/v4/letter/l/9e8a1a/32.png) [@letima](https://discourse.getcockpit.com/u/letima)\
**Post date:** [December 22, 2022, 8:22pm UTC](https://discourse.getcockpit.com/t/access-over-api-with-php-with-token/2646/6 "2022-12-22T20:22:55Z")

</div>

Ok, I searched in the Cockpit code and found something like api\_key! That is working for me!  
[https://cockpit.local/api/content/items/Seiten?api\_key=xxx](https://cockpit.local/api/content/items/Seiten?api_key=xxx)

It’s always about the documentation 😉

But am I right for a secure setup:

- authenticate with users credentials (getting from something like a web form)
- check authentification with /api/user/auth
- save the api\_key safely, and temporary on the Webserver (e.g. in a session) for current actions.

---

_[View the full topic](https://discourse.getcockpit.com/t/access-over-api-with-php-with-token/2646)._
