---
title: "Create a commit comment"
method: POST
path: "/repos/{owner}/{repo}/commits/{commit_sha}/comments"
tags: ["repos"]
---

# Create a commit comment

`POST /repos/{owner}/{repo}/commits/{commit_sha}/comments`

Create a comment for a commit using its `:commit_sha`.

This endpoint triggers [notifications](https://docs.github.com/enterprise-server@3.5/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in secondary rate limiting. See "[Secondary rate limits](https://docs.github.com/enterprise-server@3.5/rest/overview/resources-in-the-rest-api#secondary-rate-limits)" and "[Dealing with secondary rate limits](https://docs.github.com/enterprise-server@3.5/rest/guides/best-practices-for-integrators#dealing-with-secondary-rate-limits)" for details.

## Path parameters

- `owner` string, required
- `repo` string, required
- `commit_sha` string, required

## Request body

- object
  - `body` string, required — The contents of the comment.
  - `path` string — Relative path of the file to comment on.
  - `position` integer — Line index in the diff to comment on.
  - `line` integer — **Deprecated**. Use **position** parameter instead. Line number in the file to comment on.

## Response `201`

Response

- CommitComment — Commit Comment
  - `html_url` string, uri, required
  - `url` string, uri, required
  - `id` integer, required
  - `node_id` string, required
  - `body` string, required
  - `path` string, nullable, required
  - `position` integer, nullable, required
  - `line` integer, nullable, required
  - `commit_id` string, required
  - `user` NullableSimpleUser, nullable, required — A GitHub user.
    - `name` string, nullable
    - `email` string, nullable
    - `login` string, required
    - `id` integer, required
    - `node_id` string, required
    - `avatar_url` string, uri, required
    - `gravatar_id` string, nullable, required
    - `url` string, uri, required
    - `html_url` string, uri, required
    - `followers_url` string, uri, required
    - `following_url` string, required
    - `gists_url` string, required
    - `starred_url` string, required
    - `subscriptions_url` string, uri, required
    - `organizations_url` string, uri, required
    - `repos_url` string, uri, required
    - `events_url` string, required
    - `received_events_url` string, uri, required
    - `type` string, required
    - `site_admin` boolean, required
    - `starred_at` string
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `author_association` 'COLLABORATOR' | 'CONTRIBUTOR' | 'FIRST_TIMER' | 'FIRST_TIME_CONTRIBUTOR' | 'MANNEQUIN' | 'MEMBER' | 'NONE' | 'OWNER', required — How the author is associated with the repository.
  - `reactions` ReactionRollup
    - `url` string, uri, required
    - `total_count` integer, required
    - `+1` integer, required
    - `-1` integer, required
    - `laugh` integer, required
    - `confused` integer, required
    - `heart` integer, required
    - `hooray` integer, required
    - `eyes` integer, required
    - `rocket` integer, required

## Other responses

- `403` — Forbidden
- `422` — Validation failed, or the endpoint has been spammed.

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-4.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-4/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-4/versions/ee6c7a46328e/schema)
