Use this API to retrieve information about SSH keys, manage a user’s SSH and GPG keys, and manage SSH certificates for top-level groups.
Queries about deploy key fingerprints also retrieve information about the projects using that key. If you use a SHA256 fingerprint in an API call, URL-encode the fingerprint.
Managing group SSH certificates requires the Owner role for a top-level group.
Retrieve user by SSH key fingerprint
GET /api/v4/keys
Retrieves user by SSH key fingerprint. Administrators only.
Parameters
| Name | Type | Description |
|---|---|---|
fingerprintQuery, | String | The fingerprint of an SSH key Example: ba: |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
Retrieve user by SSH key ID
GET /api/v4/keys/{id}
Retrieves user by SSH key ID. Administrators only.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | The ID of an SSH key Example: 2 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
List all GPG keys
GET /api/v4/user/gpg_keys
Lists all GPG keys for the currently authenticated user.
Parameters
| Name | Type | Description |
|---|---|---|
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
Add a GPG key
POST /api/v4/user/gpg_keys
Adds a GPG key for the currently authenticated user.
Request body (application/json)
| Property | Type | Description |
|---|---|---|
keyRequired | String | The new GPG key |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
Retrieve a GPG key
GET /api/v4/user/gpg_keys/{key_id}
Retrieves a GPG key for the currently authenticated user.
Parameters
| Name | Type | Description |
|---|---|---|
key_Path, | Integer | The ID of the GPG key |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Delete a GPG key
DELETE /api/v4/user/gpg_keys/{key_id}
Deletes a GPG key from your user account.
Parameters
| Name | Type | Description |
|---|---|---|
key_Path, | Integer | The ID of the SSH key |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad Request | — |
404 | Not Found | — |
List all SSH keys
GET /api/v4/user/keys
Lists all SSH keys for the currently authenticated user.
Parameters
| Name | Type | Description |
|---|---|---|
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
Add an SSH key
POST /api/v4/user/keys
Adds an SSH key for the currently authenticated user.
Request body (application/json)
| Property | Type | Description |
|---|---|---|
expires_ | String (date- | The expiration date of the SSH key in ISO 8601 format (YYYY- |
keyRequired | String | The new SSH key |
titleRequired | String | The title of the new SSH key |
usage_ | String | Scope of usage for the SSH key Allowed values: auth_,auth,signingDefault: auth_ |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
Retrieve an SSH key
GET /api/v4/user/keys/{key_id}
Retrieves a specified SSH key for the currently authenticated user.
Parameters
| Name | Type | Description |
|---|---|---|
key_Path, | Integer | The ID of the SSH key |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Delete an SSH key
DELETE /api/v4/user/keys/{key_id}
Deletes a specified SSH key from the currently authenticated user.
Parameters
| Name | Type | Description |
|---|---|---|
key_Path, | Integer | The ID of the SSH key |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
List all GPG keys for a user
GET /api/v4/users/{id}/gpg_keys
Lists all GPG keys for a specified user account. This endpoint does not require authentication.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | Integer | The ID of the user |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Retrieve a GPG key for a user
GET /api/v4/users/{id}/gpg_keys/{key_id}
Retrieves a GPG key for a specified user account. This endpoint does not require authentication.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | Integer | The ID of the user |
key_Path, | Integer | The ID of the GPG key |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Delete a GPG key for a user
DELETE /api/v4/users/{id}/gpg_keys/{key_id}
Deletes a GPG key from a specified user account. Administrators only.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | Integer | The ID of the user |
key_Path, | Integer | The ID of the GPG key |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad Request | — |
404 | Not Found | — |
Retrieve an SSH key for a user
GET /api/v4/users/{id}/keys/{key_id}
Retrieves an SSH key for a specified user account. This endpoint does not require authentication.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | Integer | The ID of the user |
key_Path, | Integer | The ID of the SSH key |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Delete an SSH key for a user
DELETE /api/v4/users/{id}/keys/{key_id}
Deletes an SSH key from a specified user account. Administrators only.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | Integer | The ID of the user |
key_Path, | Integer | The ID of the SSH key |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
List all SSH keys for a user
GET /api/v4/users/{user_id}/keys
Lists all SSH keys for a specified user account.
Parameters
| Name | Type | Description |
|---|---|---|
user_Path, | String | The ID or username of the user |
pageQuery | Integer | Current page number Default: 1Example: 1 |
per_Query | Integer | Number of items per page Default: 20Example: 20 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Add an SSH key for a user
POST /api/v4/users/{user_id}/keys
Adds an SSH key for a specified user account. Administrators only.
Parameters
| Name | Type | Description |
|---|---|---|
user_Path, | Integer | The ID of the user |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
expires_ | String (date- | The expiration date of the SSH key in ISO 8601 format (YYYY- |
keyRequired | String | The new SSH key |
titleRequired | String | The title of the new SSH key |
usage_ | String | Scope of usage for the SSH key Allowed values: auth_,auth,signingDefault: auth_ |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesCustomAttribute
| Property | Type | Description |
|---|---|---|
key | String | Example:foo |
value | String | Example:bar |
APIEntitiesGpgKey
| Property | Type | Description |
|---|---|---|
created_ | String (date- | Example:2017- |
id | Integer (int64) | Example:1 |
key | String | Example:- |
APIEntitiesIdentity
| Property | Type | Description |
|---|---|---|
extern_ | String | — |
provider | String | — |
APIEntitiesSSHKey
| Property | Type | Description |
|---|---|---|
created_ | String (date- | Example:2015- |
expires_ | String (date- | Example:2020- |
id | Integer (int64) | Example:1 |
key | String | Example:ssh- |
last_ | String (date- | Example:2020- |
title | String | Example:Sample key 25 |
usage_ | String | Example:auth |
APIEntitiesSSHKeyWithUser
| Property | Type | Description |
|---|---|---|
created_ | String (date- | Example:2015- |
expires_ | String (date- | Example:2020- |
id | Integer (int64) | Example:1 |
key | String | Example:ssh- |
last_ | String (date- | Example:2020- |
title | String | Example:Sample key 25 |
usage_ | String | Example:auth |
user | APIEntities | — |
APIEntitiesUserBasic
| Property | Type | Description |
|---|---|---|
avatar_ | String | Example:/ |
avatar_ | String | Example:https: |
custom_ | Array of APIEntities | — |
id | Integer (int64) | Example:1 |
locked | Boolean | — |
name | String | Example:Administrator |
public_ | String | Example:john@example. |
state | String | Example:active |
username | String | Example:admin |
web_ | String | Example:https: |
APIEntitiesUserPublic
| Property | Type | Description |
|---|---|---|
avatar_ | String | Example:/ |
avatar_ | String | Example:https: |
bio | String | — |
bot | Boolean | — |
can_ | Boolean | Example:true |
can_ | Boolean | Example:true |
color_ | Integer | Example:1 |
commit_ | String | — |
confirmed_ | String (date- | Example:2015- |
created_ | String | — |
current_ | String (date- | Example:2015- |
custom_ | Array of APIEntities | — |
discord | String | — |
email | String | Example:john@example. |
external | Boolean | — |
followers | String | — |
following | String | — |
github | String | — |
id | Integer (int64) | Example:1 |
identities | APIEntities | — |
is_ | String | — |
job_ | String | — |
last_ | String (date- | Example:2015- |
last_ | String (date- | Example:2015- |
linkedin | String | — |
local_ | String | — |
location | String | — |
locked | Boolean | — |
name | String | Example:Administrator |
organization | String | — |
preferred_ | String | Example:en |
private_ | Boolean | Example:false |
projects_ | Integer | Example:10 |
pronouns | String | — |
public_ | String | Example:john@example. |
state | String | Example:active |
theme_ | Integer | Example:2 |
twitter | String | — |
two_ | Boolean | Example:true |
username | String | Example:admin |
web_ | String | Example:https: |
website_ | String | — |
work_ | String | — |
APIEntitiesUserWithAdmin
| Property | Type | Description |
|---|---|---|
avatar_ | String | Example:/ |
avatar_ | String | Example:https: |
bio | String | — |
bot | Boolean | — |
can_ | Boolean | Example:true |
can_ | Boolean | Example:true |
color_ | Integer | Example:1 |
commit_ | String | — |
confirmed_ | String (date- | Example:2015- |
created_ | String | — |
created_ | APIEntities | — |
current_ | String (date- | Example:2015- |
custom_ | Array of APIEntities | — |
discord | String | — |
email | String | Example:john@example. |
external | Boolean | — |
followers | String | — |
following | String | — |
github | String | — |
id | Integer (int64) | Example:1 |
identities | APIEntities | — |
is_ | String | — |
is_ | String | — |
job_ | String | — |
last_ | String (date- | Example:2015- |
last_ | String (date- | Example:2015- |
linkedin | String | — |
local_ | String | — |
location | String | — |
locked | Boolean | — |
name | String | Example:Administrator |
namespace_ | String | — |
note | String | — |
organization | String | — |
preferred_ | String | Example:en |
private_ | Boolean | Example:false |
projects_ | Integer | Example:10 |
pronouns | String | — |
provisioned_ | String | — |
public_ | String | Example:john@example. |
state | String | Example:active |
theme_ | Integer | Example:2 |
twitter | String | — |
two_ | Boolean | Example:true |
username | String | Example:admin |
web_ | String | Example:https: |
website_ | String | — |
work_ | String | — |