doc/user/profile/service_accounts.md
{{< details >}}
{{< /details >}}
{{< history >}}
service_accounts_available_on_free_or_unlicensed.
Disabled by default.allow_projects_to_create_service_accounts.
Disabled by default.allow_subgroups_to_create_service_accounts.
Disabled by default.allow_subgroups_to_create_service_accounts and allow_projects_to_create_service_accounts removed.{{< /history >}}
Service accounts are user accounts that represent non-human entities rather than individual people. Use service accounts to perform automated actions, access data, or run scheduled processes. Service accounts are commonly used in pipelines or third-party integrations where credentials must stay stable regardless of changes to your team's membership.
Service accounts authenticate with a personal access token. They can interact with package and container registries, perform Git operations, and access the API.
Service accounts have the following characteristics:
You can also manage service accounts through the service accounts API.
The number of service accounts you can create depends on your subscription and offering:
Service accounts have three types, each with a different scope and prerequisites:
{{< tabs >}}
{{< tab title="Instance service accounts" >}}
Instance service accounts are created through the Admin area, and can be invited to any group or project on the instance.
Prerequisites:
{{< /tab >}}
{{< tab title="Group service accounts" >}}
Group service accounts are created by a specific group and can be invited to the group where they were created or to any descendant subgroups or projects. They cannot create top-level groups or service accounts.
Prerequisites:
{{< /tab >}}
{{< tab title="Project service accounts" >}}
Project service accounts are created by a specific project and are available only to that project. They cannot create top-level groups or service accounts.
Prerequisites:
{{< /tab >}}
{{< /tabs >}}
{{< history >}}
{{< /history >}}
The service accounts page displays information about service accounts in your group, project, or instance. Each group, project, and GitLab Self-Managed instance has a separate service accounts page. From these pages, you can:
{{< tabs >}}
{{< tab title="Instance service accounts" >}}
To view service accounts for the entire instance:
{{< /tab >}}
{{< tab title="Group service accounts" >}}
To view service accounts for a group:
{{< /tab >}}
{{< tab title="Project service accounts" >}}
To view service accounts for a project:
{{< /tab >}}
{{< /tabs >}}
{{< history >}}
allow_top_level_group_owners_to_create_service_accounts for GitLab Self-Managed. Disabled by default.allow_top_level_group_owners_to_create_service_accounts removed.{{< /history >}}
On GitLab.com, only top-level group Owners can create service accounts.
By default, on GitLab Self-Managed and GitLab Dedicated, only administrators can create either type of service account. However, you can configure the instance to allow top-level group Owners to create group service accounts.
The number of service accounts you can create depends on your subscription and offering:
To create a service account:
{{< history >}}
{{< /history >}}
You can edit the name or username of a service account.
[!note] You cannot update the username of a service account associated with a composite identity.
To edit a service account:
Service accounts have limited access until you add them as members of a group or project. You can add any number of service accounts to a group or project, and each service account can have a different role in each group, subgroup, or project.
Service account access depends on the type of service account:
When a group is shared with another group, all members of that group, including service accounts, gain access to the shared group.
You can assign service accounts to groups and projects using:
[!note] If the global SAML group memberships lock or the global LDAP group memberships lock settings are enabled, you must use the API to control service account memberships.
Service accounts can fork projects through the Project forks API, but cannot fork to their personal namespace. When forking with a service account, you must specify a target group namespace.
Prerequisites:
api scope is turned on for the service account's personal access token.To fork a project using a service account:
Identify the target group where the fork is created.
Ensure the service account is a member of that group with appropriate permissions.
Use the fork project API with either namespace_id or namespace_path:
curl --request POST --header "PRIVATE-TOKEN: <service_account_token>" \
--data "namespace_path=target-group" \
"https://gitlab.example.com/api/v4/projects/<project_id>/fork"
When you delete a service account, any contributions made by the account are retained and ownership is transferred to a ghost user. These contributions can include activity such as merge requests, issues, projects, and groups.
To delete a service account:
You can also delete the service account and any contributions made by the account. These contributions can include activity such as merge requests, issues, groups, and projects.
You can also delete service accounts through the API.
The personal access tokens page displays information about the personal access tokens associated with a service account in your top-level group or instance. From these pages, you can:
You can also manage personal access tokens for service accounts through the API.
To view the personal access tokens page for a service account:
To use a service account, you must create a personal access token to authenticate requests.
To create a personal access token for a service account:
You can rotate a personal access token to invalidate the current token and generate a new value.
[!warning] This cannot be undone. Services that rely on the rotated token stop working.
To rotate a personal access token for a service account:
You can rotate a personal access token to invalidate the current token.
[!warning] This cannot be undone. Services that rely on the revoked token stop working.
To revoke a personal access token for a service account:
Rate limits apply to service accounts: