> 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.

# Update a pull request

PUT https://api.getpostman.com/pull-requests/{pullRequestId}
Content-Type: application/json

Updates an open pull request.

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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /pull-requests/{pullRequestId}:
    put:
      operationId: updatePullRequest
      summary: Update a pull request
      description: Updates an open pull request.
      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/pullRequestUpdated'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/UpdatePullRequestRequestInternalServerError
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/pullRequestUpdate'
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
    pullRequestUpdate:
      type: object
      properties:
        title:
          type: string
          description: The pull request's updated title.
        description:
          type: string
          description: The updated pull request description.
        reviewers:
          type: array
          items:
            type: string
          description: >-
            An updated list of the pull request's assigned reviewers. This
            replaces all existing users assigned to the pull request with those
            you pass in the request body.
      required:
        - title
        - reviewers
      title: pullRequestUpdate
    PullRequestUpdatedStatus:
      type: string
      enum:
        - open
        - approved
        - declined
        - merged
      description: The pull request's status.
      title: PullRequestUpdatedStatus
    pullRequestUpdated:
      type: object
      properties:
        createdAt:
          type: string
          format: date-time
          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
          format: uid
          description: The pull request's merge destination ID.
        forkType:
          type: string
          description: The type of forked element.
        id:
          type: string
          description: The pull request's ID.
        sourceId:
          type: string
          format: uid
          description: The unique ID of the source element.
        status:
          $ref: '#/components/schemas/PullRequestUpdatedStatus'
          description: The pull request's status.
        title:
          type: string
          description: The pull request's title.
        updatedAt:
          type: string
          format: date-time
          description: The date and time at which the pull request was updated.
      title: pullRequestUpdated
    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
    UpdatePullRequestRequestInternalServerError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: UpdatePullRequestRequestInternalServerError
  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



**Request**

```json
{
  "title": "Updated PR title",
  "reviewers": [
    "12345678",
    "87654321"
  ],
  "description": "Updated description of the pull request."
}
```

**Response**

```json
{
  "createdAt": "2024-02-20T09:58:57.000Z",
  "createdBy": "12345678",
  "description": "Updated description of the pull request.",
  "destinationId": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2",
  "forkType": "collection",
  "id": "4e1a6609-1a29-4037-a411-89ecc14c6cd8",
  "sourceId": "87654321-3b79068c-dbe5-41d5-a826-51be4bf646ef",
  "status": "open",
  "title": "Updated PR title",
  "updatedAt": "2024-02-20T09:58:57.000Z"
}
```

**SDK Code**

```python Pull Requests_updatePullRequest_example
import requests

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

payload = {
    "title": "Updated PR title",
    "reviewers": ["12345678", "87654321"],
    "description": "Updated description of the pull request."
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript Pull Requests_updatePullRequest_example
const url = 'https://api.getpostman.com/pull-requests/4e1a6609-1a29-4037-a411-89ecc14c6cd8';
const options = {
  method: 'PUT',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"title":"Updated PR title","reviewers":["12345678","87654321"],"description":"Updated description of the pull request."}'
};

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

```go Pull Requests_updatePullRequest_example
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"title\": \"Updated PR title\",\n  \"reviewers\": [\n    \"12345678\",\n    \"87654321\"\n  ],\n  \"description\": \"Updated description of the pull request.\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Pull Requests_updatePullRequest_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::Put.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"title\": \"Updated PR title\",\n  \"reviewers\": [\n    \"12345678\",\n    \"87654321\"\n  ],\n  \"description\": \"Updated description of the pull request.\"\n}"

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

```java Pull Requests_updatePullRequest_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.getpostman.com/pull-requests/4e1a6609-1a29-4037-a411-89ecc14c6cd8")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"title\": \"Updated PR title\",\n  \"reviewers\": [\n    \"12345678\",\n    \"87654321\"\n  ],\n  \"description\": \"Updated description of the pull request.\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.getpostman.com/pull-requests/4e1a6609-1a29-4037-a411-89ecc14c6cd8', [
  'body' => '{
  "title": "Updated PR title",
  "reviewers": [
    "12345678",
    "87654321"
  ],
  "description": "Updated description of the pull request."
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Pull Requests_updatePullRequest_example
using RestSharp;

var client = new RestClient("https://api.getpostman.com/pull-requests/4e1a6609-1a29-4037-a411-89ecc14c6cd8");
var request = new RestRequest(Method.PUT);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"title\": \"Updated PR title\",\n  \"reviewers\": [\n    \"12345678\",\n    \"87654321\"\n  ],\n  \"description\": \"Updated description of the pull request.\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Pull Requests_updatePullRequest_example
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "title": "Updated PR title",
  "reviewers": ["12345678", "87654321"],
  "description": "Updated description of the pull request."
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

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 = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```