Skip to content

Get the latest release of the repository

GET /api/v5/repos/*/*/releases/latest

Call this endpoint to get the latest release information for the specified repository (you can use type to choose the most recently published or the most recently updated release).

Access token support

  • AtomGit user access tokens

Anonymous access

This endpoint allows anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes Namespace address that owns the repository (enterprise, organization, or personal address path)
repo path string Yes Repository path (path)
type query string No Type. updated (most recently updated), latest (most recent); defaults to updated

Response parameters

Field Type Always returned Nullable Description
tag_name string Yes Yes Tag name associated with the release
target_commitish string Yes Yes Target commit (commit SHA) associated with the release; may be null
prerelease boolean Yes Yes Whether this is a prerelease; may be null
name string Yes Yes Release name
body string Yes Yes Release description
author object Yes Yes Release author information; may be null
created_at string Yes Yes Release creation time
assets object[] Yes Yes Release attachment list; may be null
release_status string Yes Yes Release status: pre prerelease, lasted latest release; may be null

author object

Field Type Always returned Nullable Description
author.id string No Yes User ID
author.login string No Yes Login name
author.name string No Yes User nickname
author.avatar_url string No Yes Avatar URL
author.html_url string No Yes Profile URL
author.type string No Yes User type (for example, User)
author.url string No Yes User API URL
author.objectId string No Yes Object ID; may be null
author.email string No Yes Email; may be null

assets[] object

Field Type Always returned Nullable Description
assets[].browser_download_url string No Yes Attachment download URL
assets[].name string No Yes Attachment name
assets[].type string No Yes Attachment type (SOURCE source archive / ATTACH_FILE attachment file)
assets[].temp_download_url string No Yes Temporary download URL; may be null
assets[].id integer No Yes Attachment ID; may be null

Error response

400 Invalid parameters

Returned when the type value is not supported or no latest release is found:

{
  "error": "bad_request",
  "message": "Unsupported type: <type>"
}
{
  "error": "bad_request",
  "message": "No latest release found"
}

401 Unauthenticated

Returned when an invalid access token is supplied:

{
  "error": "unauthorized",
  "message": "Missing or invalid access token"
}

HTTP status codes

Status code Description
200 Success (OK)
400 Bad request (for example, unsupported type value or no release found)
401 Requires authentication
403 Forbidden

Request example

Parameter details

Replace <owner> with the namespace address that owns the repository (enterprise, organization, or personal address path); replace <repo> with the repository path (path); replace <token> with your AtomGit user access token (optional; this endpoint allows anonymous access).

cURL

curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/releases/latest?type=latest' \
  -H 'Accept: application/json'

To call the endpoint with an access token:

curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/releases/latest?type=latest&access_token=<token>' \
  -H 'Accept: application/json'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch(
  "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/releases/latest?type=latest",
  {
    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>/releases/latest",
    params={"type": "latest"},
    headers={
        "Accept": "application/json",
    },
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "tag_name": "V0.0.1",
  "target_commitish": "b33d10690347a36ccbf7464fe16466c1409f9533",
  "prerelease": false,
  "name": "V0.0.1",
  "body": "V0.0.1",
  "author": {
    "id": "645",
    "login": "yanfan",
    "name": "Dianqian Dudianjian",
    "avatar_url": "https://api.atomgit.com/avatar.png",
    "html_url": "https://api.atomgit.com/yanfan",
    "type": "User",
    "url": "https://api.atomgit.com/api/v5/users/yanfan"
  },
  "created_at": "2024-04-15T20:43:35+08:00",
  "assets": [
    {
      "browser_download_url": "https://api.atomgit.com/<owner>/<repo>/-/archive/V0.0.1/<repo>-V0.0.1.zip",
      "name": "<repo>-V0.0.1.zip",
      "type": "SOURCE"
    },
    {
      "browser_download_url": "https://api.atomgit.com/<owner>/<repo>/-/archive/V0.0.1/<repo>-V0.0.1.tar.gz",
      "name": "<repo>-V0.0.1.tar.gz",
      "type": "SOURCE"
    }
  ],
  "release_status": "lasted"
}

Error codes

Error code Description
400 Bad request (for example, unsupported type value or no release found)
401 Unauthenticated or invalid credentials (missing or invalid access token)
403 Forbidden; insufficient permission
404 Request path does not exist
405 Request method not supported
429 Too many requests; rate limit triggered
500 Internal server error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc