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

> Retrieve a post by Ayrshare Post ID

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 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>;
};

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>)}
  </>;

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

<XByoNotice />

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.

<Info>
  Call the [/history by id](/apis/history/get-history-id) endpoint for the same data.
</Info>

## Post Statuses

The following statuses are returned for a post.

| Status              | Description                                                                                                  |
| :------------------ | :----------------------------------------------------------------------------------------------------------- |
| `awaiting approval` | Posts are waiting to be approved via the [approval workflow](/apis/post/overview#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.                                                       |

<Info>
  See the [/history](/apis/history/overview) endpoint for retrieving all posts, including
  posts not sent via Ayrshare.
</Info>

## Header Parameters

<HeaderAPI />

## Path Parameters

<ParamField path="id" type="string" required>
  Ayrshare Post ID from /post
</ParamField>

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

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