---
title: "Measure the amount of code that was pushed outside of pull requests."
method: POST
path: "/metrics/code_bypassing_prs"
tags: ["metrics", "default"]
---

# Measure the amount of code that was pushed outside of pull requests.

`POST /metrics/code_bypassing_prs`

## Request

- Base URL: `{{ server_url }}/v1`
- URL: `{{ server_url }}/v1/metrics/code_bypassing_prs`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`
- TypeScript: <https://skmtc.dev/athenian/apis/title/docs/metrics/code_bypassing_prs/post.ts> (a function with typed inputs; its response is checked against the schema)

## Request body

- CodeFilter: Filter for revealing code bypassing PRs.
  - `account` integer, required: Session account ID.
  - `date_from` string, date, required: Commits must be made later than or equal to this date.
  - `date_to` string, date, required: Commits must be made earlier than or equal to this date.
  - `timezone` integer: Local time zone offset in minutes, used to adjust `date_from` and `date_to`.
  - `in` RepositoryID[], required: Set of repositories. An empty list raises a bad response 400. Duplicates are automatically ignored.
  - `with_author` DeveloperID[]: A set of developers. An empty list disables the filter and includes everybody. Duplicates are automatically ignored.
  - `with_committer` DeveloperID[]: A set of developers. An empty list disables the filter and includes everybody. Duplicates are automatically ignored.
  - `granularity` string, required: How often the metrics are reported. The value must satisfy the following regular expression: /^all|(([1-9]\d* )?(aligned )?(day|week|month|year))$/. "all" produces a single interval [`date_from`, `date_to`]. "aligned week/month/year" produces intervals cut by calendar week/month/year borders, for example, when `date_from` is `2020-01-15` and `date_to` is `2020-03-10`, the intervals will be `2020-01-15` - `2020-02-01` - `2020-03-01` - `2020-03-10`.
  - `only_default_branch` boolean: Consider only commits that are accessible from the head of the default branch. For example, if your workflow includes PR-ing feature branches, you rebase and merge them and don't delete afterward, `bypassing_prs` will report the commits in those feature branches unless you set `only_default_branch` to `true`.

## Response `200`

Calculated metrics.

- CodeBypassingPRsMeasurement[]: Statistics about code pushed outside of pull requests.
  - `date` string, date, required: Commits were pushed beginning with this date. They were not pushed later than +granularity.
  - `bypassed_commits` integer, required: Number of commits that bypassed PRs in the time interval.
  - `bypassed_lines` integer, required: Number of changed (added + removed) lines that bypassed PRs in the time interval.
  - `total_commits` integer, required: Overall number of commits in the time interval.
  - `total_lines` integer, required: Overall number of changed (added + removed) lines in the time interval.

## Other responses

- `400`: The request is invalid.
- `403`: The user is forbidden to access the specified repositories on behalf of the specified account.
- `404`: The specified account does not exist or the user is not a member.
- `422`: The account's installation has not finished yet.

---

[API](https://skmtc.dev/athenian/apis/title.md) - [All operations](https://skmtc.dev/athenian/apis/title/llms.txt) - [OpenAPI document](https://skmtc.dev/athenian/apis/title/revisions/110c9f7cffdd?raw)
