---
url: /en/develops/openapi-event.md
---
## Overview

Repository events record different types of repository events triggered on CNB. Each event returns common properties and a payload object determined by the event type.

Repository events are recorded in hourly shards as the minimum unit for all repository operations on CNB. Currently recorded event types include:

* CreateEvent
* DeleteEvent
* ForkEvent
* IssueCommentEvent
* IssueEvent
* MemberEvent
* PublicEvent
* PullRequestEvent
* PullRequestReviewEvent
* PullRequestReviewCommentEvent
* PushEvent
* ReleaseEvent
* WatchEvent

## API Interface

### Get Repository Events Within Specified Time Range

* Endpoint: `/events/{repo_path}/-/{date}`
* Method: "GET"
* Input Parameters:
  * repo\_path: Complete repository path, e.g.: /cnb/test
  * date: Time range, queryable by hour or day. **Daily queries have a one-day data lag, meaning only previous day's aggregated events can be queried on the current day.**
    * Hourly query: yy-mm-dd-h, e.g., 2025-09-11-7, represents the time range from 2025-09-11 07:00:00 to 07:59:59
    * Daily query: yy-mm-dd, e.g., 2025-09-11, represents the time range from 2025-09-11 00:00:00 to 23:59:59
* Response:\
  Repository event list. Repository events have different structures depending on the event type, but all share common structural properties.
  * eventObject: Event structure, composed of common event properties + payload.

#### Common Event Properties

* id: int, event id, unique value.
* type: string, event type, see 'Overview' for details.
* actor: object, event trigger user.
  * id: int, user id.
  * username: string, username.
  * nickname: string, user nickname.
  * url: string, OPENAPI address for querying user details.
  * avatar\_url: string, user avatar URL.
* repo: object, repository details for the event.
  * id: int, repository id.
  * path: string, full repository path.
  * url: string, OPENAPI address for querying repository details.
* created\_at: string, event trigger time in ISO 8601 format.

#### Payload

##### CreateEvent

Records repository, branch, and tag creation events.

* ref: string, git ref resource. When ref\_type is repository, ref is an empty string.
* ref\_type: string, git ref object type, includes branch, tag, repository.
* master\_branch: string, repository main branch.
* description: string, repository description.
* pusher\_type: string, pusher type, fixed value "user".

##### DeleteEvent

Records branch and tag deletion events.

* ref: string, git ref resource.
* ref\_type: string, git ref object type, includes branch, tag.

##### ForkEvent

Records repository fork events.

* forkee: *repo* object, forked repository resource.
  * id: int, repository id.
  * name: string, repository name.
  * full\_name: string, full repository path.
  * owner: *user* object, repository creator details.
    * id: int, creator id.
    * username: string, username.
    * url: string, OPENAPI address for querying user details.
    * avatar\_url: string, user avatar URL.
    * html\_url: string, user homepage URL.
    * followers\_url: string, user followers list URL.
    * following\_url: string, user following list URL.
    * starred\_url: string, user starred list URL.
    * organizations\_url: string, user organizations list URL.
    * repos\_url: string, user repositories list URL.
    * type: string, user type, includes "wechat\_user" - WeChat user, "robot\_user" - robot.
  * private: bool, whether it's a private repository.
  * html\_url: string, repository CNB URL.
  * description: string, repository description.
  * fork: bool, whether created by fork.
  * url: string, repository details query OPENAPI address.
  * branches\_url: string, OPENAPI address for repository branch list query.
  * collaborators\_url: string, OPENAPI address for repository members list query.
  * compare\_url: string, OPENAPI address for branch comparison.
  * contents\_url: string, OPENAPI address for repository file query.
  * contributors\_url: string, OPENAPI address for repository contributors list query.
  * forks\_url: string, OPENAPI address for repository fork list query.
  * git\_commits\_url: string, OPENAPI address for specific commit details query.
  * git\_tags\_url: string, OPENAPI address for specific tag details query.
  * issue\_comment\_url: string, OPENAPI address for issue comment list query.
  * issues\_url: string, OPENAPI address for issue list query.
  * labels\_url: string, OPENAPI address for issue label list query.
  * pulls\_url: string, OPENAPI address for PR list query.
  * releases\_url: string, OPENAPI address for release list query.
  * stargazers\_url: string, OPENAPI address for users who starred the repository query.
  * tags\_url: string, OPENAPI address for tag list query.
  * clone\_url: string, repository clone URL.
  * homepage: string, repository homepage.
  * language: string, repository primary language.
  * forks\_count: int, number of times repository was forked.
  * stargazers\_count: int, number of times repository was starred.
  * size: int, repository storage size.
  * default\_branch: string, repository default branch.
  * open\_issues\_count: int, number of open issues in repository.
  * topics: string list, repository topic list.
  * has\_issues: bool, whether repository has issues.
  * archived: bool, whether repository is archived.
  * disabled: bool, whether repository is disabled.
  * visibility: string, repository visibility.
  * pushed\_at: string, last push time to repository.
  * created\_at: string, repository creation time.
  * updated\_at: string, repository update time.
  * license: string, repository license.

##### IssueCommentEvent

Records issue comment events.

