> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kosli.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Search commits by SHA prefix

> Get the commits Kosli knows about whose SHA-1 starts with the given value,
from trails and artifacts, ordered by SHA-1. Each links to the trails
that report it.



## OpenAPI

````yaml https://app.kosli.com/api/v2/openapi.json get /search/{org}/commit/{sha_prefix}
openapi: 3.1.0
info:
  title: Kosli API
  summary: The API for communicating with Kosli
  description: >

    # Authentication 


    When making requests against Kosli API, you can authenticate your requests
    using a bearer token. 

    Set the bearer token in the request Authorization header to a valid API
    key. 

    API Keys can be personal or for service accounts. Check the [service
    accounts
    documentation](https://docs.kosli.com/getting_started/service-accounts/) for
    details. 


    ## Curl example


    ```shell

    curl -H "Authorization: Bearer <<your-api-key>>"
    https://app.kosli.com/api/v2/environments/<<your-org-name>>

    ```
  version: '2.0'
servers:
  - url: https://app.kosli.com/api/v2
    description: EU
  - url: https://app.us.kosli.com/api/v2
    description: US
security:
  - HTTPBearer: []
paths:
  /search/{org}/commit/{sha_prefix}:
    get:
      tags:
        - Search
      summary: Search commits by SHA prefix
      description: >-
        Get the commits Kosli knows about whose SHA-1 starts with the given
        value,

        from trails and artifacts, ordered by SHA-1. Each links to the trails

        that report it.
      operationId: search_commits
      parameters:
        - name: sha_prefix
          in: path
          required: true
          schema:
            type: string
            description: The start of a commit SHA-1, 5 to 40 hex characters.
            title: Sha Prefix
          description: The start of a commit SHA-1, 5 to 40 hex characters.
        - name: org
          in: path
          required: true
          schema:
            type: string
            title: Org
        - name: page
          in: query
          required: false
          schema:
            type: integer
            maximum: 1000000
            minimum: 1
            description: Page number
            default: 1
            title: Page
          description: Page number
        - name: per_page
          in: query
          required: false
          schema:
            type: integer
            maximum: 50
            minimum: 1
            description: Number of commits per page
            default: 15
            title: Per Page
          description: Number of commits per page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommitSearchResponse'
        '400':
          description: The value is not 5 to 40 hex characters.
        '404':
          description: No commit matches the value.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/fastapi_app__errors__NotFoundResponse___locals___NotFoundResponseModel__59
      security:
        - HTTPBearer: []
        - HTTPBasic: []
components:
  schemas:
    CommitSearchResponse:
      properties:
        _links:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Links
        page:
          type: integer
          title: Page
        per_page:
          type: integer
          title: Per Page
        total_pages:
          type: integer
          title: Total Pages
        total_count:
          type: integer
          title: Total Count
        commits:
          items:
            $ref: '#/components/schemas/CommitSearchItem'
          type: array
          title: Commits
          description: Commits whose SHA-1 starts with the search value.
      additionalProperties: false
      type: object
      required:
        - page
        - per_page
        - total_pages
        - total_count
        - commits
      title: CommitSearchResponse
    fastapi_app__errors__NotFoundResponse___locals___NotFoundResponseModel__59:
      properties:
        message:
          type: string
          title: Message
          description: Error message
        errors:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Errors
          description: Validation errors by field
      type: object
      required:
        - message
      title: NotFoundResponseModel
      description: No commits match '278f7a4'.
      examples:
        - message: No commits match '278f7a4'.
    CommitSearchItem:
      properties:
        sha1:
          type: string
          title: Sha1
          description: Full SHA-1 of the commit.
          examples:
            - e0ad84e1a2464a9486e777c1ecde162edff930a9
        author:
          anyOf:
            - type: string
            - type: 'null'
          title: Author
          description: The commit author.
        author_username:
          anyOf:
            - type: string
            - type: 'null'
          title: Author Username
          description: The commit author's username on the git host.
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
          description: The commit message.
        timestamp:
          anyOf:
            - type: number
            - type: 'null'
          title: Timestamp
          description: The commit timestamp.
        parents:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Parents
          description: Full SHA-1s of the commit's parents.
        _links:
          additionalProperties: true
          type: object
          title: Links
          description: >-
            Links to lists of what Kosli knows about this commit, such as its
            trails.
      type: object
      required:
        - sha1
        - _links
      title: CommitSearchItem
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.