=========================================
Automatically generating service accounts
=========================================

.. note:: 

    Service accounts are only available in Package Security Manager version 6.6.5 or later. 

Service accounts enable programmatic access to channels by allowing users to generate resource tokens that are not tied to individual user credentials. This decouples access from personal accounts, making it easier to manage automation and integrations securely. Service accounts are especially useful for scenarios where access needs to persist beyond the lifecycle of a user account. For information on managing service accounts, see :doc:`Service accounts <../user/service-account>`.

.. note:: 

    Service accounts count as a user against your :ref:`licence limit <view_license>`!

As an administrator, if you want service accounts to be automatically generated every time a channel is created, complete the following steps: 

#. Open Anaconda Prompt (Terminal on macOS/Linux) and connect to your instance of Package Security Manager.
#. Navigate back to the ``ate-installer-*`` directory.
#. Using your preferred editor, open the ``docker-compose.yml`` file for editing. 
#. Add the following environment variable to the ``repo_api: environment:`` section:

    .. code-block:: none

        REPO_CHANNEL_SERVICE_ACCOUNT_AUTOCREATE=True

#. Save your changes and close the file.
#. Apply your environmental changes by running the following commands: 

    .. code-block:: none

        docker compose up --detach 

Once enabled, a service account named ``service-account-channel-<CHANNEL_NAME>`` is automatically created whenever a new channel is established. 

Channel service accounts can be managed using the :ref:`Command Line Interface (CLI) <service_account_cli>` or the :ref:`Application Programming Interface (API) <channels_api>`.