Get repository languages¶
GET /api/v5/repos/{owner}/{repo}/languages
This endpoint retrieves the language breakdown of the specified repository. It returns a map whose keys are language names and whose values are the percentage of each language in the repository code, helping you understand the composition of languages in the repository.
Access token support¶
- AtomGit user access tokens (AtomGit user access tokens)
Anonymous access¶
This endpoint allows anonymous access.
Request parameters¶
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
owner |
path | string | Yes | Namespace address the repository belongs to (organization or personal path) |
repo |
path | string | Yes | Repository path (path) |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
{language} |
number | Yes | No | Language percentage. The key is the language name (e.g. Shell, Python), and the value is the percentage of that language in the repository code |
The response body is a map object whose keys are language names and whose values are percentage numbers; the exact key set depends on the languages the repository actually contains. Refer to the actual response.
Request example¶
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/languages' \
-H 'Accept: application/json'
Replace
<owner>with the namespace address the repository belongs to (organization or personal path); replace<repo>with the repository path (path).
JavaScript¶
// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/languages", {
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/repos/<owner>/<repo>/languages",
headers={
"Accept": "application/json",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
HTTP response status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Authentication required (Requires authentication) |
403 |
Forbidden |
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing/invalid access credentials) |
400 |
Invalid parameters or the request cannot be parsed |
404 |
The requested path does not exist |
405 |
Request method not supported |
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