> 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 pull request

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

Gets information about a pull request, such as the source and destination details, who reviewed the pull request, the merge's current status, and whether the element is accessible.

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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /pull-requests/{pullRequestId}:
    get:
      operationId: getPullRequest
      summary: Get a pull request
      description: >-
        Gets information about a pull request, such as the source and
        destination details, who reviewed the pull request, the merge's current
        status, and whether the element is accessible.
      tags:
        - pullRequests
      parameters:
        - name: pullRequestId
          in: path
          description: The pull request's ID.
          required: true
          schema:
            $ref: '#/components/schemas/pullRequestId'
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pullRequestGet'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPullRequestRequestInternalServerError'
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:
    pullRequestId:
      type: string
      title: pullRequestId
    PullRequestGetSource:
      type: object
      properties:
        id:
          type: string
          description: The pull request's source ID.
        name:
          type: string
          description: The source element's name.
        forkName:
          type: string
          description: The name of the fork created from the source element.
        exists:
          type: boolean
          description: If true, whether the element is present and not deleted.
      description: Information about the pull request's source (parent) element.
      title: PullRequestGetSource
    PullRequestGetDestination:
      type: object
      properties:
        id:
          type: string
          description: The destination element's ID.
        name:
          type: string
          description: The destination element's name.
        exists:
          type: boolean
          description: If true, whether the element is present and not deleted.
      description: Information about the pull request destination element.
      title: PullRequestGetDestination
    PullRequestGetMergeStatus:
      type: string
      enum:
        - inactive
        - inprogress
        - failed
      description: |
        The pull request's current merge status:
        - `inactive` — There is no merge in progress.
        - `inprogress` — The pull request is currently merging.
        - `failed` — The pull request's merge failed.
      title: PullRequestGetMergeStatus
    PullRequestGetMerge:
      type: object
      properties:
        status:
          $ref: '#/components/schemas/PullRequestGetMergeStatus'
          description: |
            The pull request's current merge status:
            - `inactive` — There is no merge in progress.
            - `inprogress` — The pull request is currently merging.
            - `failed` — The pull request's merge failed.
      description: Information about the current progress of the pull request's merge.
      title: PullRequestGetMerge
    PullRequestGetReviewersItems:
      type: object
      properties:
        id:
          type: string
          description: The reviewer's user ID.
        status:
          type: string
          description: |
            The reviewer's review status response. One of:
            - `approved`
            - `declined`
      title: PullRequestGetReviewersItems
    pullRequestGet:
      type: object
      properties:
        createdAt:
          type: string
          description: The date and time at which the pull request was created.
        updatedAt:
          type: string
          description: The date and time at which the pull request was updated.
        id:
          type: string
          description: The pull request's ID.
        title:
          type: string
          description: The pull request's title.
        description:
          type: string
          description: The pull request's description.
        createdBy:
          type: string
          description: The ID of the user who created the pull request.
        updatedBy:
          type: string
          description: The ID of the user who last updated the pull request.
        comment:
          type: string
          description: >-
            If the pull request is a `decline` status, an optional comment about
            why the pull request was declined.
        fortkType:
          type: string
          description: The type of element the pull request was forked from.
        source:
          $ref: '#/components/schemas/PullRequestGetSource'
          description: Information about the pull request's source (parent) element.
        destination:
          $ref: '#/components/schemas/PullRequestGetDestination'
          description: Information about the pull request destination element.
        status:
          type: string
          description: |
            The pull request's current review status:
            - `open` — The pull request is still open.
            - `approved` — The pull request was approved by its reviewers.
            - `declined` — The pull request was not approved by its reviewers.
        merge:
          $ref: '#/components/schemas/PullRequestGetMerge'
          description: Information about the current progress of the pull request's merge.
        reviewers:
          type: array
          items:
            $ref: '#/components/schemas/PullRequestGetReviewersItems'
          description: Information about the reviewers assigned to the pull request.
      title: pullRequestGet
    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
    GetPullRequestRequestInternalServerError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: GetPullRequestRequestInternalServerError
  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
{
  "createdAt": "2024-02-20T09:55:46.000Z",
  "updatedAt": "2024-02-20T09:58:38.000Z",
  "id": "4e1a6609-1a29-4037-a411-89ecc14c6cd8",
  "title": "Test PR",
  "description": "This is a test pull request.",
  "createdBy": "12345678",
  "updatedBy": "12345678",
  "comment": "Missing descriptions in requests",
  "source": {
    "id": "87654321-3b79068c-dbe5-41d5-a826-51be4bf646ef",
    "name": "test-collection",
    "forkName": "Taylor Lee's fork",
    "exists": true
  },
  "destination": {
    "id": "123456789-24f57217-1169-4b7c-a810-0e957c04eaa5",
    "name": "test-collection",
    "exists": true
  },
  "status": "declined",
  "merge": {
    "status": "inactive"
  },
  "reviewers": [
    {
      "id": "12345678",
      "status": "declined"
    }
  ],
  "forkType": "collection"
}
```

**SDK Code**

```python Pull Requests_getPullRequest_example
import requests

url = "https://api.getpostman.com/pull-requests/4e1a6609-1a29-4037-a411-89ecc14c6cd8"

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

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

print(response.json())
```

```javascript Pull Requests_getPullRequest_example
const url = 'https://api.getpostman.com/pull-requests/4e1a6609-1a29-4037-a411-89ecc14c6cd8';
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 Pull Requests_getPullRequest_example
package main

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

func main() {

	url := "https://api.getpostman.com/pull-requests/4e1a6609-1a29-4037-a411-89ecc14c6cd8"

	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 Pull Requests_getPullRequest_example
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/pull-requests/4e1a6609-1a29-4037-a411-89ecc14c6cd8")

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 Pull Requests_getPullRequest_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.getpostman.com/pull-requests/4e1a6609-1a29-4037-a411-89ecc14c6cd8")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Pull Requests_getPullRequest_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.getpostman.com/pull-requests/4e1a6609-1a29-4037-a411-89ecc14c6cd8', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Pull Requests_getPullRequest_example
using RestSharp;

var client = new RestClient("https://api.getpostman.com/pull-requests/4e1a6609-1a29-4037-a411-89ecc14c6cd8");
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Pull Requests_getPullRequest_example
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/pull-requests/4e1a6609-1a29-4037-a411-89ecc14c6cd8")! 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()
```