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

# Post History by ID

> Get the history for a specific post using its Ayrshare Post ID, with an optional searchAllPosts query parameter to search across all User Profiles.

> [!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.

Get the history for a specific post. Replace `:id` with the [Ayrshare Post ID](https://www.ayrshare.com/docs/apis/overview.md#ayrshare-post-id) returned from [post](https://www.ayrshare.com/docs/apis/post/post.md).

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

**id** `string` *required*

Ayrshare Post ID returned from /post

## Query Parameters

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

Search all posts across all User Profiles for the post ID. Default: `false`

```javascript cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://api.ayrshare.com/api/history/TBEAAqAMMJoweA9wKHUl
```

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

fetch("https://api.ayrshare.com/api/history/TBEAAqAMMJoweA9wKHUl", {
      method: "GET",
      headers: {
        "Authorization": `Bearer ${API_KEY}`
      }
    })
      .then((res) => res.json())
      .then((json) => console.log(json))
      .catch(console.error);
```

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

headers = {'Authorization': 'Bearer API_KEY'}

r = requests.get('https://api.ayrshare.com/api/history/TBEAAqAMMJoweA9wKHUl', headers=headers)

print(r.json())
```

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

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

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

$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => $headers
]);

$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.Threading.Tasks;

namespace HistoryGETByIDRequest_csharp
{
    class HistoryGetById
    {
        static async Task Main(string[] args)
        {
            string API_KEY = "API_KEY";
            string url = "https://api.ayrshare.com/api/history/TBEAAqAMMJoweA9wKHUl";

            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
                
                try
                {
                    var response = await client.GetStringAsync(url);
                    Console.WriteLine(response);
                }
                catch (HttpRequestException ex)
                {
                    Console.WriteLine($"Error: {ex.Message}");
                }
            }
        }
    }
}
```

```json 200: Success theme={"system"}
{
    "tier": "business",
    "status": "success",
    "mediaUrls": [
        "https://images.ayrshare.com/imgs/GhostBusters.jpg"
    ],
    "postIds": [
        {
            "platform": "facebook",
            "postUrl": "https://www.facebook.com/1105775157895689_361710168628052",
            "status": "success",
            "id": "105775157895689_361710168628052" // Facebook Social Post ID
        }
    ],
    "id": "TBEEAqAMMJoweA8wKHUp", // Ayrshare Post ID
    "errors": [],
    "platforms": [
        "facebook"
    ],
    "scheduleDate": {   // In a future release changed to "scheduleDate": "2020-11-05T12:21:29Z"
        "_seconds": 1604578889,
        "_nanoseconds": 211000000,
        "utc": "2020-11-05T12:21:29Z"
    },
    "createDate": {    // deprecated, use created
        "_seconds": 1653067506,
        "_nanoseconds": 179000000,
        "utc": "2022-05-20T17:25:06Z"
    },
    "created": "2022-05-20T17:25:06Z",
    "shortenLinks": true,
    "post": "Today is a great day",
    "notes": "Approved by John Smith", // reference notes set via /post
    "type": "scheduled"
}
```

```json 400: Post not found theme={"system"}
{
  "action": "history",
  "status": "error",
  "code": 221,
  "message": "History not found.",
  "id": "4W3f3RPr6QSrw8S5Yo8"
}
```


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