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

# Get a Post

> Get the history of a post sent via Ayrshare by its Post ID, including its status, such as pending, success, or error, post parameters, and other details.

> [!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 posts sent via Ayrshare. Returns the status, post parameters, and other details. Replace `:id` with the Ayrshare Post ID.

> [!NOTE]
>
> Call the [/history by id](https://www.ayrshare.com/docs/apis/history/get-history-id.md) endpoint for the same data.

## Post Statuses

The following statuses are returned for a post.

| Status | Description |
| :- | :- |
| `awaiting approval` | Posts are waiting to be approved via the [approval workflow](https://www.ayrshare.com/docs/apis/post/overview.md#approval-workflow). |
| `deleted` | Post has been deleted. Note: deleted posts are only returned with the status query filter. Please see below. |
| `error` | An error occurred with one or more social networks. |
| `pending` | The post has not yet been processed. Typically a scheduled post. |
| `success` | The post was successfully sent to all social networks. |

> [!NOTE]
>
> See the [/history](https://www.ayrshare.com/docs/apis/history/overview.md) endpoint for retrieving all posts, including
> posts not sent via Ayrshare.

## 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 from /post

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

```javascript JavaScript theme={"system"}
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/post/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/post/TBEAAqAMMJoweA9wKHUl', headers=headers)

print(r.json())
```

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

// URL and authorization details
$url = 'https://api.ayrshare.com/api/post/TBEAAqAMMJoweA9wKHUl';
$apiKey = 'API_KEY';  // Replace 'API_KEY' with your actual API key

// Initialize a cURL session
$curl = curl_init();

// Set cURL options
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Authorization: Bearer ' . $apiKey
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

// Execute cURL session and get the response
$response = curl_exec($curl);

// Check if any error occurred
if(curl_errno($curl)){
    echo 'Curl error: ' . curl_error($curl);
} else {
    // Decode and re-encode the JSON response to pretty print
    echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}

// Close cURL session
curl_close($curl);
```

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

namespace PostGETRequest_csharp
{
    class Post
    {
        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/post/TBEAAqAMMJoweA9wKHUl";

            // Set up request headers
            client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

            try
            {
                // Send GET request and read response
                HttpResponseMessage response = await client.GetAsync(url);
                response.EnsureSuccessStatusCode();
                
                string responseBody = await response.Content.ReadAsStringAsync();
                Console.WriteLine(responseBody);
            }
            catch (HttpRequestException e)
            {
                Console.WriteLine($"Error: {e.Message}");
            }
        }
    }
}
```

```json 200: Success theme={"system"}
{
    "created": "2024-11-19T19:00:14Z",
    "errors": [],
    "id": "8tNTr73VV8Y66bHwC2322",
    "mediaUrls": [
        "https://img.ayrshare.com/012/gb.jpg"
    ],
    "platforms": [
        "twitter"
    ],
    "post": "#75304 Eighty percent of success is showing up. - John D. Rockefeller",
    "postIds": [
        {
            "status": "success",
            "id": "1858948421974925758",
            "postUrl": "https://twitter.com/wondrouswaffles/status/185894842197493444",
            "platform": "twitter"
        }
    ],
    "profileTitle": "Best Profile",
    "refId": "b68bdcabb379be2cf1186c1e59544",
    "scheduleDate": "2024-11-19T19:00:14Z",
    "shortenLinks": false,
    "status": "success",
    "type": "now"
}
```

```json 400: Bad Request ID 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.