List all public keys of the authorized user¶
GET /api/v5/user/keys
Call this endpoint to list all public keys of the authorized user.
Supported access tokens¶
- AtomGit user access token (AtomGit user access tokens)
Anonymous access¶
This endpoint does not allow anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
access_token |
query | string | Yes | User authorization code |
page |
query | integer | No | Current page number |
per_page |
query | integer | No | Number of items per page; maximum 100, default 20 |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
| (response body) | array | Yes | No | Array of public key objects |
Public key object (array element)
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
id |
integer | Yes | No | Public key ID |
title |
string | Yes | No | Public key title |
key |
string | Yes | No | Public key content (SSH public key string) |
created_at |
string | Yes | No | Public key creation time |
url |
string | Yes | No | Public key details URL |
Error response¶
400 Invalid parameters
401 Unauthenticated
The actual error field names returned by the backend take precedence.
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Requires authentication |
403 |
Forbidden |
404 |
Not found |
Request example¶
Parameter notes¶
<token>Replace with your AtomGit user access token.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/user/keys?access_token=<token>' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/user/keys?access_token=<YOUR-TOKEN>", {
headers: {
"Accept": "application/json",
},
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.get(
"https://api.atomgit.com/api/v5/user/keys",
params={"access_token": "<YOUR-TOKEN>"},
headers={"Accept": "application/json"},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
[
{
"id": 308357,
"title": "xiaogang@csdn.net",
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCwT9UXXtGfLa16tbxV+0RQ6m+BaAG2wJvqApr+juVNEmnM0lKNt1tyxY/V9SsCRf38UprPLTp71+btRpFIH9TLrGhkvT3tJOouYDXVUpSaigi7OO+6eLc+Cn0TZSLj4RmwVe/w93kmsCUzgqkeHk14K3S+2oCCm1rbpBAvpPhSKHhAH9LcTBecDoZ+NA2dsEDyfsloVH5cMJQO9n2W1QYduMuuaVHHpehSdDohN7cDI799Rwofaqqyz6ZJrc6eBjSVi1W+JPDTT6NW0+eFBYXo3KWybffixH4cAWdbS1Ms5Pe9Xh+G4WqFuhFh9zCoXlRUUrArLo5pYfpy5gv4iUVmniM0Pb0/Y5x8RJyGaPdS/2c68s8LQsm/9Ees8aeE5TcT5isDEvh+wy7jp1xi5nONk9QvOy7EdYYeHQtkw/0rklsz7UvAIjjHObNNYpY6RLQRT+dqN/lAb7stT047FSxqcNMCX/cybapLygs1y2ClcgU42p16RfgCH0NKA5emRhM= xiaogang@csdn.net",
"created_at": "2024-07-23T10:29:42.119+00:00",
"url": "https://api.atomgit.com/v5/user/keys/308357"
},
{
"id": 311915,
"title": "555555",
"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIa6IyTGuI8V5wrhANDFyezQqL73dY9ctLGHgpOggp7E Gitee",
"created_at": "2024-11-14T03:34:40.318+00:00",
"url": "https://api.atomgit.com/v5/user/keys/311915"
}
]
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials |
403 |
Forbidden |
404 |
Request path does not exist |
429 |
Too many requests; rate limit triggered |
500 |
Internal system error |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc