# Users API
> 原文:[https://docs.gitlab.com/ee/api/users.html](https://docs.gitlab.com/ee/api/users.html)
* [List users](#list-users)
* [For normal users](#for-normal-users)
* [For admins](#for-admins)
* [Single user](#single-user)
* [For user](#for-user)
* [For admin](#for-admin)
* [User creation](#user-creation)
* [User modification](#user-modification)
* [Delete authentication identity from user](#delete-authentication-identity-from-user)
* [User deletion](#user-deletion)
* [List current user (for normal users)](#list-current-user-for-normal-users)
* [List current user (for admins)](#list-current-user-for-admins)
* [User status](#user-status)
* [Get the status of a user](#get-the-status-of-a-user)
* [Set user status](#set-user-status)
* [User counts](#user-counts)
* [List user projects](#list-user-projects)
* [List SSH keys](#list-ssh-keys)
* [List SSH keys for user](#list-ssh-keys-for-user)
* [Single SSH key](#single-ssh-key)
* [Add SSH key](#add-ssh-key)
* [Add SSH key for user](#add-ssh-key-for-user)
* [Delete SSH key for current user](#delete-ssh-key-for-current-user)
* [Delete SSH key for given user](#delete-ssh-key-for-given-user)
* [List all GPG keys](#list-all-gpg-keys)
* [Get a specific GPG key](#get-a-specific-gpg-key)
* [Add a GPG key](#add-a-gpg-key)
* [Delete a GPG key](#delete-a-gpg-key)
* [List all GPG keys for given user](#list-all-gpg-keys-for-given-user)
* [Get a specific GPG key for a given user](#get-a-specific-gpg-key-for-a-given-user)
* [Add a GPG key for a given user](#add-a-gpg-key-for-a-given-user)
* [Delete a GPG key for a given user](#delete-a-gpg-key-for-a-given-user)
* [List emails](#list-emails)
* [List emails for user](#list-emails-for-user)
* [Single email](#single-email)
* [Add email](#add-email)
* [Add email for user](#add-email-for-user)
* [Delete email for current user](#delete-email-for-current-user)
* [Delete email for given user](#delete-email-for-given-user)
* [Block user](#block-user)
* [Unblock user](#unblock-user)
* [Deactivate user](#deactivate-user)
* [Activate user](#activate-user)
* [Get user contribution events](#get-user-contribution-events)
* [Get all impersonation tokens of a user](#get-all-impersonation-tokens-of-a-user)
* [Get an impersonation token of a user](#get-an-impersonation-token-of-a-user)
* [Create an impersonation token](#create-an-impersonation-token)
* [Revoke an impersonation token](#revoke-an-impersonation-token)
* [Get user activities (admin only)](#get-user-activities-admin-only)
* [User memberships (admin only)](#user-memberships-admin-only)
# Users API[](#users-api "Permalink")
## List users[](#list-users "Permalink")
活動用戶=帳戶總數-被阻止的用戶
獲取用戶列表.
此函數使用分頁參數`page`和`per_page`來限制用戶列表.
### For normal users[](#for-normal-users "Permalink")
```
GET /users
```
```
[ { "id": 1, "username": "john_smith", "name": "John Smith", "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", "web_url": "http://localhost:3000/john_smith" }, { "id": 2, "username": "jack_smith", "name": "Jack Smith", "state": "blocked", "avatar_url": "http://gravatar.com/../e32131cd8.jpeg", "web_url": "http://localhost:3000/jack_smith" } ]
```
您還可以使用`?search=`通過名稱或主要電子郵件搜索用戶. 例如. `/users?search=John` .
另外,您可以按用戶名查找用戶:
```
GET /users?username=:username
```
例如:
```
GET /users?username=jack_smith
```
另外,您可以根據狀態過濾用戶,例如. `blocked` , `active`此選項僅用于過濾被`blocked`或`active`用戶. 它不支持`active=false`或`blocked=false` .
```
GET /users?active=true
```
```
GET /users?blocked=true
```
**注意:**用戶名搜索不區分大小寫.
### For admins[](#for-admins "Permalink")
```
GET /users
```
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `order_by` | string | no | 返回按`id` , `name` , `username` , `created_at`或`updated_at`字段排序的`username` . 默認為`id` |
| `sort` | string | no | 返回用戶按`asc`或`desc`排列. 默認為`desc` |
| `two_factor` | string | no | 通過兩因素身份驗證過濾用戶. `enabled`或`disabled`過濾器值. 默認情況下,它返回所有用戶 |
| `without_projects` | boolean | no | 過濾沒有項目的用戶. 默認為`false` |
```
[ { "id": 1, "username": "john_smith", "email": "john@example.com", "name": "John Smith", "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/index.jpg", "web_url": "http://localhost:3000/john_smith", "created_at": "2012-05-23T08:00:58Z", "is_admin": false, "bio": null, "bio_html": null, "location": null, "skype": "", "linkedin": "", "twitter": "", "website_url": "", "organization": "", "job_title": "", "last_sign_in_at": "2012-06-01T11:41:01Z", "confirmed_at": "2012-05-23T09:05:22Z", "theme_id": 1, "last_activity_on": "2012-05-23", "color_scheme_id": 2, "projects_limit": 100, "current_sign_in_at": "2012-06-02T06:36:55Z", "note": "DMCA Request: 2018-11-05 | DMCA Violation | Abuse | https://gitlab.zendesk.com/agent/tickets/123", "identities": [ {"provider": "github", "extern_uid": "2435223452345"}, {"provider": "bitbucket", "extern_uid": "john.smith"}, {"provider": "google_oauth2", "extern_uid": "8776128412476123468721346"} ], "can_create_group": true, "can_create_project": true, "two_factor_enabled": true, "external": false, "private_profile": false, "current_sign_in_ip": "196.165.1.102", "last_sign_in_ip": "172.127.2.22" }, { "id": 2, "username": "jack_smith", "email": "jack@example.com", "name": "Jack Smith", "state": "blocked", "avatar_url": "http://localhost:3000/uploads/user/avatar/2/index.jpg", "web_url": "http://localhost:3000/jack_smith", "created_at": "2012-05-23T08:01:01Z", "is_admin": false, "bio": null, "bio_html": null, "location": null, "skype": "", "linkedin": "", "twitter": "", "website_url": "", "organization": "", "job_title": "", "last_sign_in_at": null, "confirmed_at": "2012-05-30T16:53:06.148Z", "theme_id": 1, "last_activity_on": "2012-05-23", "color_scheme_id": 3, "projects_limit": 100, "current_sign_in_at": "2014-03-19T17:54:13Z", "identities": [], "can_create_group": true, "can_create_project": true, "two_factor_enabled": true, "external": false, "private_profile": false, "current_sign_in_ip": "10.165.1.102", "last_sign_in_ip": "172.127.2.22" } ]
```
使用 GitLab [Starter,Bronze 或更高版本的用戶](https://about.gitlab.com/pricing/)還將看到`shared_runners_minutes_limit`和`extra_shared_runners_minutes_limit`參數.
```
[ { "id": 1, ... "shared_runners_minutes_limit": 133, "extra_shared_runners_minutes_limit": 133, ... } ]
```
使用 GitLab [Silver 或更高版本的](https://about.gitlab.com/pricing/)用戶還將看到`group_saml`提供程序選項:
```
[ { "id": 1, ... "identities": [ {"provider": "github", "extern_uid": "2435223452345"}, {"provider": "bitbucket", "extern_uid": "john.smith"}, {"provider": "google_oauth2", "extern_uid": "8776128412476123468721346"}, {"provider": "group_saml", "extern_uid": "123789", "saml_provider_id": 10} ], ... } ]
```
您可以通過外部 UID 和提供程序查找用戶:
```
GET /users?extern_uid=:extern_uid&provider=:provider
```
例如:
```
GET /users?extern_uid=1234567&provider=github
```
您可以使用`/users?external=true`搜索外部`/users?external=true`
您可以使用以下創建日期時間范圍來搜索用戶:
```
GET /users?created_before=2001-01-02T00:00:00.060Z&created_after=1999-01-02T00:00:00.060
```
您可以使用`/users?without_projects=true`搜索沒有項目的`/users?without_projects=true`
您可以使用以下[自定義屬性](custom_attributes.html)進行過濾:
```
GET /users?custom_attributes[key]=value&custom_attributes[other_key]=other_value
```
您可以通過以下方式在響應中包括用戶的[自定義屬性](custom_attributes.html) :
```
GET /users?with_custom_attributes=true
```
## Single user[](#single-user "Permalink")
獲得一個用戶.
### For user[](#for-user "Permalink")
```
GET /users/:id
```
Parameters:
* `id` (必填)-用戶的 ID
```
{ "id": 1, "username": "john_smith", "name": "John Smith", "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg", "web_url": "http://localhost:3000/john_smith", "created_at": "2012-05-23T08:00:58Z", "bio": null, "bio_html": null, "location": null, "public_email": "john@example.com", "skype": "", "linkedin": "", "twitter": "", "website_url": "", "organization": "", "job_title": "Operations Specialist" }
```
### For admin[](#for-admin "Permalink")
```
GET /users/:id
```
Parameters:
* `id` (必填)-用戶的 ID
響應示例:
```
{ "id": 1, "username": "john_smith", "email": "john@example.com", "name": "John Smith", "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/index.jpg", "web_url": "http://localhost:3000/john_smith", "created_at": "2012-05-23T08:00:58Z", "is_admin": false, "bio": null, "bio_html": null, "location": null, "public_email": "john@example.com", "skype": "", "linkedin": "", "twitter": "", "website_url": "", "organization": "", "job_title": "Operations Specialist", "last_sign_in_at": "2012-06-01T11:41:01Z", "confirmed_at": "2012-05-23T09:05:22Z", "theme_id": 1, "last_activity_on": "2012-05-23", "color_scheme_id": 2, "projects_limit": 100, "current_sign_in_at": "2012-06-02T06:36:55Z", "note": "DMCA Request: 2018-11-05 | DMCA Violation | Abuse | https://gitlab.zendesk.com/agent/tickets/123", "identities": [ {"provider": "github", "extern_uid": "2435223452345"}, {"provider": "bitbucket", "extern_uid": "john.smith"}, {"provider": "google_oauth2", "extern_uid": "8776128412476123468721346"} ], "can_create_group": true, "can_create_project": true, "two_factor_enabled": true, "external": false, "private_profile": false, "current_sign_in_ip": "196.165.1.102", "last_sign_in_ip": "172.127.2.22", "plan": "gold", "trial": true }
```
**注意:** `plan`和`trial`參數僅在 GitLab 企業版上可用.
使用 GitLab [Starter,Bronze 或更高版本的用戶](https://about.gitlab.com/pricing/)還將看到`shared_runners_minutes_limit`和`extra_shared_runners_minutes_limit`參數.
```
{ "id": 1, "username": "john_smith", "shared_runners_minutes_limit": 133, "extra_shared_runners_minutes_limit": 133, ... }
```
GitLab.com [Silver 或更高版本](https://about.gitlab.com/pricing/)上的用戶還將看到`group_saml`選項:
```
{ "id": 1, "username": "john_smith", "shared_runners_minutes_limit": 133, "extra_shared_runners_minutes_limit": 133, "identities": [ {"provider": "github", "extern_uid": "2435223452345"}, {"provider": "bitbucket", "extern_uid": "john.smith"}, {"provider": "google_oauth2", "extern_uid": "8776128412476123468721346"}, {"provider": "group_saml", "extern_uid": "123789", "saml_provider_id": 10} ], ... }
```
您可以通過以下方式在響應中包括用戶的[自定義屬性](custom_attributes.html) :
```
GET /users/:id?with_custom_attributes=true
```
## User creation[](#user-creation "Permalink")
Creates a new user. Note only administrators can create new users. Either `password`, `reset_password`, or `force_random_password` must be specified. If `reset_password` and `force_random_password` are both `false`, then `password` is required.
請注意, `force_random_password`和`reset_password`優先級高于`password` . 此外, `reset_password`和`force_random_password`可以一起使用.
**注意:**從[GitLab 12.1 開始](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/29888/) , `private_profile`將默認為`false` .
```
POST /users
```
Parameters:
| Attribute | Required | Description |
| --- | --- | --- |
| `admin` | No | 用戶是管理員-正確或錯誤(默認) |
| `avatar` | No | 用戶頭像的圖像文件 |
| `bio` | No | 用戶的傳記 |
| `can_create_group` | No | 用戶可以創建組-正確或錯誤 |
| `color_scheme_id` | No | 用戶針對文件查看器的配色方案(有關更多信息,請參見[用戶首選項文檔](../user/profile/preferences.html#syntax-highlighting-theme) ) |
| `email` | Yes | Email |
| `extern_uid` | No | 外部 UID |
| `external` | No | 將用戶標記為外部用戶-true 或 false(默認) |
| `extra_shared_runners_minutes_limit` | No | 該用戶的額外管道分鐘配額(在計劃中包括的分鐘之外購買) |
| `force_random_password` | No | 將用戶密碼設置為隨機值-正確或錯誤(默認) |
| `group_id_for_saml` | No | 已配置 SAML 的組的 ID |
| `linkedin` | No | LinkedIn |
| `location` | No | 用戶位置 |
| `name` | Yes | Name |
| `note` | No | 該用戶的管理說明 |
| `organization` | No | 機構名稱 |
| `password` | No | Password |
| `private_profile` | No | 用戶的個人資料是私有的-true,false(默認)或 null(將轉換為 false) |
| `projects_limit` | No | 用戶可以創建的項目數 |
| `provider` | No | 外部提供商名稱 |
| `public_email` | No | 用戶的公開電子郵件 |
| `reset_password` | No | 發送用戶密碼重置鏈接-正確或錯誤(默認) |
| `shared_runners_minutes_limit` | No | 該用戶的管道分鐘配額(包括在計劃中). 可以為`nil` (默認值;繼承系統默認值), `0` (無限制)或`> 0` |
| `skip_confirmation` | No | 跳過確認-正確或錯誤(默認) |
| `skype` | No | Skype 帳號 |
| `theme_id` | No | 用戶的 GitLab 主題(有關更多信息,請參見[用戶首選項文檔](../user/profile/preferences.html#navigation-theme) ) |
| `twitter` | No | Twitter 賬號 |
| `username` | Yes | Username |
| `website_url` | No | 網址 |
## User modification[](#user-modification "Permalink")
修改現有用戶. 只有管??理員可以更改用戶的屬性.
```
PUT /users/:id
```
Parameters:
| Attribute | Required | Description |
| --- | --- | --- |
| `admin` | No | 用戶是管理員-正確或錯誤(默認) |
| `avatar` | No | 用戶頭像的圖像文件 |
| `bio` | No | 用戶的傳記 |
| `can_create_group` | No | 用戶可以創建組-正確或錯誤 |
| `color_scheme_id` | No | 用戶針對文件查看器的配色方案(有關更多信息,請參見[用戶首選項文檔](../user/profile/preferences.html#syntax-highlighting-theme) ) |
| `email` | No | Email |
| `extern_uid` | No | 外部 UID |
| `external` | No | 將用戶標記為外部用戶-true 或 false(默認) |
| `extra_shared_runners_minutes_limit` | No | 該用戶的額外管道分鐘配額(在計劃中包括的分鐘之外購買) |
| `group_id_for_saml` | No | 已配置 SAML 的組的 ID |
| `id` | Yes | 用戶的 ID |
| `linkedin` | No | LinkedIn |
| `location` | No | 用戶位置 |
| `name` | No | Name |
| `note` | No | 該用戶的管理說明 |
| `organization` | No | 機構名稱 |
| `password` | No | Password |
| `private_profile` | No | 用戶的個人資料是私有的-true,false(默認)或 null(將轉換為 false) |
| `projects_limit` | No | 限制每個用戶可以創建的項目 |
| `provider` | No | 外部提供商名稱 |
| `public_email` | No | 用戶的公開電子郵件 |
| `shared_runners_minutes_limit` | No | 該用戶的管道分鐘配額(包括在計劃中). 可以為`nil` (默認值;繼承系統默認值), `0` (無限制)或`> 0` |
| `skip_reconfirmation` | No | 跳過確認-正確或錯誤(默認) |
| `skype` | No | Skype 帳號 |
| `theme_id` | No | 用戶的 GitLab 主題(有關更多信息,請參見[用戶首選項文檔](../user/profile/preferences.html#navigation-theme) ) |
| `twitter` | No | Twitter 賬號 |
| `username` | No | Username |
| `website_url` | No | 網址 |
密碼更新時,用戶將被迫在下次登錄時進行更改. 請注意,此方法目前僅返回`404`錯誤,即使在`409` (沖突)更為合適的情況下也是如此. 例如,將電子郵件地址重命名為某個現有地址時.
## Delete authentication identity from user[](#delete-authentication-identity-from-user "Permalink")
使用與該身份關聯的提供者名稱刪除用戶的身份驗證身份. 僅適用于管理員.
```
DELETE /users/:id/identities/:provider
```
Parameters:
* `id` (必填)-用戶的 ID
* `provider` (必填)-外部提供程序名稱
## User deletion[](#user-deletion "Permalink")
刪除用戶. 僅適用于管理員. 如果操作成功,則返回`204 No Content`狀態代碼;如果找不到資源,則返回`404`如果無法軟刪除用戶,則返回`409` .
```
DELETE /users/:id
```
Parameters:
* `id` (必填)-用戶的 ID
* `hard_delete` (可選)-如果為 true,則通常會[移至](../user/profile/account/delete_account.html#associated-records) `hard_delete` [用戶的](../user/profile/account/delete_account.html#associated-records)貢獻以及該用戶`hard_delete`組將被刪除.
## List current user (for normal users)[](#list-current-user-for-normal-users "Permalink")
獲取當前經過身份驗證的用戶.
```
GET /user
```
```
{ "id": 1, "username": "john_smith", "email": "john@example.com", "name": "John Smith", "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/index.jpg", "web_url": "http://localhost:3000/john_smith", "created_at": "2012-05-23T08:00:58Z", "bio": null, "bio_html": null, "location": null, "public_email": "john@example.com", "skype": "", "linkedin": "", "twitter": "", "website_url": "", "organization": "", "last_sign_in_at": "2012-06-01T11:41:01Z", "confirmed_at": "2012-05-23T09:05:22Z", "theme_id": 1, "last_activity_on": "2012-05-23", "color_scheme_id": 2, "projects_limit": 100, "current_sign_in_at": "2012-06-02T06:36:55Z", "identities": [ {"provider": "github", "extern_uid": "2435223452345"}, {"provider": "bitbucket", "extern_uid": "john_smith"}, {"provider": "google_oauth2", "extern_uid": "8776128412476123468721346"} ], "can_create_group": true, "can_create_project": true, "two_factor_enabled": true, "external": false, "private_profile": false }
```
## List current user (for admins)[](#list-current-user-for-admins "Permalink")
Parameters:
* `sudo` (可選)-在其位置進行呼叫的用戶的 ID
```
GET /user
```
```
{ "id": 1, "username": "john_smith", "email": "john@example.com", "name": "John Smith", "state": "active", "avatar_url": "http://localhost:3000/uploads/user/avatar/1/index.jpg", "web_url": "http://localhost:3000/john_smith", "created_at": "2012-05-23T08:00:58Z", "is_admin": false, "bio": null, "bio_html": null, "location": null, "public_email": "john@example.com", "skype": "", "linkedin": "", "twitter": "", "website_url": "", "organization": "", "job_title": "", "last_sign_in_at": "2012-06-01T11:41:01Z", "confirmed_at": "2012-05-23T09:05:22Z", "theme_id": 1, "last_activity_on": "2012-05-23", "color_scheme_id": 2, "projects_limit": 100, "current_sign_in_at": "2012-06-02T06:36:55Z", "identities": [ {"provider": "github", "extern_uid": "2435223452345"}, {"provider": "bitbucket", "extern_uid": "john_smith"}, {"provider": "google_oauth2", "extern_uid": "8776128412476123468721346"} ], "can_create_group": true, "can_create_project": true, "two_factor_enabled": true, "external": false, "private_profile": false, "current_sign_in_ip": "196.165.1.102", "last_sign_in_ip": "172.127.2.22" }
```
## User status[](#user-status "Permalink")
獲取當前登錄用戶的狀態.
```
GET /user/status
```
```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/user/status"
```
響應示例:
```
{ "emoji":"coffee", "message":"I crave coffee :coffee:", "message_html": "I crave coffee <gl-emoji title=\"hot beverage\" data-name=\"coffee\" data-unicode-version=\"4.0\">?</gl-emoji>" }
```
## Get the status of a user[](#get-the-status-of-a-user "Permalink")
獲取用戶的狀態.
```
GET /users/:id_or_username/status
```
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id_or_username` | string | yes | 用戶的 ID 或用戶名,以獲取狀態 |
```
curl "https://gitlab.example.com/users/janedoe/status"
```
響應示例:
```
{ "emoji":"coffee", "message":"I crave coffee :coffee:", "message_html": "I crave coffee <gl-emoji title=\"hot beverage\" data-name=\"coffee\" data-unicode-version=\"4.0\">?</gl-emoji>" }
```
## Set user status[](#set-user-status "Permalink")
設置當前用戶的狀態.
```
PUT /user/status
```
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `emoji` | string | no | 用作狀態的表情符號名稱. 如果省略,則使用`speech_balloon` . 表情符號名稱可以是[Gemojione 索引中](https://github.com/bonusly/gemojione/blob/master/config/index.json)指定的名稱之一. |
| `message` | string | no | 設置為狀態的消息. 它還可以包含表情符號代碼. |
當參數`emoji`和`message`都為空時,狀態將被清除.
```
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" --data "emoji=coffee" --data "message=I crave coffee" "https://gitlab.example.com/api/v4/user/status"
```
回應范例
```
{ "emoji":"coffee", "message":"I crave coffee", "message_html": "I crave coffee" }
```
## User counts[](#user-counts "Permalink")
獲取當前登錄用戶的計數(與右上角菜單相同).
| Attribute | Type | Description |
| --- | --- | --- |
| `merge_requests` | number | 合并活動的請求并分配給當前用戶. |
```
GET /user_counts
```
```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/user_counts"
```
響應示例:
```
{ "merge_requests": 4 }
```
## List user projects[](#list-user-projects "Permalink")
請參考[用戶項目列表](projects.html#list-user-projects) .
## List SSH keys[](#list-ssh-keys "Permalink")
獲取當前經過身份驗證的用戶的 SSH 密鑰的列表.
```
GET /user/keys
```
```
[ { "id": 1, "title": "Public key", "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=", "created_at": "2014-08-01T14:47:39.080Z" }, { "id": 3, "title": "Another Public key", "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=", "created_at": "2014-08-01T14:47:39.080Z" } ]
```
Parameters:
* **none**
## List SSH keys for user[](#list-ssh-keys-for-user "Permalink")
獲取指定用戶的 SSH 密鑰的列表.
```
GET /users/:id_or_username/keys
```
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id_or_username` | string | yes | 要為其獲取 SSH 密鑰的用戶的 ID 或用戶名. |
## Single SSH key[](#single-ssh-key "Permalink")
獲取一個密鑰.
```
GET /user/keys/:key_id
```
Parameters:
* `key_id` (必填) `key_id`密鑰的 ID
```
{ "id": 1, "title": "Public key", "key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=", "created_at": "2014-08-01T14:47:39.080Z" }
```
## Add SSH key[](#add-ssh-key "Permalink")
創建當前經過身份驗證的用戶擁有的新密鑰.
```
POST /user/keys
```
Parameters:
* `title` (必填)-新的 SSH 密鑰的標題
* `key` (必填)-新的 SSH 密鑰
* `expires_at` (可選)-ISO 8601 格式的 SSH 密鑰的到期日期( `YYYY-MM-DDTHH:MM:SSZ` )
```
{ "title": "ABC", "key": "ssh-dss AAAAB3NzaC1kc3MAAACBAMLrhYgI3atfrSD6KDas1b/3n6R/HP+bLaHHX6oh+L1vg31mdUqK0Ac/NjZoQunavoyzqdPYhFz9zzOezCrZKjuJDS3NRK9rspvjgM0xYR4d47oNZbdZbwkI4cTv/gcMlquRy0OvpfIvJtjtaJWMwTLtM5VhRusRuUlpH99UUVeXAAAAFQCVyX+92hBEjInEKL0v13c/egDCTQAAAIEAvFdWGq0ccOPbw4f/F8LpZqvWDydAcpXHV3thwb7WkFfppvm4SZte0zds1FJ+Hr8Xzzc5zMHe6J4Nlay/rP4ewmIW7iFKNBEYb/yWa+ceLrs+TfR672TaAgO6o7iSRofEq5YLdwgrwkMmIawa21FrZ2D9SPao/IwvENzk/xcHu7YAAACAQFXQH6HQnxOrw4dqf0NqeKy1tfIPxYYUZhPJfo9O0AmBW2S36pD2l14kS89fvz6Y1g8gN/FwFnRncMzlLY/hX70FSc/3hKBSbH6C6j8hwlgFKfizav21eS358JJz93leOakJZnGb8XlWvz1UJbwCsnR2VEY8Dz90uIk1l/UqHkA= loic@call", "expires_at": "2016-01-21T00:00:00.000Z" }
```
將返回狀態為`201 Created`成功的已創建密鑰. 如果發生錯誤,則會返回`400 Bad Request` ,并附有一條解釋該錯誤的消息:
```
{ "message": { "fingerprint": [ "has already been taken" ], "key": [ "has already been taken" ] } }
```
## Add SSH key for user[](#add-ssh-key-for-user "Permalink")
創建指定用戶擁有的新密鑰. 僅適用于管理員
```
POST /users/:id/keys
```
Parameters:
* `id` (必填)-指定用戶的 ID
* `title` (必填)-新的 SSH 密鑰的標題
* `key` (必填)-新的 SSH 密鑰
* `expires_at` (可選)-ISO 8601 格式的 SSH 密鑰的到期日期( `YYYY-MM-DDTHH:MM:SSZ` )
**注意:**這還會添加一個審核事件,如[審核實例事件中所述](../administration/audit_events.html#instance-events-premium-only) .
## Delete SSH key for current user[](#delete-ssh-key-for-current-user "Permalink")
刪除當前經過身份驗證的用戶擁有的密鑰. 如果操作成功,則返回`204 No Content`狀態代碼;如果找不到資源,則返回`404` .
```
DELETE /user/keys/:key_id
```
Parameters:
* `key_id` (必填) `key_id`密鑰 ID
## Delete SSH key for given user[](#delete-ssh-key-for-given-user "Permalink")
刪除指定用戶擁有的密鑰. 僅適用于管理員.
```
DELETE /users/:id/keys/:key_id
```
Parameters:
* `id` (必填)-指定用戶的 ID
* `key_id` (必填) `key_id`密鑰 ID
## List all GPG keys[](#list-all-gpg-keys "Permalink")
獲取當前已驗證用戶的 GPG 密鑰的列表.
```
GET /user/gpg_keys
```
```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/user/gpg_keys"
```
響應示例:
```
[ { "id": 1, "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFVjnlIBCACibzXOLCiZiL2oyzYUaTOCkYnSUhymg3pdbfKtd4mpBa58xKBj\r\nt1pTHVpw3Sk03wmzhM/Ndlt1AV2YhLv++83WKr+gAHFYFiCV/tnY8bx3HqvVoy8O\r\nCfxWhw4QZK7+oYzVmJj8ZJm3ZjOC4pzuegNWlNLCUdZDx9OKlHVXLCX1iUbjdYWa\r\nqKV6tdV8hZolkbyjedQgrpvoWyeSHHpwHF7yk4gNJWMMI5rpcssL7i6mMXb/sDzO\r\nVaAtU5wiVducsOa01InRFf7QSTxoAm6Xy0PGv/k48M6xCALa9nY+BzlOv47jUT57\r\nvilf4Szy9dKD0v9S0mQ+IHB+gNukWrnwtXx5ABEBAAHNFm5hbWUgKGNvbW1lbnQp\r\nIDxlbUBpbD7CwHUEEwECACkFAlVjnlIJEINgJNgv009/AhsDAhkBBgsJCAcDAgYV\r\nCAIJCgsEFgIDAQAAxqMIAFBHuBA8P1v8DtHonIK8Lx2qU23t8Mh68HBIkSjk2H7/\r\noO2cDWCw50jZ9D91PXOOyMPvBWV2IE3tARzCvnNGtzEFRtpIEtZ0cuctxeIF1id5\r\ncrfzdMDsmZyRHAOoZ9VtuD6mzj0ybQWMACb7eIHjZDCee3Slh3TVrLy06YRdq2I4\r\nbjMOPePtK5xnIpHGpAXkB3IONxyITpSLKsA4hCeP7gVvm7r7TuQg1ygiUBlWbBYn\r\niE5ROzqZjG1s7dQNZK/riiU2umGqGuwAb2IPvNiyuGR3cIgRE4llXH/rLuUlspAp\r\no4nlxaz65VucmNbN1aMbDXLJVSqR1DuE00vEsL1AItI=\r\n=XQoy\r\n-----END PGP PUBLIC KEY BLOCK-----", "created_at": "2017-09-05T09:17:46.264Z" } ]
```
## Get a specific GPG key[](#get-a-specific-gpg-key "Permalink")
獲取當前已認證用戶的特定 GPG 密鑰.
```
GET /user/gpg_keys/:key_id
```
Parameters:
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `key_id` | integer | yes | GPG 密鑰的 ID |
```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/user/gpg_keys/1"
```
響應示例:
```
{ "id": 1, "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFVjnlIBCACibzXOLCiZiL2oyzYUaTOCkYnSUhymg3pdbfKtd4mpBa58xKBj\r\nt1pTHVpw3Sk03wmzhM/Ndlt1AV2YhLv++83WKr+gAHFYFiCV/tnY8bx3HqvVoy8O\r\nCfxWhw4QZK7+oYzVmJj8ZJm3ZjOC4pzuegNWlNLCUdZDx9OKlHVXLCX1iUbjdYWa\r\nqKV6tdV8hZolkbyjedQgrpvoWyeSHHpwHF7yk4gNJWMMI5rpcssL7i6mMXb/sDzO\r\nVaAtU5wiVducsOa01InRFf7QSTxoAm6Xy0PGv/k48M6xCALa9nY+BzlOv47jUT57\r\nvilf4Szy9dKD0v9S0mQ+IHB+gNukWrnwtXx5ABEBAAHNFm5hbWUgKGNvbW1lbnQp\r\nIDxlbUBpbD7CwHUEEwECACkFAlVjnlIJEINgJNgv009/AhsDAhkBBgsJCAcDAgYV\r\nCAIJCgsEFgIDAQAAxqMIAFBHuBA8P1v8DtHonIK8Lx2qU23t8Mh68HBIkSjk2H7/\r\noO2cDWCw50jZ9D91PXOOyMPvBWV2IE3tARzCvnNGtzEFRtpIEtZ0cuctxeIF1id5\r\ncrfzdMDsmZyRHAOoZ9VtuD6mzj0ybQWMACb7eIHjZDCee3Slh3TVrLy06YRdq2I4\r\nbjMOPePtK5xnIpHGpAXkB3IONxyITpSLKsA4hCeP7gVvm7r7TuQg1ygiUBlWbBYn\r\niE5ROzqZjG1s7dQNZK/riiU2umGqGuwAb2IPvNiyuGR3cIgRE4llXH/rLuUlspAp\r\no4nlxaz65VucmNbN1aMbDXLJVSqR1DuE00vEsL1AItI=\r\n=XQoy\r\n-----END PGP PUBLIC KEY BLOCK-----", "created_at": "2017-09-05T09:17:46.264Z" }
```
## Add a GPG key[](#add-a-gpg-key "Permalink")
創建由當前身份驗證用戶擁有的新 GPG 密鑰.
```
POST /user/gpg_keys
```
Parameters:
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| key | string | yes | 新的 GPG 密鑰 |
```
curl --data "key=-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFV..." --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/user/gpg_keys"
```
響應示例:
```
[ { "id": 1, "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFVjnlIBCACibzXOLCiZiL2oyzYUaTOCkYnSUhymg3pdbfKtd4mpBa58xKBj\r\nt1pTHVpw3Sk03wmzhM/Ndlt1AV2YhLv++83WKr+gAHFYFiCV/tnY8bx3HqvVoy8O\r\nCfxWhw4QZK7+oYzVmJj8ZJm3ZjOC4pzuegNWlNLCUdZDx9OKlHVXLCX1iUbjdYWa\r\nqKV6tdV8hZolkbyjedQgrpvoWyeSHHpwHF7yk4gNJWMMI5rpcssL7i6mMXb/sDzO\r\nVaAtU5wiVducsOa01InRFf7QSTxoAm6Xy0PGv/k48M6xCALa9nY+BzlOv47jUT57\r\nvilf4Szy9dKD0v9S0mQ+IHB+gNukWrnwtXx5ABEBAAHNFm5hbWUgKGNvbW1lbnQp\r\nIDxlbUBpbD7CwHUEEwECACkFAlVjnlIJEINgJNgv009/AhsDAhkBBgsJCAcDAgYV\r\nCAIJCgsEFgIDAQAAxqMIAFBHuBA8P1v8DtHonIK8Lx2qU23t8Mh68HBIkSjk2H7/\r\noO2cDWCw50jZ9D91PXOOyMPvBWV2IE3tARzCvnNGtzEFRtpIEtZ0cuctxeIF1id5\r\ncrfzdMDsmZyRHAOoZ9VtuD6mzj0ybQWMACb7eIHjZDCee3Slh3TVrLy06YRdq2I4\r\nbjMOPePtK5xnIpHGpAXkB3IONxyITpSLKsA4hCeP7gVvm7r7TuQg1ygiUBlWbBYn\r\niE5ROzqZjG1s7dQNZK/riiU2umGqGuwAb2IPvNiyuGR3cIgRE4llXH/rLuUlspAp\r\no4nlxaz65VucmNbN1aMbDXLJVSqR1DuE00vEsL1AItI=\r\n=XQoy\r\n-----END PGP PUBLIC KEY BLOCK-----", "created_at": "2017-09-05T09:17:46.264Z" } ]
```
## Delete a GPG key[](#delete-a-gpg-key "Permalink")
刪除當前經過身份驗證的用戶擁有的 GPG 密鑰.
```
DELETE /user/gpg_keys/:key_id
```
Parameters:
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `key_id` | integer | yes | GPG 密鑰的 ID |
```
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/user/gpg_keys/1"
```
成功時返回`204 No Content` ,如果`404 Not found`密鑰,則返回`404 Not found` found.
## List all GPG keys for given user[](#list-all-gpg-keys-for-given-user "Permalink")
獲取指定用戶的 GPG 密鑰的列表. 僅適用于管理員.
```
GET /users/:id/gpg_keys
```
Parameters:
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer | yes | 用戶的 ID |
```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/2/gpg_keys"
```
響應示例:
```
[ { "id": 1, "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFVjnlIBCACibzXOLCiZiL2oyzYUaTOCkYnSUhymg3pdbfKtd4mpBa58xKBj\r\nt1pTHVpw3Sk03wmzhM/Ndlt1AV2YhLv++83WKr+gAHFYFiCV/tnY8bx3HqvVoy8O\r\nCfxWhw4QZK7+oYzVmJj8ZJm3ZjOC4pzuegNWlNLCUdZDx9OKlHVXLCX1iUbjdYWa\r\nqKV6tdV8hZolkbyjedQgrpvoWyeSHHpwHF7yk4gNJWMMI5rpcssL7i6mMXb/sDzO\r\nVaAtU5wiVducsOa01InRFf7QSTxoAm6Xy0PGv/k48M6xCALa9nY+BzlOv47jUT57\r\nvilf4Szy9dKD0v9S0mQ+IHB+gNukWrnwtXx5ABEBAAHNFm5hbWUgKGNvbW1lbnQp\r\nIDxlbUBpbD7CwHUEEwECACkFAlVjnlIJEINgJNgv009/AhsDAhkBBgsJCAcDAgYV\r\nCAIJCgsEFgIDAQAAxqMIAFBHuBA8P1v8DtHonIK8Lx2qU23t8Mh68HBIkSjk2H7/\r\noO2cDWCw50jZ9D91PXOOyMPvBWV2IE3tARzCvnNGtzEFRtpIEtZ0cuctxeIF1id5\r\ncrfzdMDsmZyRHAOoZ9VtuD6mzj0ybQWMACb7eIHjZDCee3Slh3TVrLy06YRdq2I4\r\nbjMOPePtK5xnIpHGpAXkB3IONxyITpSLKsA4hCeP7gVvm7r7TuQg1ygiUBlWbBYn\r\niE5ROzqZjG1s7dQNZK/riiU2umGqGuwAb2IPvNiyuGR3cIgRE4llXH/rLuUlspAp\r\no4nlxaz65VucmNbN1aMbDXLJVSqR1DuE00vEsL1AItI=\r\n=XQoy\r\n-----END PGP PUBLIC KEY BLOCK-----", "created_at": "2017-09-05T09:17:46.264Z" } ]
```
## Get a specific GPG key for a given user[](#get-a-specific-gpg-key-for-a-given-user "Permalink")
獲取給定用戶的特定 GPG 密鑰. 僅適用于管理員.
```
GET /users/:id/gpg_keys/:key_id
```
Parameters:
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer | yes | 用戶的 ID |
| `key_id` | integer | yes | GPG 密鑰的 ID |
```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/2/gpg_keys/1"
```
響應示例:
```
{ "id": 1, "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFVjnlIBCACibzXOLCiZiL2oyzYUaTOCkYnSUhymg3pdbfKtd4mpBa58xKBj\r\nt1pTHVpw3Sk03wmzhM/Ndlt1AV2YhLv++83WKr+gAHFYFiCV/tnY8bx3HqvVoy8O\r\nCfxWhw4QZK7+oYzVmJj8ZJm3ZjOC4pzuegNWlNLCUdZDx9OKlHVXLCX1iUbjdYWa\r\nqKV6tdV8hZolkbyjedQgrpvoWyeSHHpwHF7yk4gNJWMMI5rpcssL7i6mMXb/sDzO\r\nVaAtU5wiVducsOa01InRFf7QSTxoAm6Xy0PGv/k48M6xCALa9nY+BzlOv47jUT57\r\nvilf4Szy9dKD0v9S0mQ+IHB+gNukWrnwtXx5ABEBAAHNFm5hbWUgKGNvbW1lbnQp\r\nIDxlbUBpbD7CwHUEEwECACkFAlVjnlIJEINgJNgv009/AhsDAhkBBgsJCAcDAgYV\r\nCAIJCgsEFgIDAQAAxqMIAFBHuBA8P1v8DtHonIK8Lx2qU23t8Mh68HBIkSjk2H7/\r\noO2cDWCw50jZ9D91PXOOyMPvBWV2IE3tARzCvnNGtzEFRtpIEtZ0cuctxeIF1id5\r\ncrfzdMDsmZyRHAOoZ9VtuD6mzj0ybQWMACb7eIHjZDCee3Slh3TVrLy06YRdq2I4\r\nbjMOPePtK5xnIpHGpAXkB3IONxyITpSLKsA4hCeP7gVvm7r7TuQg1ygiUBlWbBYn\r\niE5ROzqZjG1s7dQNZK/riiU2umGqGuwAb2IPvNiyuGR3cIgRE4llXH/rLuUlspAp\r\no4nlxaz65VucmNbN1aMbDXLJVSqR1DuE00vEsL1AItI=\r\n=XQoy\r\n-----END PGP PUBLIC KEY BLOCK-----", "created_at": "2017-09-05T09:17:46.264Z" }
```
## Add a GPG key for a given user[](#add-a-gpg-key-for-a-given-user "Permalink")
創建指定用戶擁有的新 GPG 密鑰. 僅適用于管理員.
```
POST /users/:id/gpg_keys
```
Parameters:
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer | yes | 用戶的 ID |
| `key_id` | integer | yes | GPG 密鑰的 ID |
```
curl --data "key=-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFV..." --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/2/gpg_keys"
```
響應示例:
```
[ { "id": 1, "key": "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFVjnlIBCACibzXOLCiZiL2oyzYUaTOCkYnSUhymg3pdbfKtd4mpBa58xKBj\r\nt1pTHVpw3Sk03wmzhM/Ndlt1AV2YhLv++83WKr+gAHFYFiCV/tnY8bx3HqvVoy8O\r\nCfxWhw4QZK7+oYzVmJj8ZJm3ZjOC4pzuegNWlNLCUdZDx9OKlHVXLCX1iUbjdYWa\r\nqKV6tdV8hZolkbyjedQgrpvoWyeSHHpwHF7yk4gNJWMMI5rpcssL7i6mMXb/sDzO\r\nVaAtU5wiVducsOa01InRFf7QSTxoAm6Xy0PGv/k48M6xCALa9nY+BzlOv47jUT57\r\nvilf4Szy9dKD0v9S0mQ+IHB+gNukWrnwtXx5ABEBAAHNFm5hbWUgKGNvbW1lbnQp\r\nIDxlbUBpbD7CwHUEEwECACkFAlVjnlIJEINgJNgv009/AhsDAhkBBgsJCAcDAgYV\r\nCAIJCgsEFgIDAQAAxqMIAFBHuBA8P1v8DtHonIK8Lx2qU23t8Mh68HBIkSjk2H7/\r\noO2cDWCw50jZ9D91PXOOyMPvBWV2IE3tARzCvnNGtzEFRtpIEtZ0cuctxeIF1id5\r\ncrfzdMDsmZyRHAOoZ9VtuD6mzj0ybQWMACb7eIHjZDCee3Slh3TVrLy06YRdq2I4\r\nbjMOPePtK5xnIpHGpAXkB3IONxyITpSLKsA4hCeP7gVvm7r7TuQg1ygiUBlWbBYn\r\niE5ROzqZjG1s7dQNZK/riiU2umGqGuwAb2IPvNiyuGR3cIgRE4llXH/rLuUlspAp\r\no4nlxaz65VucmNbN1aMbDXLJVSqR1DuE00vEsL1AItI=\r\n=XQoy\r\n-----END PGP PUBLIC KEY BLOCK-----", "created_at": "2017-09-05T09:17:46.264Z" } ]
```
## Delete a GPG key for a given user[](#delete-a-gpg-key-for-a-given-user "Permalink")
刪除指定用戶擁有的 GPG 密鑰. 僅適用于管理員.
```
DELETE /users/:id/gpg_keys/:key_id
```
Parameters:
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer | yes | 用戶的 ID |
| `key_id` | integer | yes | The ID of the GPG key |
```
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/2/gpg_keys/1"
```
## List emails[](#list-emails "Permalink")
獲取當前經過身份驗證的用戶電子郵件列表.
```
GET /user/emails
```
```
[ { "id": 1, "email": "email@example.com" }, { "id": 3, "email": "email2@example.com" } ]
```
Parameters:
* **none**
## List emails for user[](#list-emails-for-user "Permalink")
獲取指定用戶的電子郵件列表. 僅適用于管理員
```
GET /users/:id/emails
```
Parameters:
* `id` (必填)-指定用戶的 ID
## Single email[](#single-email "Permalink")
收到一封電子郵件.
```
GET /user/emails/:email_id
```
Parameters:
* `email_id` (必填)-電子郵件 ID
```
{ "id": 1, "email": "email@example.com" }
```
## Add email[](#add-email "Permalink")
創建由當前身份驗證用戶擁有的新電子郵件.
```
POST /user/emails
```
Parameters:
* `email` (必填)-電子郵件地址
```
{ "id": 4, "email": "email@example.com" }
```
將返回狀態為`201 Created`成功的已創建電子郵件. 如果發生錯誤,則會返回`400 Bad Request` ,并附有一條解釋該錯誤的消息:
```
{ "message": { "email": [ "has already been taken" ] } }
```
## Add email for user[](#add-email-for-user "Permalink")
創建指定用戶擁有的新電子郵件. 僅適用于管理員
```
POST /users/:id/emails
```
Parameters:
* `id` (必填)-指定用戶的 ID
* `email` (必填)-電子郵件地址
* `skip_confirmation` (可選)-跳過確認并假定電子郵件已通過驗證`skip_confirmation`或 false(默認)
## Delete email for current user[](#delete-email-for-current-user "Permalink")
刪除當前經過身份驗證的用戶擁有的電子郵件. 如果操作成功,則返回`204 No Content`狀態代碼;如果找不到資源,則返回`404` .
```
DELETE /user/emails/:email_id
```
Parameters:
* `email_id` (必填)-電子郵件 ID
## Delete email for given user[](#delete-email-for-given-user "Permalink")
刪除指定用戶擁有的電子郵件. 僅適用于管理員.
```
DELETE /users/:id/emails/:email_id
```
Parameters:
* `id` (必填)-指定用戶的 ID
* `email_id` (必填)-電子郵件 ID
## Block user[](#block-user "Permalink")
阻止指定的用戶. 僅適用于管理員.
```
POST /users/:id/block
```
Parameters:
* `id` (必填)-指定用戶的 ID
Returns:
* `201 OK`成功成功.
* `404 User Not Found`如果`404 User Not Found`用戶,則`404 User Not Found`用戶.
* `403 Forbidden`嘗試通過 LDAP 同步阻止已阻止的用戶時禁止.
## Unblock user[](#unblock-user "Permalink")
取消阻止指定的用戶. 僅適用于管理員.
```
POST /users/:id/unblock
```
Parameters:
* `id` (必填)-指定用戶的 ID
嘗試取消阻止被 LDAP 同步阻止的用戶時,成功返回`201 OK` ,成功返回`404 User Not Found`或`403 Forbidden` .
## Deactivate user[](#deactivate-user "Permalink")
在 GitLab 12.4 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/22257) .
停用指定的用戶. 僅適用于管理員.
```
POST /users/:id/deactivate
```
Parameters:
* `id` (必填)-指定用戶的 ID
Returns:
* `201 OK`成功成功.
* `404 User Not Found`如果`404 User Not Found`用戶,則`404 User Not Found`用戶.
* `403 Forbidden`嘗試停用用戶時被禁止:
* 被管理員或 LDAP 同步阻止.
* 在過去 180 天內沒有任何活動. 這些用戶無法停用.
## Activate user[](#activate-user "Permalink")
在 GitLab 12.4 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/22257) .
激活指定的用戶. 僅適用于管理員.
```
POST /users/:id/activate
```
Parameters:
* `id` (必填)-指定用戶的 ID
Returns:
* `201 OK`成功成功.
* `404 User Not Found`如果`404 User Not Found`用戶,則`404 User Not Found`用戶.
* `403 Forbidden`嘗試激活被管理員或 LDAP 同步阻止的用戶時禁止.
### Get user contribution events[](#get-user-contribution-events "Permalink")
請參閱[事件 API 文檔](events.html#get-user-contribution-events)
## Get all impersonation tokens of a user[](#get-all-impersonation-tokens-of-a-user "Permalink")
> 需要管理員權限.
它檢索用戶的每個模擬令牌. 使用分頁參數`page`和`per_page`可以限制模擬令牌的列表.
```
GET /users/:user_id/impersonation_tokens
```
Parameters:
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `user_id` | integer | yes | 用戶的 ID |
| `state` | string | no | 根據狀態( `all` , `active` , `inactive` )過濾令牌 |
```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/42/impersonation_tokens"
```
響應示例:
```
[ { "active" : true, "scopes" : [ "api" ], "revoked" : false, "name" : "mytoken", "id" : 2, "created_at" : "2017-03-17T17:18:09.283Z", "impersonation" : true, "expires_at" : "2017-04-04" }, { "active" : false, "scopes" : [ "read_user" ], "revoked" : true, "name" : "mytoken2", "created_at" : "2017-03-17T17:19:28.697Z", "id" : 3, "impersonation" : true, "expires_at" : "2017-04-14" } ]
```
## Get an impersonation token of a user[](#get-an-impersonation-token-of-a-user "Permalink")
> 需要管理員權限.
它顯示了用戶的模擬令牌.
```
GET /users/:user_id/impersonation_tokens/:impersonation_token_id
```
Parameters:
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `user_id` | integer | yes | 用戶的 ID |
| `impersonation_token_id` | integer | yes | 模擬令牌的 ID |
```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/42/impersonation_tokens/2"
```
響應示例:
```
{ "active" : true, "scopes" : [ "api" ], "revoked" : false, "name" : "mytoken", "id" : 2, "created_at" : "2017-03-17T17:18:09.283Z", "impersonation" : true, "expires_at" : "2017-04-04" }
```
## Create an impersonation token[](#create-an-impersonation-token "Permalink")
> 需要管理員權限. 令牌值返回一次. 確保將其保存-您將無法再次訪問它.
它創建一個新的模擬令牌. 請注意,只有管理員可以執行此操作. 您只能創建模擬令牌來模擬用戶,并執行 API 調用和 Git 讀寫. 用戶將不會在其個人資料設置頁面中看到這些令牌.
```
POST /users/:user_id/impersonation_tokens
```
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `user_id` | integer | yes | 用戶的 ID |
| `name` | string | yes | 模擬令牌的名稱 |
| `expires_at` | date | no | ISO 格式( `YYYY-MM-DD` )的模擬令牌的到期日期 |
| `scopes` | array | yes | 模擬令牌作用域的數組( `api` , `read_user` ) |
```
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --data "name=mytoken" --data "expires_at=2017-04-04" --data "scopes[]=api" "https://gitlab.example.com/api/v4/users/42/impersonation_tokens"
```
響應示例:
```
{ "id" : 2, "revoked" : false, "scopes" : [ "api" ], "token" : "EsMo-vhKfXGwX9RKrwiy", "active" : true, "impersonation" : true, "name" : "mytoken", "created_at" : "2017-03-17T17:18:09.283Z", "expires_at" : "2017-04-04" }
```
## Revoke an impersonation token[](#revoke-an-impersonation-token "Permalink")
> 需要管理員權限.
它撤銷模擬令牌.
```
DELETE /users/:user_id/impersonation_tokens/:impersonation_token_id
```
```
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/42/impersonation_tokens/1"
```
Parameters:
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `user_id` | integer | yes | 用戶的 ID |
| `impersonation_token_id` | integer | yes | 模擬令牌的 ID |
### Get user activities (admin only)[](#get-user-activities-admin-only "Permalink")
**注意:**此 API 端點僅在 8.15(EE)和 9.1(CE)及更高版本上可用.
獲取所有用戶的上次活動日期,從最舊到最新.
更新時間戳記的活動是:
* Git HTTP / SSH 活動(例如克隆,推送)
* 用戶登錄 GitLab
* 與儀表板,項目,問題和合并請求相關的用戶訪問頁面(在 GitLab 11.8 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/54947) )
* 用戶使用 API
* 用戶使用 GraphQL API
默認情況下,它顯示最近 6 個月內所有用戶的活動,但是可以使用`from`參數進行修改.
```
GET /user/activities
```
Parameters:
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | string | no | 日期字符串,格式為 YEAR-MONTH-DAY. 例如, `2016-03-11` . 默認為 6 個月前. |
```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/user/activities"
```
響應示例:
```
[ { "username": "user1", "last_activity_on": "2015-12-14", "last_activity_at": "2015-12-14" }, { "username": "user2", "last_activity_on": "2015-12-15", "last_activity_at": "2015-12-15" }, { "username": "user3", "last_activity_on": "2015-12-16", "last_activity_at": "2015-12-16" } ]
```
請注意, `last_activity_at`已過時,請使用`last_activity_on` .
## User memberships (admin only)[](#user-memberships-admin-only "Permalink")
在 GitLab 12.8 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/20532) .
列出用戶所屬的所有項目和組. 該端點僅適用于管理員. 它返回成員資格的`source_id` , `source_name` , `source_type`和`access_level` . 源可以是`Namespace` (代表一個組)或`Project` . 響應僅代表直接成員身份. 不包括繼承的成員資格,例如在子組中. 訪問級別由整數值表示. 有關更多詳細信息,請閱讀有關[訪問級別值](access_requests.html#valid-access-levels)的含義.
```
GET /users/:id/memberships
```
Parameters:
| Attribute | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer | yes | 指定用戶的 ID |
| `type` | string | no | 按類型過濾成員資格. 可以是`Project`或`Namespace` |
Returns:
* `200 OK`成功.
* `404 User Not Found` if user can’t be found.
* `403 Forbidden`管理員未要求時禁止.
* 不支持請求的類型時出現`400 Bad Request` .
```
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/users/:user_id/memberships"
```
響應示例:
```
[ { "source_id": 1, "source_name": "Project one", "source_type": "Project", "access_level": "20" }, { "source_id": 3, "source_name": "Group three", "source_type": "Namespace", "access_level": "20" }, ]
```
- GitLab Docs
- Installation
- Requirements
- GitLab cloud native Helm Chart
- Install GitLab with Docker
- Installation from source
- Install GitLab on Microsoft Azure
- Installing GitLab on Google Cloud Platform
- Installing GitLab on Amazon Web Services (AWS)
- Analytics
- Code Review Analytics
- Productivity Analytics
- Value Stream Analytics
- Kubernetes clusters
- Adding and removing Kubernetes clusters
- Adding EKS clusters
- Adding GKE clusters
- Group-level Kubernetes clusters
- Instance-level Kubernetes clusters
- Canary Deployments
- Cluster Environments
- Deploy Boards
- GitLab Managed Apps
- Crossplane configuration
- Cluster management project (alpha)
- Kubernetes Logs
- Runbooks
- Serverless
- Deploying AWS Lambda function using GitLab CI/CD
- Securing your deployed applications
- Groups
- Contribution Analytics
- Custom group-level project templates
- Epics
- Manage epics
- Group Import/Export
- Insights
- Issues Analytics
- Iterations
- Public access
- SAML SSO for GitLab.com groups
- SCIM provisioning using SAML SSO for GitLab.com groups
- Subgroups
- Roadmap
- Projects
- GitLab Secure
- Security Configuration
- Container Scanning
- Dependency Scanning
- Dependency List
- Static Application Security Testing (SAST)
- Secret Detection
- Dynamic Application Security Testing (DAST)
- GitLab Security Dashboard
- Offline environments
- Standalone Vulnerability pages
- Security scanner integration
- Badges
- Bulk editing issues and merge requests at the project level
- Code Owners
- Compliance
- License Compliance
- Compliance Dashboard
- Create a project
- Description templates
- Deploy Keys
- Deploy Tokens
- File finder
- Project integrations
- Integrations
- Atlassian Bamboo CI Service
- Bugzilla Service
- Custom Issue Tracker service
- Discord Notifications service
- Enabling emails on push
- GitHub project integration
- Hangouts Chat service
- Atlassian HipChat
- Irker IRC Gateway
- GitLab Jira integration
- Mattermost Notifications Service
- Mattermost slash commands
- Microsoft Teams service
- Mock CI Service
- Prometheus integration
- Redmine Service
- Slack Notifications Service
- Slack slash commands
- GitLab Slack application
- Webhooks
- YouTrack Service
- Insights
- Issues
- Crosslinking Issues
- Design Management
- Confidential issues
- Due dates
- Issue Boards
- Issue Data and Actions
- Labels
- Managing issues
- Milestones
- Multiple Assignees for Issues
- Related issues
- Service Desk
- Sorting and ordering issue lists
- Issue weight
- Associate a Zoom meeting with an issue
- Merge requests
- Allow collaboration on merge requests across forks
- Merge Request Approvals
- Browser Performance Testing
- How to create a merge request
- Cherry-pick changes
- Code Quality
- Load Performance Testing
- Merge Request dependencies
- Fast-forward merge requests
- Merge when pipeline succeeds
- Merge request conflict resolution
- Reverting changes
- Reviewing and managing merge requests
- Squash and merge
- Merge requests versions
- Draft merge requests
- Members of a project
- Migrating projects to a GitLab instance
- Import your project from Bitbucket Cloud to GitLab
- Import your project from Bitbucket Server to GitLab
- Migrating from ClearCase
- Migrating from CVS
- Import your project from FogBugz to GitLab
- Gemnasium
- Import your project from GitHub to GitLab
- Project importing from GitLab.com to your private GitLab instance
- Import your project from Gitea to GitLab
- Import your Jira project issues to GitLab
- Migrating from Perforce Helix
- Import Phabricator tasks into a GitLab project
- Import multiple repositories by uploading a manifest file
- Import project from repo by URL
- Migrating from SVN to GitLab
- Migrating from TFVC to Git
- Push Options
- Releases
- Repository
- Branches
- Git Attributes
- File Locking
- Git file blame
- Git file history
- Repository mirroring
- Protected branches
- Protected tags
- Push Rules
- Reduce repository size
- Signing commits with GPG
- Syntax Highlighting
- GitLab Web Editor
- Web IDE
- Requirements Management
- Project settings
- Project import/export
- Project access tokens (Alpha)
- Share Projects with other Groups
- Snippets
- Static Site Editor
- Wiki
- Project operations
- Monitor metrics for your CI/CD environment
- Set up alerts for Prometheus metrics
- Embedding metric charts within GitLab-flavored Markdown
- Embedding Grafana charts
- Using the Metrics Dashboard
- Dashboard YAML properties
- Metrics dashboard settings
- Panel types for dashboards
- Using Variables
- Templating variables for metrics dashboards
- Prometheus Metrics library
- Monitoring AWS Resources
- Monitoring HAProxy
- Monitoring Kubernetes
- Monitoring NGINX
- Monitoring NGINX Ingress Controller
- Monitoring NGINX Ingress Controller with VTS metrics
- Alert Management
- Error Tracking
- Tracing
- Incident Management
- GitLab Status Page
- Feature Flags
- GitLab CI/CD
- GitLab CI/CD pipeline configuration reference
- GitLab CI/CD include examples
- Introduction to CI/CD with GitLab
- Getting started with GitLab CI/CD
- How to enable or disable GitLab CI/CD
- Using SSH keys with GitLab CI/CD
- Migrating from CircleCI
- Migrating from Jenkins
- Auto DevOps
- Getting started with Auto DevOps
- Requirements for Auto DevOps
- Customizing Auto DevOps
- Stages of Auto DevOps
- Upgrading PostgreSQL for Auto DevOps
- Cache dependencies in GitLab CI/CD
- GitLab ChatOps
- Cloud deployment
- Docker integration
- Building Docker images with GitLab CI/CD
- Using Docker images
- Building images with kaniko and GitLab CI/CD
- GitLab CI/CD environment variables
- Predefined environment variables reference
- Where variables can be used
- Deprecated GitLab CI/CD variables
- Environments and deployments
- Protected Environments
- GitLab CI/CD Examples
- Test a Clojure application with GitLab CI/CD
- Using Dpl as deployment tool
- Testing a Phoenix application with GitLab CI/CD
- End-to-end testing with GitLab CI/CD and WebdriverIO
- DevOps and Game Dev with GitLab CI/CD
- Deploy a Spring Boot application to Cloud Foundry with GitLab CI/CD
- How to deploy Maven projects to Artifactory with GitLab CI/CD
- Testing PHP projects
- Running Composer and NPM scripts with deployment via SCP in GitLab CI/CD
- Test and deploy Laravel applications with GitLab CI/CD and Envoy
- Test and deploy a Python application with GitLab CI/CD
- Test and deploy a Ruby application with GitLab CI/CD
- Test and deploy a Scala application to Heroku
- GitLab CI/CD for external repositories
- Using GitLab CI/CD with a Bitbucket Cloud repository
- Using GitLab CI/CD with a GitHub repository
- GitLab Pages
- GitLab Pages
- GitLab Pages domain names, URLs, and baseurls
- Create a GitLab Pages website from scratch
- Custom domains and SSL/TLS Certificates
- GitLab Pages integration with Let's Encrypt
- GitLab Pages Access Control
- Exploring GitLab Pages
- Incremental Rollouts with GitLab CI/CD
- Interactive Web Terminals
- Optimizing GitLab for large repositories
- Metrics Reports
- CI/CD pipelines
- Pipeline Architecture
- Directed Acyclic Graph
- Multi-project pipelines
- Parent-child pipelines
- Pipelines for Merge Requests
- Pipelines for Merged Results
- Merge Trains
- Job artifacts
- Pipeline schedules
- Pipeline settings
- Triggering pipelines through the API
- Review Apps
- Configuring GitLab Runners
- GitLab CI services examples
- Using MySQL
- Using PostgreSQL
- Using Redis
- Troubleshooting CI/CD
- GitLab Package Registry
- GitLab Container Registry
- Dependency Proxy
- GitLab Composer Repository
- GitLab Conan Repository
- GitLab Maven Repository
- GitLab NPM Registry
- GitLab NuGet Repository
- GitLab PyPi Repository
- API Docs
- API resources
- .gitignore API
- GitLab CI YMLs API
- Group and project access requests API
- Appearance API
- Applications API
- Audit Events API
- Avatar API
- Award Emoji API
- Project badges API
- Group badges API
- Branches API
- Broadcast Messages API
- Project clusters API
- Group clusters API
- Instance clusters API
- Commits API
- Container Registry API
- Custom Attributes API
- Dashboard annotations API
- Dependencies API
- Deploy Keys API
- Deployments API
- Discussions API
- Dockerfiles API
- Environments API
- Epics API
- Events
- Feature Flags API
- Feature flag user lists API
- Freeze Periods API
- Geo Nodes API
- Group Activity Analytics API
- Groups API
- Import API
- Issue Boards API
- Group Issue Boards API
- Issues API
- Epic Issues API
- Issues Statistics API
- Jobs API
- Keys API
- Labels API
- Group Labels API
- License
- Licenses API
- Issue links API
- Epic Links API
- Managed Licenses API
- Markdown API
- Group and project members API
- Merge request approvals API
- Merge requests API
- Project milestones API
- Group milestones API
- Namespaces API
- Notes API
- Notification settings API
- Packages API
- Pages domains API
- Pipeline schedules API
- Pipeline triggers API
- Pipelines API
- Project Aliases API
- Project import/export API
- Project repository storage moves API
- Project statistics API
- Project templates API
- Projects API
- Protected branches API
- Protected tags API
- Releases API
- Release links API
- Repositories API
- Repository files API
- Repository submodules API
- Resource label events API
- Resource milestone events API
- Resource weight events API
- Runners API
- SCIM API
- Search API
- Services API
- Application settings API
- Sidekiq Metrics API
- Snippets API
- Project snippets
- Application statistics API
- Suggest Changes API
- System hooks API
- Tags API
- Todos API
- Users API
- Project-level Variables API
- Group-level Variables API
- Version API
- Vulnerabilities API
- Vulnerability Findings API
- Wikis API
- GraphQL API
- Getting started with GitLab GraphQL API
- GraphQL API Resources
- API V3 to API V4
- Validate the .gitlab-ci.yml (API)
- User Docs
- Abuse reports
- User account
- Active sessions
- Deleting a User account
- Permissions
- Personal access tokens
- Profile preferences
- Threads
- GitLab and SSH keys
- GitLab integrations
- Git
- GitLab.com settings
- Infrastructure as code with Terraform and GitLab
- GitLab keyboard shortcuts
- GitLab Markdown
- AsciiDoc
- GitLab Notification Emails
- GitLab Quick Actions
- Autocomplete characters
- Reserved project and group names
- Search through GitLab
- Advanced Global Search
- Advanced Syntax Search
- Time Tracking
- GitLab To-Do List
- Administrator Docs
- Reference architectures
- Reference architecture: up to 1,000 users
- Reference architecture: up to 2,000 users
- Reference architecture: up to 3,000 users
- Reference architecture: up to 5,000 users
- Reference architecture: up to 10,000 users
- Reference architecture: up to 25,000 users
- Reference architecture: up to 50,000 users
- Troubleshooting a reference architecture set up
- Working with the bundled Consul service
- Configuring PostgreSQL for scaling
- Configuring GitLab application (Rails)
- Load Balancer for multi-node GitLab
- Configuring a Monitoring node for Scaling and High Availability
- NFS
- Working with the bundled PgBouncer service
- Configuring Redis for scaling
- Configuring Sidekiq
- Admin Area settings
- Continuous Integration and Deployment Admin settings
- Custom instance-level project templates
- Diff limits administration
- Enable and disable GitLab features deployed behind feature flags
- Geo nodes Admin Area
- GitLab Pages administration
- Health Check
- Job logs
- Labels administration
- Log system
- PlantUML & GitLab
- Repository checks
- Repository storage paths
- Repository storage types
- Account and limit settings
- Service templates
- System hooks
- Changing your time zone
- Uploads administration
- Abuse reports
- Activating and deactivating users
- Audit Events
- Blocking and unblocking users
- Broadcast Messages
- Elasticsearch integration
- Gitaly
- Gitaly Cluster
- Gitaly reference
- Monitoring GitLab
- Monitoring GitLab with Prometheus
- Performance Bar
- Usage statistics
- Object Storage
- Performing Operations in GitLab
- Cleaning up stale Redis sessions
- Fast lookup of authorized SSH keys in the database
- Filesystem Performance Benchmarking
- Moving repositories managed by GitLab
- Run multiple Sidekiq processes
- Sidekiq MemoryKiller
- Switching to Puma
- Understanding Unicorn and unicorn-worker-killer
- User lookup via OpenSSH's AuthorizedPrincipalsCommand
- GitLab Package Registry administration
- GitLab Container Registry administration
- Replication (Geo)
- Geo database replication
- Geo with external PostgreSQL instances
- Geo configuration
- Using a Geo Server
- Updating the Geo nodes
- Geo with Object storage
- Docker Registry for a secondary node
- Geo for multiple nodes
- Geo security review (Q&A)
- Location-aware Git remote URL with AWS Route53
- Tuning Geo
- Removing secondary Geo nodes
- Geo data types support
- Geo Frequently Asked Questions
- Geo Troubleshooting
- Geo validation tests
- Disaster Recovery (Geo)
- Disaster recovery for planned failover
- Bring a demoted primary node back online
- Automatic background verification
- Rake tasks
- Back up and restore GitLab
- Clean up
- Namespaces
- Maintenance Rake tasks
- Geo Rake Tasks
- GitHub import
- Import bare repositories
- Integrity check Rake task
- LDAP Rake tasks
- Listing repository directories
- Praefect Rake tasks
- Project import/export administration
- Repository storage Rake tasks
- Generate sample Prometheus data
- Uploads migrate Rake tasks
- Uploads sanitize Rake tasks
- User management
- Webhooks administration
- X.509 signatures
- Server hooks
- Static objects external storage
- Updating GitLab
- GitLab release and maintenance policy
- Security
- Password Storage
- Custom password length limits
- Restrict allowed SSH key technologies and minimum length
- Rate limits
- Webhooks and insecure internal web services
- Information exclusivity
- How to reset your root password
- How to unlock a locked user from the command line
- User File Uploads
- How we manage the TLS protocol CRIME vulnerability
- User email confirmation at sign-up
- Security of running jobs
- Proxying assets
- CI/CD Environment Variables
- Contributor and Development Docs
- Contribute to GitLab
- Community members & roles
- Implement design & UI elements
- Issues workflow
- Merge requests workflow
- Code Review Guidelines
- Style guides
- GitLab Architecture Overview
- CI/CD development documentation
- Database guides
- Database Review Guidelines
- Database Review Guidelines
- Migration Style Guide
- What requires downtime?
- Understanding EXPLAIN plans
- Rake tasks for developers
- Mass inserting Rails models
- GitLab Documentation guidelines
- Documentation Style Guide
- Documentation structure and template
- Documentation process
- Documentation site architecture
- Global navigation
- GitLab Docs monthly release process
- Telemetry Guide
- Usage Ping Guide
- Snowplow Guide
- Experiment Guide
- Feature flags in development of GitLab
- Feature flags process
- Developing with feature flags
- Feature flag controls
- Document features deployed behind feature flags
- Frontend Development Guidelines
- Accessibility & Readability
- Ajax
- Architecture
- Axios
- Design Patterns
- Frontend Development Process
- DropLab
- Emojis
- Filter
- Frontend FAQ
- GraphQL
- Icons and SVG Illustrations
- InputSetter
- Performance
- Principles
- Security
- Tooling
- Vuex
- Vue
- Geo (development)
- Geo self-service framework (alpha)
- Gitaly developers guide
- GitLab development style guides
- API style guide
- Go standards and style guidelines
- GraphQL API style guide
- Guidelines for shell commands in the GitLab codebase
- HTML style guide
- JavaScript style guide
- Migration Style Guide
- Newlines style guide
- Python Development Guidelines
- SCSS style guide
- Shell scripting standards and style guidelines
- Sidekiq debugging
- Sidekiq Style Guide
- SQL Query Guidelines
- Vue.js style guide
- Instrumenting Ruby code
- Testing standards and style guidelines
- Flaky tests
- Frontend testing standards and style guidelines
- GitLab tests in the Continuous Integration (CI) context
- Review Apps
- Smoke Tests
- Testing best practices
- Testing levels
- Testing Rails migrations at GitLab
- Testing Rake tasks
- End-to-end Testing
- Beginner's guide to writing end-to-end tests
- End-to-end testing Best Practices
- Dynamic Element Validation
- Flows in GitLab QA
- Page objects in GitLab QA
- Resource class in GitLab QA
- Style guide for writing end-to-end tests
- Testing with feature flags
- Translate GitLab to your language
- Internationalization for GitLab
- Translating GitLab
- Proofread Translations
- Merging translations from CrowdIn
- Value Stream Analytics development guide
- GitLab subscription
- Activate GitLab EE with a license