* action: string, comment action, includes created, edited, deleted.
* issue: *issue* object, issue details for the comment.
  * id: int, issue id.
  * url: string, OPENAPI address for specific issue details query.
  * repository\_url: string, OPENAPI address for issue repository details query.
  * labels\_url: string, OPENAPI address for issue label list query.
  * comments\_url: string, OPENAPI address for issue comments query.
  * html\_url: string, issue CNB URL.
  * number: int, issue repository sequence number.
  * state: string, issue state.
  * title: string, issue title.
  * labels: *label* object list, issue label list.
    * name: string, label name.
    * description: string, label description.
    * color: string, label color.
  * assignees: *user* object list, issue assignees, object structure same as *ForkEvent* *user* object.
  * comments: int, issue comment count.
  * closed\_at: string, issue close time.
  * created\_at: string, issue creation time.
  * updated\_at: string, issue update time.
* comment: *comment* object, comment details.
  * id: int, comment id
  * url: string, OPENAPI address for comment details query.
  * html\_url: string, comment CNB URL.
  * body: string, comment content.
  * user: *user* object, commenter, object structure same as *ForkEvent* *user* object.
  * created\_at: string, comment creation time.
  * updated\_at: string, comment update time.
  * issue\_url: string, OPENAPI address for comment's issue details query.

##### IssueEvent

Records issue events.

* action: string, issue action, includes opened, edited, closed, reopened, assigned, unassigned, labeled, unlabeled.
* issue: *issue* object, issue details, object structure same as *IssueCommentEvent* *issue* object.
* assignees: *user* object, assignee, object structure same as *ForkEvent* *user* object.
* labels: *label* object, issue label, object structure same as *IssueCommentEvent* *label* object.

##### MemberEvent

Records repository member addition events.

* action: string, member action, includes added.
* member: *user* object, new member, object structure same as *ForkEvent* *user* object.

##### PublicEvent

Records private repository to public repository conversion events.

##### PullRequestEvent

Records PR events.

* action: string, PR action, includes opened, closed, reopened, edited.
* number: int, PR repository sequence number.
* pull\_request: *pull\_request* object, PR details.
  * id: int, PR id.
  * url: string, OPENAPI address for PR details query.
  * html\_url: string, PR CNB URL.
  * diff\_url: string, PR diff CNB URL.
  * commits\_url: string, PR CNB commit details URL.
  * number: int, PR repository sequence number.
  * state: string, PR state.
  * title: string, PR title.
  * user: *user* object, PR creator, object structure same as *ForkEvent* *user* object.
  * body: string, PR details.
  * labels: *label* object list, PR label list, object structure same as *IssueCommentEvent* *label* object.
  * created\_at: string, PR creation time.
  * updated\_at: string, PR update time.
  * closed\_at: string, PR close time.
  * merged\_at: string, PR merge time.
  * assignees: *user* object list, assignee list, object structure same as *ForkEvent* *user* object.
  * requested\_reviewers: *user* object list, reviewer list, object structure same as *ForkEvent* *user* object.
  * head: *branch* object, source branch.
    * ref: string, branch name.
    * repo: *repo* object, branch repository, object structure same as *ForkEvent* *repo* object.
  * base: *branch* object, target branch, same structure as above.
  * mergeable\_state: string, PR merge state.
  * comments: int, PR comment count.

##### PullRequestReviewEvent

Records PR review events.

* action: string, PR review action, includes created.
* pull\_request: *pull\_request* object, PR details, object structure same as *PullRequestEvent* *pull\_request* object.

##### PullRequestReviewCommentEvent

Records PR review comments.

* action: string, PR review action, includes opened, edited, deleted.
* pull\_request: *pull\_request* object, PR details, object structure same as *PullRequestEvent* *pull\_request* object.
* comment: *comment* object, comment details, object structure same as *IssueCommentEvent* *comment* object.

##### PushEvent

Records repository push events.

* push\_id: string, push id.
* distinct\_size: int, deduplicated push size.
* ref: string, push ref name.
* head: string, latest commit sha after push.
* before: string, latest commit sha before push.
* commits: *commit* object list, commit details list.
  * sha: string, commit sha.
  * message: string, commit message.
  * url: string, OPENAPI address for specific commit details query.
  * author: *author* object, committer.
    * name: string, committer name.
    * email: string, committer email.
  * distinct: bool, whether it's a new commit.

##### ReleaseEvent

Records repository release events.

* action: string, release action, includes published, edited, deleted.
* release: *release* object, release details.
  * id: int, release id.
  * url: string, OPENAPI address for specific release details query.
  * html\_url: string, release CNB URL.
  * assets\_url: string, OPENAPI address for release assets query.
  * tag\_name: string, tag name.
  * target\_commitish: string, release target commit sha.
  * name: string, release name.
  * body: string, release details.
  * draft: bool, whether it's a draft.
  * prerelease: bool, whether it's the latest release.
  * created\_at: string, release creation time.
  * published\_at: string, release publish time.
  * author: *user* object, creator, object structure same as *ForkEvent* *user* object.
  * assets: *release\_asset* object list, release assets.
    * id: int, asset id.
    * name: string, asset name.
    * url: string, OPENAPI address for specific asset details query.
    * label: string, asset label.
    * state: string, asset state.
    * content\_type: string, asset content type.
    * size: int, asset size.
    * digest: string, asset digest hash.
    * download\_count: int, asset download count.
    * created\_at: string, asset creation time.
    * updated\_at: string, asset update time.

##### WatchEvent

Records repository star events.

* action: string, star action, includes started.
