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

# Posts History by Social ID

> Retrieve history for a post that did not originate via Ayrshare.

export const XByoNotice = () => <Info>
  <strong>Targeting X/Twitter?</strong> Starting March 31, 2026, all X operations require your own API credentials. After linking X via OAuth, include these 2 headers in your request:
  <br /><br />
  <code>X-Twitter-OAuth1-Api-Key</code> — Your API Key (Consumer Key)<br />
  <code>X-Twitter-OAuth1-Api-Secret</code> — Your API Key Secret (Consumer Secret)
  <br /><br />
  Not linked yet? See the <a href="/dashboard/connect-social-accounts/x-twitter-byo-keys">full setup guide</a> to connect your X account.
  <br /><br />
  Your keys are never logged or stored by Ayrshare.
</Info>;

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={["business"]} maxPackRequired={false} />

<XByoNotice />

Retrieve history for posts that did not originate via Ayrshare by providing the low-level Social post ID. This [Social Post ID ](/apis/overview#social-post-id)is returned in the `postIds` field of the [post endpoint](/apis/post/overview) or the `id` field from the [get all history endpoint](/apis/history/get-history) or the ID from a post URL, such as from this [Facebook post](https://www.facebook.com/Ayrshare/posts/pfbid02ktEFyG8EydxNGyiytsiC4m3X8kQAfTC6inCCzZJZD9KpAZAiWPpSK5C5HS7cgD54l).

The linked account must be the owner of the post to retrieve the history.

Supported platforms: Facebook, Instagram, LinkedIn, Threads, TikTok, Twitter, and YouTube with the following `platform` values: `facebook`, `instagram`, `linkedin`, `threads`, `tiktok`, `twitter`, `youtube`.

## Header Parameters

<HeaderAPI />

## Path Parameters

<ParamField path="socialId" type="string" required>
  The [Social Post ID](/apis/overview#id-types) of the post.
</ParamField>

<Note>
  Please see the [/post endpoint](/apis/post/post) Response 200 for another example of the Facebook
  Social Post ID `104923907983682_108329000309742`
</Note>

## Query Parameters

<ParamField query="searchPlatformId" type="boolean" required>
  Always equals `true`
</ParamField>

<ParamField query="platform" type="string" required>
  Values: `facebook`, `instagram`, `linkedin`, `threads`, `tiktok`, `twitter`, `youtube`
</ParamField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl \
  -H "Authorization: Bearer API_KEY" \
  -X GET https://api.ayrshare.com/api/history/104923907983682_108329000309742?searchPlatformId=true&platform=facebook
  ```

  ```javascript JavaScript theme={"system"}
  const url = "https://api.ayrshare.com/api/history/104923907983682_108329000309742?searchPlatformId=true&platform=facebook";
  const response = await fetch(url, {
      headers: {
          'Authorization': 'Bearer API_KEY'
      }
  });
  ```

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

  url = 'https://api.ayrshare.com/api/history/104923907983682_108329000309742?searchPlatformId=true&platform=facebook'
  headers = {'Authorization': 'Bearer API_KEY'}
  response = requests.get(url, headers=headers)
  ```

  ```php PHP theme={"system"}
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'https://api.ayrshare.com/api/history/104923907983682_108329000309742?searchPlatformId=true&platform=facebook');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer API_KEY'));
  $response = curl_exec($ch);
  curl_close($ch);
  ```

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

  namespace HistorySocialIdGETRequest_csharp
  {
  class HistorySocialId
  {
      private static readonly HttpClient client = new HttpClient();

      static async Task Main(string[] args)
      {
          string API_KEY = "API_KEY";
          string url = "https://api.ayrshare.com/api/history/104923907983682_108329000309742?searchPlatformId=true&platform=facebook";

          client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);

          try
          {
              var response = await client.GetStringAsync(url);
              Console.WriteLine(response);
          }
          catch (HttpRequestException e)
          {
              Console.WriteLine($"Error: {e.Message}");
          }
      }
  }
  }
  ```

  ```go Go theme={"system"}
  client := &http.Client{}
  req, err := http.NewRequest("GET", "https://api.ayrshare.com/api/history/104923907983682_108329000309742?searchPlatformId=true&platform=facebook", nil)
  req.Header.Add("Authorization", "Bearer API_KEY")
  resp, err := client.Do(req)
  ```

  ```ruby Ruby theme={"system"}
  require 'net/http'
  require 'uri'

  uri = URI.parse("https://api.ayrshare.com/api/history/104923907983682_108329000309742?searchPlatformId=true&platform=facebook")
  request = Net::HTTP::Get.new(uri)
  request['Authorization'] = 'Bearer API_KEY'
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
    http.request(request)
  end
  ```
</RequestExample>

<ResponseExample>
  ```json 200: Success theme={"system"}
  [
      {
          "commentsCount": 0,
          "created": "2024-01-25T23:01:23Z",
          "from": {
              "name": "Ayrshare",
              "id": "18930271191"
          },
          "id": "18930271191_39392923",
          "mediaUrls": [
              {
                  "media": {
                      "image": {
                          "height": 720,
                          "src": "https://scontent-lga3-2.xx.fbcdn.net/v/...",
                          "width": 405
                      },
                      "source": "https://video-lga3-2.xx.fbcdn.net/o1/..."
                  },
                  "title": "🔥 Sneaker time!"
              }
          ],
          "messageTags": [
              {
                  "id": "434786466522",
                  "name": "#sneakerswap365",
                  "offset": 242,
                  "length": 15
              }
          ],
          "post": "🔥 Sneaker Time for all!",
          "postUrl": "https://www.facebook.com/reel/72681340799/",
          "lastUpdated": "2024-01-25T23:29:58.014Z",
          "nextUpdate": "2024-01-25T23:40:58.014Z"
      }
  ]
  ```

  ```json 400: Post Not Found theme={"system"}
  {
    "action": "get",
    "status": "error",
    "code": 221,
    "message": "The ID was not found. Please verify the id, API or Profile Keys, and required parameters.",
    "id": "7268134079",
    "lastUpdated": "2024-01-25T23:45:14.311Z",
    "nextUpdate": "2024-01-25T23:56:14.311Z"
  }
  ```
</ResponseExample>
