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

> Update a scheduled post's metadata

export const HeaderAPI = ({noProfileKey, profileKeyRequired}) => <>
    <ParamField header="Authorization" type="string" required>
      <a href="/apis/overview#authorization">API Key</a> of the Primary Profile.
      <br />
      <br />
      Format: <code>Authorization: Bearer API_KEY</code>
    </ParamField>
    {!noProfileKey && (profileKeyRequired ? <ParamField header="Profile-Key" type="string" required>
          <a href="/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
          <br />
          <br />
          Format: <code>Profile-Key: PROFILE_KEY</code>
        </ParamField> : <ParamField header="Profile-Key" type="string">
          <a href="/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
          <br />
          <br />
          Format: <code>Profile-Key: PROFILE_KEY</code>
        </ParamField>)}
  </>;

export const PlansAvailable = ({plans = [], maxPackRequired}) => {
  let displayPlans = plans;
  if (plans && plans.length === 1) {
    const lowerCasePlan = plans[0].toLowerCase();
    if (lowerCasePlan === "basic") {
      displayPlans = ["Basic", "Premium", "Business", "Enterprise"];
    } else if (lowerCasePlan === "business") {
      displayPlans = ["Business", "Enterprise"];
    } else if (lowerCasePlan === "premium") {
      displayPlans = ["Premium", "Business", "Enterprise"];
    }
  }
  return <Note>
Available on {displayPlans.length === 1 ? "the " : ""}
{displayPlans.join(", ").replace(/\b\w/g, l => l.toUpperCase())}{" "}
{displayPlans.length > 1 ? "plans" : "plan"}.

{maxPackRequired && <span onClick={() => window.open('https://www.ayrshare.com/docs/additional/maxpack', '_self')} className="flex items-center mt-2 cursor-pointer">
 <span className="px-1.5 py-0.5 rounded text-sm" style={{
    backgroundColor: '#C264B6',
    color: 'white',
    fontSize: '12px'
  }}>
   Max Pack required
 </span>
</span>}
</Note>;
};

<PlansAvailable plans={["premium"]} maxPackRequired={false} />

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

<ul class="custom-bullets">
  <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.</li>

  <li>
    The [approval workflow](/apis/post/post#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

<HeaderAPI noProfileKey={false} />

## Body Parameters

<ParamField path="id" type="string" required>
  Ayrshare Post ID of the post to update. Ayrshare Post ID returned from [/post](/apis/post/post).
</ParamField>

<ParamField path="approved" type="boolean" default={false}>
  The original post requires approval and has a status of "awaiting approval", set to `true` to
  approve and publish the post.
</ParamField>

<ParamField path="disableComments" type="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 className="custom-bullets">
    <li>Enabling or disabling can be done on either a scheduled post or a published post.</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>
</ParamField>

<ParamField path="notes" type="string">
  Set notes on a post that can be retrieved via the [/history](/apis/history) endpoint. Notes are
  for reference only and do not affect the post.
</ParamField>

<ParamField path="scheduleDate" type="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.</Warning>
</ParamField>

<ParamField path="scheduledPause" type="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.
</ParamField>

<ParamField path="youTubeOptions" type="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.
</ParamField>

<RequestExample>
  ```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()
  }
  ```
</RequestExample>

<ResponseExample>
  ```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"
  }
  ```
</ResponseExample>
