> ## 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 posts that did not originate via Ayrshare using the Social Post ID, with the searchPlatformId and platform query parameters.

> [!NOTE]
>
> **Targeting X/Twitter?** Starting March 31, 2026, all X operations require your own API credentials. After linking X via OAuth, include these 2 headers in your request:
>
> `X-Twitter-OAuth1-Api-Key` — Your API Key (Consumer Key)
>
> `X-Twitter-OAuth1-Api-Secret` — Your API Key Secret (Consumer Secret)
>
> **One-time setup per Ayrshare account.** You create one X Developer App and reuse the same API Key and Secret across every sub-profile / end-user you link. You do *not* create a new app per customer.
>
> Not linked yet? See the [full setup guide](https://www.ayrshare.com/docs/dashboard/connect-social-accounts/x-twitter-byo-keys.md) to connect your X account.
>
> Your keys are never logged or stored by Ayrshare.

Retrieve history for posts that did not originate via Ayrshare by providing the low-level Social post ID. This [Social Post ID ](https://www.ayrshare.com/docs/apis/overview.md#social-post-id)is returned in the `postIds` field of the [post endpoint](https://www.ayrshare.com/docs/apis/post/overview.md) or the `id` field from the [get all history endpoint](https://www.ayrshare.com/docs/apis/history/get-history.md) 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

**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`

## Path Parameters

**socialId** `string` *required*

The [Social Post ID](https://www.ayrshare.com/docs/apis/overview.md#id-types) of the post.

> [!NOTE]
>
> Please see the [/post endpoint](https://www.ayrshare.com/docs/apis/post/post.md) Response 200 for another example of the Facebook
> Social Post ID `104923907983682_108329000309742`

## Query Parameters

**searchPlatformId** `boolean` *required*

Always equals `true`

**platform** `string` *required*

Values: `facebook`, `instagram`, `linkedin`, `threads`, `tiktok`, `twitter`, `youtube`

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

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


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