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

PATCH https://api.getpostman.com/components/{componentId}
Content-Type: application/json

Updates a component:
  - `name` — Rename the component. The new name must be unique within the team. Archived components can't be renamed.
  - `status` — Changes the component's lifecycle state:
    - `archive` — Marks the component as read-only. Archived components aren't deleted and can't be edited or published, but their existing versions remain accessible.
    - `active` — Restores the component. Only active components can be edited and published.

**Note:**

You can't update a name and archived state in a single call. To change both properties, make separate calls to update the name and status.


Reference: https://learning.postman.com/api-docs/api-reference/components/update-component

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /components/{componentId}:
    patch:
      operationId: updateComponent
      summary: Update a component
      description: >
        Updates a component:
          - `name` — Rename the component. The new name must be unique within the team. Archived components can't be renamed.
          - `status` — Changes the component's lifecycle state:
            - `archive` — Marks the component as read-only. Archived components aren't deleted and can't be edited or published, but their existing versions remain accessible.
            - `active` — Restores the component. Only active components can be edited and published.

        **Note:**


        You can't update a name and archived state in a single call. To change
        both properties, make separate calls to update the name and status.
      tags:
        - components
      parameters:
        - name: componentId
          in: path
          description: The component's ID.
          required: true
          schema:
            $ref: '#/components/schemas/componentId'
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Component Updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/updateComponentResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateComponentRequestUnauthorizedError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateComponentRequestForbiddenError'
        '404':
          description: Not Found
          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/UpdateComponentRequestInternalServerError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/updateComponent'
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:
    componentId:
      type: string
      description: The component's ID.
      title: componentId
    updateComponent:
      oneOf:
        - description: Any type
        - description: Any type
      title: updateComponent
    componentStatus:
      type: string
      enum:
        - active
        - archived
      description: >
        The component's lifecycle state:

        - `active` — The component is active and can be edited and published.

        - `archived` — The component is archived and read-only. Archived
        components can't be edited or published, but their existing versions
        remain accessible.
      title: componentStatus
    updateComponentResponse:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/componentId'
        name:
          type: string
          description: The component's name.
        status:
          $ref: '#/components/schemas/componentStatus'
      description: Information about the component.
      title: updateComponentResponse
    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
    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
    UpdateComponentRequestUnauthorizedError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: UpdateComponentRequestUnauthorizedError
    UpdateComponentRequestForbiddenError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: UpdateComponentRequestForbiddenError
    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
    UpdateComponentRequestInternalServerError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: UpdateComponentRequestInternalServerError
  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

### Component Updated



**Request**

```json
undefined
```

**Response**

```json
{
  "id": "01KT964C30J3DPJQKEACZH39N8",
  "name": "update-component-name",
  "status": "active"
}
```

**SDK Code**

```python Component Updated
import requests

url = "https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8"

headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Component Updated
const url = 'https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: undefined
};

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

```go Component Updated
package main

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

func main() {

	url := "https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8"

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

	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 Component Updated
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8")

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/json'

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

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

HttpResponse<String> response = Unirest.patch("https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Component Updated
using RestSharp;

var client = new RestClient("https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Component Updated
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8")! 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()
```

### Rename Component



**Request**

```json
{
  "name": "update-component-name"
}
```

**Response**

```json
{
  "id": "01KT964C30J3DPJQKEACZH39N8",
  "name": "update-component-name",
  "status": "active"
}
```

**SDK Code**

```python Rename Component
import requests

url = "https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8"

payload = { "name": "update-component-name" }
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Rename Component
const url = 'https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"update-component-name"}'
};

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

```go Rename Component
package main

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

func main() {

	url := "https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8"

	payload := strings.NewReader("{\n  \"name\": \"update-component-name\"\n}")

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

url = URI("https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8")

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/json'
request.body = "{\n  \"name\": \"update-component-name\"\n}"

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

```java Rename Component
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"update-component-name\"\n}")
  .asString();
```

```php Rename Component
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8', [
  'body' => '{
  "name": "update-component-name"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Rename Component
using RestSharp;

var client = new RestClient("https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"update-component-name\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Rename Component
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["name": "update-component-name"] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8")! 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()
```

### Update Component Status



**Request**

```json
{
  "name": "update-component-name",
  "status": "archived"
}
```

**Response**

```json
{
  "id": "01KT964C30J3DPJQKEACZH39N8",
  "name": "update-component-name",
  "status": "active"
}
```

**SDK Code**

```python Update Component Status
import requests

url = "https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8"

payload = {
    "name": "update-component-name",
    "status": "archived"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Update Component Status
const url = 'https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8';
const options = {
  method: 'PATCH',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"update-component-name","status":"archived"}'
};

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

```go Update Component Status
package main

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

func main() {

	url := "https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8"

	payload := strings.NewReader("{\n  \"name\": \"update-component-name\",\n  \"status\": \"archived\"\n}")

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

url = URI("https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8")

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/json'
request.body = "{\n  \"name\": \"update-component-name\",\n  \"status\": \"archived\"\n}"

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

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

HttpResponse<String> response = Unirest.patch("https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"update-component-name\",\n  \"status\": \"archived\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8', [
  'body' => '{
  "name": "update-component-name",
  "status": "archived"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Update Component Status
using RestSharp;

var client = new RestClient("https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8");
var request = new RestRequest(Method.PATCH);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"update-component-name\",\n  \"status\": \"archived\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Update Component Status
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "update-component-name",
  "status": "archived"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/components/01KT964C30J3DPJQKEACZH39N8")! 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()
```