> ## 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.

# Build frequency statistics

> Build-frequency series for a repo within a time window.

Returns one timestamp per build (deduplicated by fingerprint) plus the
resolved window bounds and a count. Daily bucketing and the median are
computed client-side.

- end_ts defaults to now.
- start_ts defaults to 28 days before end_ts.



## OpenAPI

````yaml https://app.kosli.com/api/v2/openapi.json get /builds/{org}/statistics
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:
  /builds/{org}/statistics:
    get:
      tags:
        - Builds
      summary: Build frequency statistics
      description: |-
        Build-frequency series for a repo within a time window.

        Returns one timestamp per build (deduplicated by fingerprint) plus the
        resolved window bounds and a count. Daily bucketing and the median are
        computed client-side.

        - end_ts defaults to now.
        - start_ts defaults to 28 days before end_ts.
      operationId: build_statistics
      parameters:
        - name: org
          in: path
          required: true
          schema:
            type: string
            title: Org
        - name: repo_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter by external VCS repo ID
            title: Repo Id
          description: Filter by external VCS repo ID
        - name: repo_name
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Filter by repo name (e.g. 'cyber-dojo/differ')
            title: Repo Name
          description: Filter by repo name (e.g. 'cyber-dojo/differ')
        - name: repo_inner_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Filter by the repo's internal id (the `id` in the repo response).
              The stable identifier: unaffected by repo renames or a missing
              external VCS id.
            title: Repo Inner Id
          description: >-
            Filter by the repo's internal id (the `id` in the repo response).
            The stable identifier: unaffected by repo renames or a missing
            external VCS id.
        - name: start_ts
          in: query
          required: false
          schema:
            anyOf:
              - type: number
              - type: 'null'
            description: >-
              Include builds created at or after this timestamp. Defaults to 28
              days before end_ts
            title: Start Ts
          description: >-
            Include builds created at or after this timestamp. Defaults to 28
            days before end_ts
        - name: end_ts
          in: query
          required: false
          schema:
            anyOf:
              - type: number
              - type: 'null'
            description: >-
              Include builds created at or before this timestamp. Defaults to
              now
            title: End Ts
          description: Include builds created at or before this timestamp. Defaults to now
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BuildStatisticsResponse'
      security:
        - HTTPBearer: []
        - HTTPBasic: []
components:
  schemas:
    BuildStatisticsResponse:
      properties:
        builds:
          items:
            $ref: '#/components/schemas/BuildStatisticsItem'
          type: array
          title: Builds
        start_ts:
          type: number
          title: Start Ts
        end_ts:
          type: number
          title: End Ts
        count:
          type: integer
          title: Count
        _links:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Links
      type: object
      required:
        - builds
        - start_ts
        - end_ts
        - count
      title: BuildStatisticsResponse
      description: |-
        Raw build-frequency series for the repo Build tab's chart.

        The daily bucketing and median are computed client-side, so this returns
        only the per-build timestamps in the window plus the window bounds and a
        count. The series is deduplicated by fingerprint (one entry per build),
        matching the builds list's total_count over the same window.
    BuildStatisticsItem:
      properties:
        created_at:
          type: number
          title: Created At
      type: object
      required:
        - created_at
      title: BuildStatisticsItem
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````