# Use occ in admin scripts - occ API?

**URL:** <https://help.nextcloud.com/t/use-occ-in-admin-scripts-occ-api/105449>\
**Category:** ℹ️ Support\
**Created:** [January 24, 2021, 5:11pm UTC](https://help.nextcloud.com/t/use-occ-in-admin-scripts-occ-api/105449 "2021-01-24T17:11:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mklemme](https://help.nextcloud.com/letter_avatar/mklemme/32/6_22734026db12803ebb3e059622ac3534.png) [@mklemme](https://help.nextcloud.com/u/mklemme)\
**Post date:** [January 24, 2021, 5:11pm UTC](https://help.nextcloud.com/t/use-occ-in-admin-scripts-occ-api/105449/1 "2021-01-24T17:11:47Z")

</div>

Hallo

I would like to add all users to a default group.  
I’d write a script that uses occ to query users and groups, and occ to add users to groups.

A PHP script that is calling the PHP program occ is a bit _indirect_.  
Is there an occ API that could be used from within PHP?

Thanks  
M

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 13, 2024, 6:27am UTC](https://help.nextcloud.com/t/use-occ-in-admin-scripts-occ-api/105449/2 "2024-12-13T06:27:07Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 13, 2024, 6:27am UTC](https://help.nextcloud.com/t/use-occ-in-admin-scripts-occ-api/105449/3 "2024-12-13T06:27:09Z")

</div>


