---
title: "List pull requests"
method: GET
path: "/api/v2/engineering-insights/pull-requests"
tags: ["Insights pull requests (beta)"]
---

# List pull requests

`GET /api/v2/engineering-insights/pull-requests`

Get a list of pull requests

### Expanding the pull request collection response

LaunchDarkly supports expanding the pull request collection response to include additional fields.

To expand the response, append the `expand` query parameter and include the following:

* `deployments` includes details on all of the deployments associated with each pull request
* `flagReferences` includes details on all of the references to flags in each pull request
* `leadTime` includes details about the lead time of the pull request for each stage

For example, use `?expand=deployments` to include the `deployments` field in the response. By default, this field is **not** included in the response.

## Query parameters

- `projectKey` string, string, required — The project key
- `environmentKey` string, string — Required if you are using the <code>sort</code> parameter's <code>leadTime</code> option to sort pull requests.
- `applicationKey` string, string — Filter the results to pull requests deployed to a comma separated list of applications
- `status` string, string — Filter results to pull requests with the given status. Options: `open`, `merged`, `closed`, `deployed`.
- `query` string, string — Filter list of pull requests by title or author
- `limit` integer — The number of pull requests to return. Default is 20. Maximum allowed is 100.
- `expand` string, string — Expand properties in response. Options: `deployments`, `flagReferences`, `leadTime`.
- `sort` string, string — Sort results. Requires the `environmentKey` to be set. Options: `leadTime` (asc) and `-leadTime` (desc). When query option is excluded, default sort is by created or merged date.
- `from` string, date-time
- `to` string, date-time
- `after` string, string — Identifier used for pagination
- `before` string, string — Identifier used for pagination

## Response `200`

Pull request collection response

- PullRequestCollectionRep
  - `totalCount` integer, required — The total number of pull requests
  - `items` PullRequestRep[], required — A list of pull requests
    - `id` string, uuid, required — The pull request internal ID
    - `externalId` string, required — The pull request number
    - `title` string, required — The pull request title
    - `status` string, required — The pull request status
    - `author` string, required — The pull request author
    - `createTime` integer, required
    - `mergeTime` integer
    - `mergeCommitKey` string — The pull request merge commit key
    - `baseCommitKey` string, required — The pull request base commit key
    - `headCommitKey` string, required — The pull request head commit key
    - `filesChanged` integer, required — The number of files changed
    - `linesAdded` integer, required — The number of lines added
    - `linesDeleted` integer, required — The number of lines deleted
    - `url` string, required — The pull request URL
    - `deployments` DeploymentCollectionRep
      - `totalCount` integer, required — The total number of deployments
      - `items` DeploymentRep[], required — A list of deployments
        - `id` string, uuid, required — The deployment ID
        - `applicationKey` string, required — The application key
        - `applicationVersion` string, required — The application version
        - `startedAt` integer, required
        - `endedAt` integer
        - `durationMs` integer — The duration of the deployment in milliseconds
        - `status` string, required
        - `kind` string, required
        - `active` boolean, required — Whether the deployment is active
        - `metadata` object — The metadata associated with the deployment
        - `archived` boolean, required — Whether the deployment is archived
        - `environmentKey` string, required — The environment key
        - `numberOfContributors` integer, required — The number of contributors
        - `numberOfPullRequests` integer, required — The number of pull requests
        - `linesAdded` integer, required — The number of lines added
        - `linesDeleted` integer, required — The number of lines deleted
        - `leadTime` integer, required — The total lead time from first commit to deployment end in milliseconds
        - `pullRequests` PullRequestCollectionRep — recursive
        - `flagReferences` FlagReferenceCollectionRep
          - `totalCount` integer, required — The total number of flag references
          - `items` FlagReferenceRep[], required — A list of flag references
            - `projectKey` string, required — The project key
            - `flagKey` string, required — The flag key
            - `referencesAdded` integer, required — The number of references added
            - `referencesRemoved` integer, required — The number of references removed
        - `leadTimeStages` LeadTimeStagesRep
          - `codingDurationMs` integer, required — The coding duration in milliseconds
          - `reviewDurationMs` integer — The review duration in milliseconds
          - `waitDurationMs` integer — The wait duration between merge time and deploy start time in milliseconds
          - `deployDurationMs` integer — The deploy duration in milliseconds
          - `totalLeadTimeMs` integer — The total lead time in milliseconds
      - `_links` object — The location and content type of related resources
    - `flagReferences` FlagReferenceCollectionRep
      - `totalCount` integer, required — The total number of flag references
      - `items` FlagReferenceRep[], required — A list of flag references
        - `projectKey` string, required — The project key
        - `flagKey` string, required — The flag key
        - `referencesAdded` integer, required — The number of references added
        - `referencesRemoved` integer, required — The number of references removed
    - `leadTime` PullRequestLeadTimeRep
      - `codingDurationMs` integer, required — The coding duration in milliseconds
      - `reviewDurationMs` integer — The review duration in milliseconds
      - `maxWaitDurationMs` integer — The max wait duration between merge time and deploy start time in milliseconds
      - `avgWaitDurationMs` integer — The average wait duration between merge time and deploy start time in milliseconds
      - `maxDeployDurationMs` integer — The max deploy duration in milliseconds
      - `avgDeployDurationMs` integer — The average deploy duration in milliseconds
      - `maxTotalLeadTimeMs` integer — The max total lead time in milliseconds
      - `avgTotalLeadTimeMs` integer — The average total lead time in milliseconds
  - `_links` object — The location and content type of related resources

## Other responses

- `400` — Invalid request
- `401` — Invalid access token
- `403` — Forbidden
- `404` — Invalid resource identifier
- `429` — Rate limited

---

[API](https://skmtc.net/launchdarkly/apis/launchdarkly-rest-api.md) · [All operations](https://skmtc.net/launchdarkly/apis/launchdarkly-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/launchdarkly/launchdarkly-rest-api/versions/69c5c9aafe78/schema)
