> This page is for Postman API Docs.

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt.

# Get a pull request

GET https://api.postman.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

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Servers

- `https://api.postman.com` (https://api.postman.com, default)
- `https://api.eu.postman.com` (https://api.eu.postman.com)

## Request

### Path parameters

- `pullRequestId` (string, required) — The pull request's ID.

## Response

### 200

Successful Response

- `createdAt` (string, optional) — The date and time at which the pull request was created.
- `updatedAt` (string, optional) — The date and time at which the pull request was updated.
- `id` (string, optional) — The pull request's ID.
- `title` (string, optional) — The pull request's title.
- `description` (string, optional) — The pull request's description.
- `createdBy` (string, optional) — The ID of the user who created the pull request.
- `updatedBy` (string, optional) — The ID of the user who last updated the pull request.
- `comment` (string, optional) — If the pull request is a `decline` status, an optional comment about why the pull request was declined.
- `fortkType` (string, optional) — The type of element the pull request was forked from.
- `source` (pullRequestSourceData, optional) — Information about the pull request's source (parent) element.
- `destination` (pullRequestDestinationData, optional) — Information about the pull request destination element.
- `status` (string, optional) — 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` (pullRequestMergeData, optional) — Information about the current progress of the pull request's merge.
- `reviewers` (list of pullRequestReviewersData, optional) — Information about the reviewers assigned to the pull request.

## Errors

### 403 Forbidden Error

Forbidden

- `type` (CommonErrorTypeTitleDetailStatusType, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — Information about the error.
- `status` (integer, optional) — The error's HTTP status code.

### 500 Internal Server Error

Internal Server Error

- `GetPullRequestRequestInternalServerError`
  - Error (Type, Title, Detail): commonErrorTypeTitleDetail
  - Error (Type, Title, Detail, Status): commonErrorTypeTitleDetailStatus
  - Error (Name, Message): commonErrorNameMessage

## Types

### pullRequestSourceData

Information about the pull request's source (parent) element.

- `id` (string, optional) — The pull request's source ID.
- `name` (string, optional) — The source element's name.
- `forkName` (string, optional) — The name of the fork created from the source element.
- `exists` (boolean, optional) — If true, whether the element is present and not deleted.

### pullRequestDestinationData

Information about the pull request destination element.

- `id` (string, optional) — The destination element's ID.
- `name` (string, optional) — The destination element's name.
- `exists` (boolean, optional) — If true, whether the element is present and not deleted.

### pullRequestMergeData

Information about the current progress of the pull request's merge.

- `status` (enum, optional) — 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.
  - Allowed values: `inactive`, `inprogress`, `failed`

### pullRequestReviewersData

- `id` (string, optional) — The reviewer's user ID.
- `status` (enum, optional) — The reviewer's review status response.
  - Allowed values: `approved`, `declined`

### CommonErrorTypeTitleDetailStatusType

The type of error.

- string
- string

### commonErrorTypeTitleDetail

- `type` (string, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (CommonErrorTypeTitleDetailDetail, optional) — Information about the error.

### commonErrorTypeTitleDetailStatus

- `type` (CommonErrorTypeTitleDetailStatusType, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — Information about the error.
- `status` (integer, optional) — The error's HTTP status code.

### commonErrorNameMessage

- `error` (CommonErrorNameMessageError, optional) — Information about the error.

### CommonErrorTypeTitleDetailDetail

Information about the error.

- string
- map from string to any

### CommonErrorNameMessageError

Information about the error.

- `name` (string, optional) — The error name.
- `message` (string, optional) — The error message.

## 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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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.postman.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()
```