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

# Update a package

PATCH https://api.postman.com/packages/{packageId}
Content-Type: application/merge-patch+json

Updates a package's description and/or index script content.

Reference: https://learning.postman.com/api-docs/api-reference/packages/update-package

## Authentication

- `x-api-key` header (required)

## Servers

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

## Request

### Path parameters

- `packageId` (string, required) — The package's ID.

### Body (application/merge-patch+json)

- `description` (string, optional) — The package's description. This value may be empty and only supports printable ASCII characters.
- `script` (string, optional) — The package's index script content. This value may be empty.

## Response

### 200

Package Updated

- `id` (string, required) — The package's ID.
- `name` (string, required) — The package's immutable, lowercase import name.
- `description` (string, required) — The package's description. This value may be empty and only supports printable ASCII characters.
- `script` (string, required) — The package's current index script content. This value may be empty.
- `createdBy` (integer, required) — The user ID of the user who created the package.
- `createdAt` (datetime, required) — The date and time at which the package was created.
- `updatedAt` (datetime, required) — The date and time at which the package or its script was last updated.

## Examples

### Package Updated

**Request**

```json
undefined
```

**Response**

```json
{
  "id": "3b60f5f3-cd98-4e04-b560-3eb039fe85d8",
  "name": "my-math-package",
  "description": "Updated math utility functions.",
  "script": "module.exports = { add: (a, b) => a + b };",
  "createdBy": 12345678,
  "createdAt": "2026-08-01T20:11:17.000Z",
  "updatedAt": "2026-08-01T20:11:17.000Z"
}
```

**SDK Code**

```python Package Updated
import requests

url = "https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8"

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

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

print(response.json())
```

```javascript Package Updated
const url = 'https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8';
const options = {method: 'PATCH', 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 Package Updated
package main

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

func main() {

	url := "https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8"

	req, _ := http.NewRequest("PATCH", 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 Package Updated
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8")

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

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

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

```java Package Updated
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Package Updated
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Package Updated
using RestSharp;

var client = new RestClient("https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Package Updated
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
```

### Update Package

**Request**

```json
{
  "description": "Updated math utility functions.",
  "script": "module.exports = { add: (a, b) => a + b };"
}
```

**Response**

```json
{
  "id": "3b60f5f3-cd98-4e04-b560-3eb039fe85d8",
  "name": "my-math-package",
  "description": "Updated math utility functions.",
  "script": "module.exports = { add: (a, b) => a + b };",
  "createdBy": 12345678,
  "createdAt": "2026-08-01T20:11:17.000Z",
  "updatedAt": "2026-08-01T20:11:17.000Z"
}
```

**SDK Code**

```python Update Package
import requests

url = "https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8"

payload = "{\n  \"description\": \"Updated math utility functions.\",\n  \"script\": \"module.exports = { add: (a, b) => a + b };\"\n}"
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/merge-patch+json"
}

response = requests.patch(url, data=payload, headers=headers)

print(response.json())
```

```javascript Update Package
const url = 'https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/merge-patch+json'},
  body: '{\n  "description": "Updated math utility functions.",\n  "script": "module.exports = { add: (a, b) => a + b };"\n}'
};

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

```go Update Package
package main

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

func main() {

	url := "https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8"

	payload := strings.NewReader("{\n  \"description\": \"Updated math utility functions.\",\n  \"script\": \"module.exports = { add: (a, b) => a + b };\"\n}")

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

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

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

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

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

}
```

```ruby Update Package
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8")

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

request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/merge-patch+json'
request.body = "{\n  \"description\": \"Updated math utility functions.\",\n  \"script\": \"module.exports = { add: (a, b) => a + b };\"\n}"

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

```java Update Package
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/merge-patch+json")
  .body("{\n  \"description\": \"Updated math utility functions.\",\n  \"script\": \"module.exports = { add: (a, b) => a + b };\"\n}")
  .asString();
```

```php Update Package
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8', [
  'body' => '{
  "description": "Updated math utility functions.",
  "script": "module.exports = { add: (a, b) => a + b };"
}',
  'headers' => [
    'Content-Type' => 'application/merge-patch+json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Update Package
using RestSharp;

var client = new RestClient("https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/merge-patch+json");
request.AddParameter("application/merge-patch+json", "{\n  \"description\": \"Updated math utility functions.\",\n  \"script\": \"module.exports = { add: (a, b) => a + b };\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Update Package
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/merge-patch+json"
]

let postData = NSData(data: "{
  "description": "Updated math utility functions.",
  "script": "module.exports = { add: (a, b) => a + b };"
}".data(using: String.Encoding.utf8)!)

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/packages/3b60f5f3-cd98-4e04-b560-3eb039fe85d8")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
```