---
title: "Check if a commit exists in a repository"
method: GET
path: "/repository/{repository_id}/commits/{commit_sha}"
tags: ["Repositories"]
---

# Check if a commit exists in a repository

`GET /repository/{repository_id}/commits/{commit_sha}`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/repository/{repository_id}/commits/{commit_sha}`
- Auth: HTTP bearer

## Path parameters

- `repository_id` integer, required
- `commit_sha` string, required

## Response `200`

Commit existence check result

- CommitExistsResponse
  - `commit` CommitInfo, nullable
    - `author` string, required: Author name
    - `author_email` string, required: Author email
    - `date` string, date-time, required: Commit date in ISO 8601 format
    - `message` string, required: Commit message
    - `sha` string, required: Commit SHA hash
  - `commit_sha` string, nullable
  - `exists` boolean, required

## Other responses

- `400`: Invalid commit SHA
- `401`: Unauthorized
- `404`: Repository not found
- `429`: Commit lookup rate limit exceeded
- `500`: Internal server error
- `502`: Git provider request failed

## Changes

- **2026-07-27** `1b060c0a4ba3`: 4 info
  - added the non-success response with the status `400`
  - added the non-success response with the status `429`
  - added the non-success response with the status `502`
  - added the optional property `commit` to the response with the `200` status

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/repository/:repository_id/commits/:commit_sha/get.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
