Service account users API
- Tier: Premium, Ultimate
- Offering: Self-managed, GitLab Dedicated
Create and list service account users by using the REST API.
Create a service account user
Create a service account user. You can specify the account username and name. If you do not specify any attributes:
- The default name is
Service account user
. - The username is automatically generated.
Prerequisites:
- You must be an administrator.
POST /service_accounts
Supported attributes:
Attribute | Type | Required | Description |
---|---|---|---|
name |
string | no | Name of the user. |
username |
string | no | Username of the user. |
Example request:
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/service_accounts"
Example response:
{
"id": 57,
"username": "service_account_6018816a18e515214e0c34c2b33523fc",
"name": "Service account user"
}
List all service account users
- Tier: Premium, Ultimate
- Offering: Self-managed, GitLab Dedicated
Lists all service account users.
Prerequisites:
- You must be an administrator.
This function takes pagination parameters page
and per_page
to restrict the
list of users.
GET /service_accounts
Supported attributes:
Attribute | Type | Required | Description |
---|---|---|---|
order_by |
string | no | Order list of users by username or id Default is id . |
sort |
string | no | Specify sorting by asc or desc . Default is desc . |
Example request:
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/service_accounts"
Example response:
[
{
"id": 114,
"username": "service_account_33",
"name": "Service account user"
},
{
"id": 137,
"username": "service_account_34",
"name": "john doe"
}
]
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support