> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a Post

> Reschedule, pause, or add notes to a pending post, approve a post awaiting approval, or disable comments and change YouTube visibility once published.

Update the `scheduleDate` of a post, `approval` status of a post, `notes`, or `visibility` of a posted YouTube video.

<ul>
  <li>
    The post must originally have a `scheduleDate` and be in a "pending" `status`. The `status`
    can be checked with the /history or GET /post endpoints.
  </li>

  <li>
    The YouTube video must have been successfully posted to change visibility. Send `visibility`
    inside `youTubeOptions`, not at the top level of the body.
  </li>

  <li>
    Besides `id`, the request must include at least one of the parameters below. A request with
    only `id` returns `code: 101`.
  </li>

  <li>
    The [approval workflow](https://www.ayrshare.com/docs/apis/post/overview.md#approval-workflow) requires the current status of the
    post be in "awaiting approval".
  </li>
</ul>

Other parameters cannot be updated. You will need to delete the post and repost.

## Header Parameters

**Authorization** `string` *required*

[API Key](https://www.ayrshare.com/docs/apis/overview.md#authorization) of the Primary Profile.

Format: `Authorization: Bearer API_KEY`
**Profile-Key** `string`

[Profile Key](https://www.ayrshare.com/docs/apis/overview.md#profile-key-format) of a User Profile.

Format: `Profile-Key: PROFILE_KEY`

## Body Parameters

**id** `string` *required*

Ayrshare Post ID of the post to update. Ayrshare Post ID returned from [/post](https://www.ayrshare.com/docs/apis/post/post.md).

**approved** `boolean` (default: false)

The original post requires approval and has a status of "awaiting approval", set to `true` to
approve and publish the post.

**disableComments** `boolean` (default: false)

Enable or disable comments on a post. Setting to `true` will disable comments. Setting to `false` will enable comments.

Supported platforms: Instagram and LinkedIn.

<ul>
  <li>The post must be published. Otherwise the request returns error `305`.</li>
  <li>Disabling comments on a published post will not delete existing comments.</li>
  <li>Disabling LinkedIn comments will delete all existing comments on the thread.</li>
  <li>Instagram comments will not be deleted.</li>
  <li>TikTok comments cannot be changed after publishing.</li>
</ul>

**notes** `string`

Set notes on a post that can be retrieved via the [/history](https://www.ayrshare.com/docs/apis/history/overview.md) endpoint. Notes are
for reference only and do not affect the post.

**scheduleDate** `string`

The `datetime` to schedule a future post. Accepts a UTC date time.

For example, use format `YYYY-MM-DDThh:mm:ssZ` and send as `2026-07-08T12:30:00Z`.
Please see [utctime](https://www.utctime.net/) for more examples.

> [!WARNING]
>
> If the datetime is in the past, the post will immediately be sent.

**scheduledPause** `boolean` (default: false)

Pause or unpause a scheduled post. If a post is unpaused and the `scheduleDate` is in the past,
the post will immediately be publish. Consider updating the `scheduleDate` before unpausing.

**youTubeOptions** `object`

Update the visibility of the YouTube video with the `visibility` field and values `unlisted`, `private`, or `public`.

Update the `description`, `title`, or `categoryId`. If no `description` or `categoryId` originally set, the default values are `""` and `24` (Entertainment), respectively.

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"id": "s8k2jsk0pl", "scheduleDate": "2023-07-08T12:30:00Z", scheduledPause: true}' \
-X PATCH https://api.ayrshare.com/api/post
```

```javascript JavaScript theme={"system"}
const API_KEY = "API_KEY";

fetch("https://api.ayrshare.com/api/post", {
      method: "PATCH",
      headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${API_KEY}`
      },
      body: JSON.stringify({
        id: "s8k2jsk0pl", // required
        scheduleDate: "2023-07-08T12:30:00Z",
        scheduledPause: true
      }),
    })
      .then((res) => res.json())
      .then((json) => console.log(json))
      .catch(console.error);
```

```python Python theme={"system"}
import requests

payload = {'id': 's8k2jsk0pl',
        'scheduleDate': '2023-07-08T12:30:00Z'}
headers = {'Content-Type': 'application/json',
        'Authorization': 'Bearer API_KEY'}

r = requests.patch('https://api.ayrshare.com/api/post',
    json=payload,
    headers=headers)

print(r.json())
```

```php PHP theme={"system"}
<?php

$apiUrl = 'https://api.ayrshare.com/api/post';
$apiKey = 'API_KEY';  // Replace 'API_KEY' with your actual API key

$headers = [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $apiKey,
];

$data = json_encode([
    'id' => 's8k2jsk0pl',  // Replace with your actual post ID
    'scheduleDate' => '2023-07-08T12:30:00Z'
]);

$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_POSTFIELDS => $data
]);

$response = curl_exec($curl);

if ($response === false) {
    echo 'Curl error: ' . curl_error($curl);
} else {
    echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}

curl_close($curl);
```

```csharp C# theme={"system"}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace PostUpdatePOSTRequest_csharp
{
    class PostUpdate
    {
        static async Task Main(string[] args)
        {
            string API_KEY = "API_KEY";
            string url = "https://api.ayrshare.com/api/post";

            using (var httpClient = new HttpClient())
            {
                try
                {
                    httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);

                    string json = "{\"id\":\"s8k2jsk0pl\"," +
                                "\"scheduleDate\":\"2023-07-08T12:30:00Z\"}";

                    var content = new StringContent(json, Encoding.UTF8, "application/json");

                    var response = await httpClient.PatchAsync(url, content);
                    var responseBody = await response.Content.ReadAsStringAsync();

                    response.EnsureSuccessStatusCode();
                    Console.WriteLine(responseBody);
                }
                catch (HttpRequestException ex)
                {
                    Console.WriteLine("Error: " + ex.Message);
                    if (ex.InnerException != null)
                    {
                        Console.WriteLine("Error details: " + ex.InnerException.Message);
                    }
                }
            }
        }
    }
}
```

```go Go theme={"system"}
package main

import (
	"bytes"
	"encoding/json"
	"log"
	"net/http"
)

func main() {
	message := map[string]interface{}{
		"id": "s8k2jsk0pl",
		"scheduleDate": "2023-07-08T12:30:00Z"
	}

	bytesRepresentation, err := json.Marshal(message)
	if err != nil {
		log.Fatalln(err)
	}

	req, _ := http.NewRequest("PATCH", "https://api.ayrshare.com/api/post",
		bytes.NewBuffer(bytesRepresentation))

	req.Header.Add("Content-Type", "application/json; charset=UTF-8")
	req.Header.Add("Authorization", "Bearer API_KEY")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Fatal("Error:", err)
	}

	res.Body.Close()
}
```

```json 200: Success theme={"system"}
{
    "status": "success",
    "id": "ZSU1tnnuykDy25wA6kvX", // Ayrshare Post ID
    "scheduleDate": "2025-07-08T12:30:00Z",
    "scheduledPaused": true
}
```

```json 400: ID Not Found theme={"system"}
{
    "action": "update",
    "status": "error",
    "code": 305,
    "message": "Error updating post. Post ID not found."
}on
```

```json 400: Invalid scheduleDate theme={"system"}
{
  "action": "post",
  "status": "error",
  "code": 104,
  "message": "Invalid schedule date format for scheduleDate. .../ayrshare.com/rest-api/endpoints/post#send-a-post"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.