API guide: Unreviewed PRs by PR state

API guide: Unreviewed PRs by PR state

Unreviewed PRs are PRs with no comments or approvals. Pulling a list of unreviewed PRs can be done in one API call. This guide will show you how to export open, closed, or merged unreviewed PRs via the API.

This article gives you options to configure your view of how PRs are being reviewed in your organization. In Flow reports, a PR is considered reviewed if it is merged and has at least one comment. Approvals only count if they’re from GitHub, where they are actually counted as comments. To get your Unreviewed PRs number to match Flow reports, use the Collaboration metrics API.


Merged or closed unreviewed PRs

Use the Pull requests endpoint to find all merged or closed PRs with no comments.

https://<workspace>.appfireflow.com/v3/customer/core/pull_requests?/closed_at__gte=START_DATE&closed_at__lte=END_DATE&reviewer_comment_count=0&fields=id,title,number,state,created_by_id,reviewer_comment_count,approval_count

  • <workspace>: Your unique workspace.

  • START_DATE/END_DATE: Select your start and end dates. Only PRs closed or merged between these dates are included in the response.

  • fields: Use this to select which fields to include in your results. Modify this based on your needs, but this API call will show you

    • PR ID

    • PR Title

    • PR Number

    • State: merged or closed

    • Created by ID: use this ID to locate the User name in the user_alias endpoint

    • Reviewer comment count: due to the parameters set in the API call, this should be zero for all PRs in the response

    • Approval count

GitHub approvals are a type of comment. When reviewer_comment_count=0, the approval_count should also be 0. For other Git hosts, approvals are separate from the reviewer_comment_count, so you can have a PR with zero comments but one or more approvals.

Your results will look something like this:

<count>3</count> <results> <list-item>     <id>123</id>     <title>Configuration update</title>     <number>3</number>     <state>closed</state>     <created_by_id>111112</created_by_id>     <approval_count>0</approval_count>     <reviewer_comment_count>0</reviewer_comment_count> </list-item> <list-item>     <id>456</id>     <title>Troubleshoot form</title>     <number>627</number>     <state>merged</state>     <created_by_id>22345</created_by_id>     <approval_count>0</approval_count>     <reviewer_comment_count>0</reviewer_comment_count> </list-item> <list-item>     <id>789</id>     <title>Correcting string formatting</title>     <number>278</number>     <state>merged</state>     <created_by_id>24789</created_by_id>     <approval_count>4</approval_count>     <reviewer_comment_count>0</reviewer_comment_count> </list-item>

In the example above, there are three merged or closed PRs with no comments. One of those does have approvals, so we will exclude this PR from our total Unreviewed merged/closed PR count.

PR ID: 123: 0 comments and 0 approvals = unreviewed

PR ID: 456: 0 comments and 0 approvals = unreviewed

PR ID: 789: 0 comments and 4 approvals = reviewed

Total merged/closed unreviewed PRs = 2

For GitHub-hosted repositories, your unreviewed PR total will be the total number of PRs in the API response. If your repos are hosted on a Git host other than GitHub, export this data into a CSV file and remove any PRs with one or more approvals, as these PRs have been reviewed. You can export this data by appending format=csv to the end of your API call:

https://<workspace>.appfireflow.com/v3/customer/core/pull_requests/?closed_at__gte=START_DATE&closed_at__lte=END_DATE&reviewer_comment_count=0&fields=id,title,number,state,created_by_id,reviewer_comment_count,approval_count&format=csv

Open unreviewed PRs

To calculate the total number of unreviewed open PRs, the initial API call changes slightly, but the process is the same as above.

Begin by finding all open PRs with no comments that were created during a specific timeframe and remain open.

https://<workspace>.appfireflow.com/v3/customer/core/pull_requests/?created_at__gte=START_DATE&created_at__lte=END_DATE&state=open&reviewer_comment_count=0&fields=id,title,number,state,created_by_id,reviewer_comment_count,approval_count

  • <workspace>: Your unique workspace.

  • START_DATE/END_DATE: Select your start and end dates. Only PRs created between the selected dates are included in the response.

  • state: Use this filter to select which state the PRs in the response are in. In this example, we're only returning open PRs.

  • fields: This filter lets you select which fields to include in your results. You can modify this based on your needs.

Your results will look something like this:

<count>2</count> <results> <list-item>     <id>1012</id>     <title>Disable for sandboxes</title>     <number>100</number>     <state>open</state>     <created_by_id>3356</created_by_id>     <approval_count>1</approval_count>     <reviewer_comment_count>0</reviewer_comment_count> </list-item> <list-item>     <id>1314</id>     <title>Rearranged directory</title>     <number>101</number>     <state>open</state>     <created_by_id>32303</created_by_id>     <approval_count>0</approval_count>     <reviewer_comment_count>0</reviewer_comment_count> </list-item>

In the above example, there are two open PRs with zero comments during the selected time period. One of the PRs does have an approval, so the total number of unreviewed open PRs is one.

PR ID 1012: 0 comments and 1 approval = reviewed

PR ID 1314: 0 comments and 0 approvals = unreviewed

Total unreviewed open PRs = 1

Remember, if your repos are not hosted with GitHub, approvals will be tracked separately from comments, so you will need to export your results and exclude any PR with one or more approvals from your total.

Need support? Create a request with our support team.

Copyright © 2005 - 2026 Appfire | All rights reserved.