Skip to content

Set up a service account#

If you need to use multiple API tokens or non-user tokens, you can set up one or more service accounts in your workspace.

You can use service accounts for automated processes, such as training pipelines and report generation, instead of maintaining user accounts for this purpose.

To create a service account:

  1. In the top-left corner of the Neptune app, click your workspace name → Service accountsNew service account.

  2. Enter a name for the service account.

    The full name of the account will be <service-account-name>@<workspace-name>.

  3. If you want to grant the account contributor access to all projects in the workspace, check the corresponding box.

    Otherwise, you'll need to manually assign the service account to each project it should have access to. Setting the project privacy to "workspace" does not make it accessible to service accounts, only user accounts.

  4. Once done, you can manage and access the API token of the service account.

Reactivating a service account

If you deactivate a service account and then reactivate it, the API token is reset and needs to be updated in your code.

Assigning a service account to a project#

Before adding a service account to a project, you need to create it in the workspace settings (in the top-left corner of the Neptune app, click your workspace name → Service accounts).

When creating the account, you can choose to grant it access to all projects that exist at the time. If you did not grant universal access, or you create a new project after that, you need to assign the service account to the project manually.

You can grant access:

  • via the web app, by going to the project settings menu () in the top-right and selecting Assign service accounts.
  • via the API, with the management.add_project_service_account() function.

    Add service account to project
    >>> from neptune import management
    >>> management.add_project_service_account(
    ...     project="ml-team/classification",
    ...     service_account_name="cicd@ml-team",
    ...     role="contributor",
    ... )