> 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 an API's comment

PUT https://api.getpostman.com/apis/{apiId}/comments/{commentId}
Content-Type: application/json

Updates a comment on an API.

**Note:**

This endpoint accepts a max of 10,000 characters.


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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /apis/{apiId}/comments/{commentId}:
    put:
      operationId: updateApiComment
      summary: Update an API's comment
      description: |
        Updates a comment on an API.

        **Note:**

        This endpoint accepts a max of 10,000 characters.
      tags:
        - api
      parameters:
        - name: apiId
          in: path
          description: The API's ID.
          required: true
          schema:
            $ref: '#/components/schemas/apiId'
        - name: commentId
          in: path
          description: The comment's ID.
          required: true
          schema:
            $ref: '#/components/schemas/commentId'
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commentCreatedUpdated'
        '400':
          description: Missing v10 Accept Header
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/apiErrorNameMessage'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/commentUpdate'
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:
    apiId:
      type: string
      title: apiId
    commentId:
      type: integer
      title: commentId
    CommentTaggedUsersUserNameType:
      type: string
      enum:
        - user
      description: The `user` value.
      title: CommentTaggedUsersUserNameType
    CommentTaggedUsersUserName:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CommentTaggedUsersUserNameType'
          description: The `user` value.
        id:
          type: string
          description: The user's ID.
      required:
        - type
        - id
      description: >-
        An object that contains information about the tagged user. The object's
        name is the user's Postman username. For example, `@user-postman`.
      title: CommentTaggedUsersUserName
    commentTaggedUsers:
      type: object
      properties:
        '{{userName}}':
          $ref: '#/components/schemas/CommentTaggedUsersUserName'
          description: >-
            An object that contains information about the tagged user. The
            object's name is the user's Postman username. For example,
            `@user-postman`.
      description: Information about users tagged in the `body` comment.
      title: commentTaggedUsers
    commentUpdate:
      type: object
      properties:
        body:
          type: string
          description: The contents of the comment.
        tags:
          $ref: '#/components/schemas/commentTaggedUsers'
      required:
        - body
      description: Information about the comment.
      title: commentUpdate
    CommentCreatedUpdatedData:
      type: object
      properties:
        id:
          type: integer
          description: The comment's ID.
        threadId:
          type: integer
          description: The comment's thread ID.
        createdBy:
          type: integer
          description: The user ID of the user who created the comment.
        createdAt:
          type: string
          format: date-time
          description: The date and time at which the comment was created.
        updatedAt:
          type: string
          format: date-time
          description: The date and time when the comment was last updated.
        body:
          type: string
          description: The contents of the comment.
      title: CommentCreatedUpdatedData
    commentCreatedUpdated:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/CommentCreatedUpdatedData'
      title: commentCreatedUpdated
    apiErrorNameMessage:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
      title: apiErrorNameMessage
    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
  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

### Comment Updated



**Request**

```json
undefined
```

**Response**

```json
{
  "data": {
    "id": 46814,
    "threadId": 12345,
    "createdBy": 12345678,
    "createdAt": "2024-01-18T11:30:40.000Z",
    "updatedAt": "2024-01-18T11:30:40.000Z",
    "body": "This is an updated example.",
    "status": "Open"
  }
}
```

**SDK Code**

```python Comment Updated
import requests

url = "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814"

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

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

print(response.json())
```

```javascript Comment Updated
const url = 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814';
const options = {
  method: 'PUT',
  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 Comment Updated
package main

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

func main() {

	url := "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814"

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

url = URI("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814")

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'

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

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

HttpResponse<String> response = Unirest.put("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Comment Updated
using RestSharp;

var client = new RestClient("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814");
var request = new RestRequest(Method.PUT);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Comment Updated
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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 Comment



**Request**

```json
{
  "body": "This is an example."
}
```

**Response**

```json
{
  "data": {
    "id": 46814,
    "threadId": 12345,
    "createdBy": 12345678,
    "createdAt": "2024-01-18T11:30:40.000Z",
    "updatedAt": "2024-01-18T11:30:40.000Z",
    "body": "This is an updated example.",
    "status": "Open"
  }
}
```

**SDK Code**

```python Update Comment
import requests

url = "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814"

payload = { "body": "This is an example." }
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Update Comment
const url = 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814';
const options = {
  method: 'PUT',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"body":"This is an example."}'
};

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

```go Update Comment
package main

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

func main() {

	url := "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814"

	payload := strings.NewReader("{\n  \"body\": \"This is an example.\"\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 Update Comment
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814")

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  \"body\": \"This is an example.\"\n}"

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

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

HttpResponse<String> response = Unirest.put("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"body\": \"This is an example.\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814', [
  'body' => '{
  "body": "This is an example."
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Update Comment
using RestSharp;

var client = new RestClient("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814");
var request = new RestRequest(Method.PUT);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"body\": \"This is an example.\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Update Comment
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["body": "This is an example."] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814")! 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()
```

### Tag User in Comment



**Request**

```json
{
  "body": "This is an example. @alex-cruz",
  "tags": {
    "@alex-cruz": {
      "id": "87654321",
      "type": "user"
    }
  }
}
```

**Response**

```json
{
  "data": {
    "id": 46814,
    "threadId": 12345,
    "createdBy": 12345678,
    "createdAt": "2024-01-18T11:30:40.000Z",
    "updatedAt": "2024-01-18T11:30:40.000Z",
    "body": "This is an updated example.",
    "status": "Open"
  }
}
```

**SDK Code**

```python Tag User in Comment
import requests

url = "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814"

payload = {
    "body": "This is an example. @alex-cruz",
    "tags": { "@alex-cruz": {
            "id": "87654321",
            "type": "user"
        } }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Tag User in Comment
const url = 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814';
const options = {
  method: 'PUT',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"body":"This is an example. @alex-cruz","tags":{"@alex-cruz":{"id":"87654321","type":"user"}}}'
};

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

```go Tag User in Comment
package main

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

func main() {

	url := "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814"

	payload := strings.NewReader("{\n  \"body\": \"This is an example. @alex-cruz\",\n  \"tags\": {\n    \"@alex-cruz\": {\n      \"id\": \"87654321\",\n      \"type\": \"user\"\n    }\n  }\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 Tag User in Comment
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814")

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  \"body\": \"This is an example. @alex-cruz\",\n  \"tags\": {\n    \"@alex-cruz\": {\n      \"id\": \"87654321\",\n      \"type\": \"user\"\n    }\n  }\n}"

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

```java Tag User in Comment
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"body\": \"This is an example. @alex-cruz\",\n  \"tags\": {\n    \"@alex-cruz\": {\n      \"id\": \"87654321\",\n      \"type\": \"user\"\n    }\n  }\n}")
  .asString();
```

```php Tag User in Comment
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814', [
  'body' => '{
  "body": "This is an example. @alex-cruz",
  "tags": {
    "@alex-cruz": {
      "id": "87654321",
      "type": "user"
    }
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Tag User in Comment
using RestSharp;

var client = new RestClient("https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814");
var request = new RestRequest(Method.PUT);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"body\": \"This is an example. @alex-cruz\",\n  \"tags\": {\n    \"@alex-cruz\": {\n      \"id\": \"87654321\",\n      \"type\": \"user\"\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Tag User in Comment
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "body": "This is an example. @alex-cruz",
  "tags": ["@alex-cruz": [
      "id": "87654321",
      "type": "user"
    ]]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/comments/46814")! 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()
```