> For a complete page index, fetch https://developer.close.com/llms.txt

# Update a Comment

PUT https://api.close.com/api/v1/comment/{id}/
Content-Type: application/json

You can use this endpoint to edit a comment body. Note that users may only update their own comments.

Reference: https://developer.close.com/api/resources/comments/update

## Authentication

- `Authorization` header (basic auth, required) — Use your API key as the username and leave the password empty.
- `Authorization` header (bearer token, required)

## Request

### Path parameters

- `id` (string, required)

### Body (application/json)

- `body` (string, required)

## Response

### 200

Successful response

## Examples

**Request**

```json
{
  "body": "<body><p>Oops, wrong activity</p></body>"
}
```

**Response**

```json
{
  "body": "<body><p>Oops, wrong activity</p></body>",
  "created_at": "2024-03-27T18:57:02.770240+00:00",
  "created_by": "user_abc123",
  "id": "comm_abc123",
  "lead_id": "lead_abc123",
  "mentions": [],
  "organization_id": "orga_abc123",
  "removed_at": null,
  "removed_by": null,
  "thread_id": "comthr_abc123",
  "updated_at": "2024-03-27T18:57:02.770240+00:00",
  "updated_by": "user_abc123"
}
```

**SDK Code**

```python comments_update_example
import requests

url = "https://api.close.com/api/v1/comment/id/"

payload = { "body": "<body><p>Oops, wrong activity</p></body>" }
headers = {
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers, auth=("<CLOSE_API_KEY>", ""))

print(response.json())
```

```javascript comments_update_example
const url = 'https://api.close.com/api/v1/comment/id/';
const credentials = btoa("<CLOSE_API_KEY>:");

const options = {
  method: 'PUT',
  headers: {Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json'},
  body: '{"body":"<body><p>Oops, wrong activity</p></body>"}'
};

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

```go comments_update_example
package main

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

func main() {

	url := "https://api.close.com/api/v1/comment/id/"

	payload := strings.NewReader("{\n  \"body\": \"<body><p>Oops, wrong activity</p></body>\"\n}")

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

	req.SetBasicAuth("<CLOSE_API_KEY>", "")
	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 comments_update_example
require 'uri'
require 'net/http'

url = URI("https://api.close.com/api/v1/comment/id/")

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

request = Net::HTTP::Put.new(url)
request.basic_auth("<CLOSE_API_KEY>", "")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"body\": \"<body><p>Oops, wrong activity</p></body>\"\n}"

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

```java comments_update_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.close.com/api/v1/comment/id/")
  .basicAuth("<CLOSE_API_KEY>", "")
  .header("Content-Type", "application/json")
  .body("{\n  \"body\": \"<body><p>Oops, wrong activity</p></body>\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.close.com/api/v1/comment/id/', [
  'body' => '{
  "body": "<body><p>Oops, wrong activity</p></body>"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<CLOSE_API_KEY>', ''],
]);

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

```csharp comments_update_example
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://api.close.com/api/v1/comment/id/");
client.Authenticator = new HttpBasicAuthenticator("<CLOSE_API_KEY>", "");
var request = new RestRequest(Method.PUT);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"body\": \"<body><p>Oops, wrong activity</p></body>\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```