> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt. For full content including API reference and SDK examples, see https://learning.postman.com/llms-full.txt.

# Get a collection's pull requests

GET https://api.getpostman.com/collections/{collectionId}/pull-requests

Gets information about a collection's pull requests, such as the source and destination IDs, status of the pull requests, and a URL link to the pull requests.

Reference: https://learning.postman.com/api-docs/api-reference/collections/get-collection-pull-requests

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /collections/{collectionId}/pull-requests:
    get:
      operationId: getCollectionPullRequests
      summary: Get a collection's pull requests
      description: >-
        Gets information about a collection's pull requests, such as the source
        and destination IDs, status of the pull requests, and a URL link to the
        pull requests.
      tags:
        - collections
      parameters:
        - name: collectionId
          in: path
          description: The collection's unique ID.
          required: true
          schema:
            $ref: '#/components/schemas/collectionUid'
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getCollectionPullRequests'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/GetCollectionPullRequestsRequestInternalServerError
servers:
  - url: https://api.getpostman.com
    description: https://api.getpostman.com
  - url: https://api.eu.postman.com
    description: https://api.eu.postman.com
components:
  schemas:
    collectionUid:
      type: string
      format: uid
      title: collectionUid
    GetCollectionPullRequestsDataItemsStatus:
      type: string
      enum:
        - open
        - approved
        - declined
        - merged
      description: The pull request's current status.
      title: GetCollectionPullRequestsDataItemsStatus
    GetCollectionPullRequestsDataItems:
      type: object
      properties:
        createdAt:
          type: string
          description: The date and time at which the pull request was created.
        createdBy:
          type: string
          description: The ID of the user who created the pull request.
        description:
          type: string
          description: The pull request's description.
        destinationId:
          type: string
          description: The pull request's merge destination ID.
        href:
          type: string
          description: A URL where you can view the pull request's details.
        id:
          type: string
          description: The pull request's ID.
        sourceId:
          type: string
          description: The pull request's source (parent) ID.
        status:
          $ref: '#/components/schemas/GetCollectionPullRequestsDataItemsStatus'
          description: The pull request's current status.
        comment:
          type: string
          description: >-
            If the pull request is declined, a comment about why the pull
            request was declined.
        title:
          type: string
          description: The pull request's title.
        updatedBy:
          type: string
          description: The ID of the user who updated the pull request.
        updatedAt:
          type: string
          format: date-time
          description: The date and time at which the pull request was updated.
      description: Information about the pull request.
      title: GetCollectionPullRequestsDataItems
    getCollectionPullRequests:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/GetCollectionPullRequestsDataItems'
      title: getCollectionPullRequests
    CommonErrorTypeTitleDetailStatusType:
      oneOf:
        - type: string
          format: uri-reference
        - type: string
      title: CommonErrorTypeTitleDetailStatusType
    commonErrorTypeTitleDetailStatus:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CommonErrorTypeTitleDetailStatusType'
        title:
          type: string
          description: A short summary of the problem.
        detail:
          type: string
          description: Information about the error.
        status:
          type: integer
          description: The error's HTTP status code.
      title: commonErrorTypeTitleDetailStatus
    CommonErrorTypeTitleDetailDetail:
      oneOf:
        - type: string
        - type: object
          additionalProperties:
            description: Any type
      description: Information about the error.
      title: CommonErrorTypeTitleDetailDetail
    commonErrorTypeTitleDetail:
      type: object
      properties:
        type:
          type: string
          description: The type of error.
        title:
          type: string
          description: A short summary of the problem.
        detail:
          $ref: '#/components/schemas/CommonErrorTypeTitleDetailDetail'
          description: Information about the error.
      title: commonErrorTypeTitleDetail
    CommonErrorNameMessageError:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
      description: Information about the error.
      title: CommonErrorNameMessageError
    commonErrorNameMessage:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/CommonErrorNameMessageError'
          description: Information about the error.
      title: commonErrorNameMessage
    GetCollectionPullRequestsRequestInternalServerError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: GetCollectionPullRequestsRequestInternalServerError
  securitySchemes:
    PostmanApiKey:
      type: apiKey
      in: header
      name: x-api-key
    scimApiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        A valid [SCIM API
        key](https://learning.postman.com/docs/administration/scim-provisioning/scim-provisioning-overview/#generating-scim-api-key)
        for calls to SCIM endpoints.
    basicAuth:
      type: http
      scheme: basic

```

## Examples



**Response**

```json
{
  "data": [
    {
      "createdAt": "2024-02-20T09:55:46.000Z",
      "createdBy": "12345678",
      "description": "This is an open pull request.",
      "destinationId": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2",
      "href": "/pull-requests/4e1a6609-1a29-4037-a411-89ecc14c6cd8",
      "id": "4e1a6609-1a29-4037-a411-89ecc14c6cd8",
      "sourceId": "87654321-3b79068c-dbe5-41d5-a826-51be4bf646ef",
      "status": "open",
      "title": "Open PR",
      "updatedBy": "12345678",
      "updatedAt": "2024-02-20T09:58:38.000Z"
    },
    {
      "createdAt": "2024-02-20T09:58:57.000Z",
      "createdBy": "12345678",
      "description": "This is an approved PR.",
      "destinationId": "12345678-24f57217-1169-4b7c-a810-0e957c04eaa5",
      "href": "/pull-requests/ac959187-568f-4e5e-9d17-584eb44fbed2",
      "id": "ac959187-568f-4e5e-9d17-584eb44fbed2",
      "sourceId": "87654321-e50a18a3-0dcd-49cb-afa5-d3a82cdf6134",
      "status": "approved",
      "title": "Approved PR",
      "updatedBy": "12345678",
      "updatedAt": "2024-02-20T09:58:57.000Z"
    },
    {
      "createdAt": "2024-02-20T09:55:46.000Z",
      "createdBy": "12345678",
      "description": "This is a declined PR.",
      "destinationId": "12345678-c7f30bd9-5cc7-4569-a5fe-92270af33c6c",
      "href": "/pull-requests/eda21e1f-8688-43aa-8660-35337dbac04b",
      "id": "eda21e1f-8688-43aa-8660-35337dbac04b",
      "sourceId": "87654321-4beee503-1a7a-4925-a165-16fc29eaad22",
      "status": "declined",
      "comment": "Missing information.",
      "title": "Declined PR",
      "updatedBy": "12345678",
      "updatedAt": "2024-02-20T09:58:38.000Z"
    }
  ]
}
```

**SDK Code**

```python Successful Response
import requests

url = "https://api.getpostman.com/collections/12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2/pull-requests"

headers = {"x-api-key": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript Successful Response
const url = 'https://api.getpostman.com/collections/12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2/pull-requests';
const options = {method: 'GET', headers: {'x-api-key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Successful Response
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.getpostman.com/collections/12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2/pull-requests"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Successful Response
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/collections/12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2/pull-requests")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Successful Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.getpostman.com/collections/12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2/pull-requests")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Successful Response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.getpostman.com/collections/12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2/pull-requests', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Successful Response
using RestSharp;

var client = new RestClient("https://api.getpostman.com/collections/12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2/pull-requests");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Successful Response
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/collections/12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2/pull-requests")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```