Skip to content

List message notifications for the current authenticated user

GET /api/v5/notifications

Retrieves the list of message notifications for the current authenticated user, supporting filtering by read status, message source, and creation time range, as well as paginated queries. By default it returns unread messages from all sources, and the query does not mark messages as read.

Access token support

  • AtomGit user access tokens

Whether anonymous access is allowed

This endpoint does not allow anonymous access

Request parameters

Parameter Location Type Required Description
access_token query string Yes User access token
state query string No Read status; enum: unread / read / all; defaults to unread (unread only)
type query string No A single message source; omit to include all sources; enum: pull_request / issue / mention / invitation / pipeline_alert / system
since query string No Only query messages created after this time; format yyyy-MM-dd'T'HH:mm:ssXXX (e.g., 2026-11-01T08:00:00%2B08:00); must be earlier than before
before query string No Only query messages created before this time; format yyyy-MM-dd'T'HH:mm:ssXXX (e.g., 2026-11-01T08:00:00%2B08:00)
page query integer No Current page number; default 1; must be greater than 0
per_page query integer No Number of items per page; default 30; value range 1~100

Response parameters

Field Type Always returned Nullable Description
total integer Yes No Total number of records matching the filter criteria
list array Yes No Message notifications on the current page
list[].id string Yes No Message ID
list[].content string Yes No Message content, consistent with the message center, may contain HTML
list[].type string Yes No Message source; known sources are pull_request, issue, mention, invitation, pipeline_alert, system; other sources retain their original type
list[].unread boolean Yes No Whether the message is unread
list[].created_at string Yes No Message creation time, Beijing time, format yyyy-MM-dd'T'HH:mm:ssXXX
list[].html_url string Yes No URL of the resource page that triggered the message
list[].actor object Yes Yes Actor; may be empty for system messages
list[].repository object Yes Yes Repository it belongs to; empty for messages not associated with a repository

list[].actor object

Field Type Always returned Nullable Description
list[].actor.avatar_url string Yes No Avatar URL
list[].actor.events_url string Yes No Events list API URL
list[].actor.followers_url string Yes No Followers list API URL
list[].actor.following_url string Yes No Following list API URL
list[].actor.gists_url string Yes No Gists API URL
list[].actor.html_url string Yes No User or organization page URL
list[].actor.id string Yes No User or organization identifier
list[].actor.object_id string Yes No User object identifier
list[].actor.login string Yes No Username or organization path
list[].actor.member_role string Yes No Member role
list[].actor.name string Yes No User nickname or organization name
list[].actor.organizations_url string Yes No Organizations list API URL
list[].actor.received_events_url string Yes No Received events list API URL
list[].actor.remark string Yes No Enterprise remark name
list[].actor.repos_url string Yes No Repositories list API URL
list[].actor.starred_url string Yes No Starred repositories list API URL
list[].actor.subscriptions_url string Yes No Subscriptions list API URL
list[].actor.type string Yes No Object type: User indicates a user, Organization indicates an organization
list[].actor.url string Yes No User or organization details API URL

list[].repository object

Field Type Always returned Nullable Description
list[].repository.id integer Yes No Repository ID
list[].repository.full_name string Yes No Repository full path
list[].repository.human_name string Yes No Repository full display name
list[].repository.url string Yes No Repository page URL

Failure response

This endpoint returns an error when authentication fails or parameters are invalid. The actual error field names returned by the backend take precedence.

400 Parameter error

{
  "error": "invalid_request",
  "message": "state must be unread, read or all"
}

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "缺少或无效的访问令牌"
}

HTTP response status codes

Status code Description
200 Success (OK)
400 Parameter error (Bad Request)
401 Requires authentication
403 Forbidden

Request example

Parameter description

Replace <token> with your AtomGit user access token. state type since before page per_page are all optional and can be appended as needed.

cURL

curl -X GET 'https://api.atomgit.com/api/v5/notifications?access_token=<token>&state=unread&page=1&per_page=30' \
  -H 'Accept: application/json'

JavaScript

// 原生 fetch (Node.js 18+ / 浏览器)
const response = await fetch(
  "https://api.atomgit.com/api/v5/notifications?access_token=<token>&state=unread&page=1&per_page=30",
  {
    headers: {
      "Accept": "application/json",
    },
  },
);

if (!response.ok) {
  throw new Error(`请求失败: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.get(
    "https://api.atomgit.com/api/v5/notifications",
    params={
        "access_token": "<token>",
        "state": "unread",
        "page": 1,
        "per_page": 30,
    },
    headers={"Accept": "application/json"},
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "total": 1,
  "list": [
    {
      "id": "b7c6f8d0-1234-4a5b-9c6d-0e1f2a3b4c5d",
      "content": "<p>有人在合并请求 #12 中提到了你</p>",
      "type": "mention",
      "unread": true,
      "created_at": "2024-11-20T13:00:21+08:00",
      "html_url": "https://atomgit.com/octocat/hello-world/merge_requests/12",
      "actor": {
        "id": "10086",
        "login": "octocat",
        "name": "octocat",
        "avatar_url": "https://api.atomgit.com/avatar.png",
        "html_url": "https://atomgit.com/octocat",
        "type": "User"
      },
      "repository": {
        "id": 12345,
        "full_name": "octocat/hello-world",
        "human_name": "hello-world",
        "url": "https://atomgit.com/octocat/hello-world"
      }
    }
  ]
}

Error codes

Error code Description
400 Parameter error or the request cannot be parsed
401 Unauthenticated or invalid credentials (missing/invalid access credential)
403 No permission to access this resource
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