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

# पोस्ट इतिहास

> 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 />
  <strong>One-time setup per Ayrshare account.</strong> You create one X Developer App and reuse the same API Key and Secret across every sub-profile / end-user you link. You do <em>not</em> create a new app per customer.
  <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 === "business") {
      displayPlans = ["Launch", "Business", "Enterprise"];
    } else if (lowerCasePlan === "premium") {
      displayPlans = ["Premium", "Launch", "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={["premium"]} maxPackRequired={false} />

<XByoNotice />

Ayrshare के माध्यम से भेजी गई पोस्टों का इतिहास अवरोही क्रम में (सबसे नई से सबसे पुरानी) प्राप्त करें।

इस एंडपॉइंट के साथ आप एक विशिष्ट दिनांक श्रेणी, स्थिति, सोशल नेटवर्क, या पिछले n दिनों की पोस्ट प्राप्त कर सकते हैं।

History `status` फ़ील्ड मान:

<ul class="custom-bullets">
  <li>
    `awaiting approval`: पोस्ट [approval workflow](/apis/post/overview#approval-workflow) के माध्यम से अनुमोदित होने की प्रतीक्षा में हैं।
  </li>

  <li>
    `deleted`: पोस्ट हटा दी गई है। नोट: हटाई गई पोस्ट केवल स्थिति क्वेरी फ़िल्टर के साथ लौटाई जाती हैं। कृपया नीचे देखें।
  </li>

  <li>`error`: एक या अधिक सोशल नेटवर्क के साथ त्रुटि हुई।</li>
  <li>`paused`: एक शेड्यूल की गई पोस्ट जिसे रोका गया है।</li>
  <li>`pending`: पोस्ट अभी तक संसाधित नहीं हुई है। आमतौर पर एक शेड्यूल की गई पोस्ट।</li>
  <li>`success`: पोस्ट सफलतापूर्वक सभी सोशल नेटवर्क पर भेजी गई।</li>
</ul>

अतिरिक्त जानकारी:

<ul class="custom-bullets">
  <li>
    [Ayrshare Post ID](/apis/overview#ayrshare-post-id) प्रतिक्रिया में `id` फ़ील्ड में लौटाई जाती है।
  </li>

  <li>
    Ayrshare के बाहर से उत्पन्न पोस्ट प्राप्त करने के लिए, जैसे कि सीधे सोशल नेटवर्क पर मैन्युअल रूप से बनाई गई पोस्ट, [history platform](/apis/history/history-platform) एंडपॉइंट का उपयोग करें।
  </li>

  <li>
    यदि केवल एक व्यक्तिगत पोस्ट की आवश्यकता है, तो [post history by id](/apis/history/get-history-id) एंडपॉइंट का उपयोग करें।
  </li>

  <li>
    यदि `limit` डिफ़ॉल्ट मान 25 से अधिक है तो history एंडपॉइंट JSON परिणाम 1 मिनट के लिए कैश किए जाते हैं।
  </li>
</ul>

## हैडर पैरामीटर

<HeaderAPI />

## क्वेरी पैरामीटर

<ParamField query="limit" type="number" default={25}>
  पिछली <em>n</em> संख्या की पोस्ट लौटाता है। उदाहरण के लिए, यदि आप केवल सबसे हाल की पोस्ट चाहते हैं, तो `limit=1` सेट करें।
  यदि मौजूद नहीं है, तो `lastDays` के भीतर सभी रिकॉर्ड लौटाएगा।

  डिफ़ॉल्ट: `25` पोस्ट। अधिकतम मान: `1000`।
</ParamField>

<ParamField query="platforms" type="array">
  सोशल नेटवर्क प्लेटफ़ॉर्म द्वारा फ़िल्टर करें। प्लेटफ़ॉर्म मान: `bluesky`, `facebook`, `gmb`, `instagram`,
  `linkedin`, `pinterest`, `reddit`, `snapchat`, `telegram`, `threads`, `tiktok`, `twitter`,
  `youtube`. नोट, `OR` तर्क का उपयोग करता है: `["facebook", "instagram"]` किसी भी एक से पोस्ट लौटाता है।
</ParamField>

<ParamField query="startDate" type="string">
  इस प्रारंभ तिथि से और इसे शामिल करते हुए पोस्ट लौटाएँ। ISO 8601 फ़ॉर्मैट में इतिहास के लिए प्रारंभ तिथि।
  उदाहरण के लिए, फ़ॉर्मैट `YYYY-MM-DDThh:mm:ssZ` का उपयोग करें और `2026-07-08T12:30:00Z` के रूप में भेजें। अधिक उदाहरणों के लिए कृपया
  [utctime](https://www.utctime.net/) देखें।
</ParamField>

<ParamField query="endDate" type="string">
  इस अंतिम तिथि तक और इसे शामिल करते हुए पोस्ट लौटाएँ। ISO 8601 फ़ॉर्मैट में इतिहास के लिए अंतिम तिथि। उदाहरण के लिए,
  फ़ॉर्मैट `YYYY-MM-DDThh:mm:ssZ` का उपयोग करें और `2026-07-08T12:30:00Z` के रूप में भेजें। अधिक उदाहरणों के लिए कृपया
  [utctime](https://www.utctime.net/) देखें।
</ParamField>

<ParamField query="lastDays" type="number" default={30}>
  प्रकाशन तिथि, यानी `scheduleDate`, के अनुसार पिछले n दिनों की पोस्ट लौटाता है। डिफ़ॉल्ट 30 दिन।

  <ul class="custom-bullets">
    <li>यदि `startDate` और `endDate` प्रदान किए गए हैं तो `lastDays` को अनदेखा किया जाएगा।</li>
    <li>यदि मान शून्य 0 है तो पोस्ट का पूरा इतिहास लौटाएगा।</li>
    <li>यदि मान 0 से अधिक है, तो यह पिछले n दिनों की पोस्ट लौटाएगा।</li>

    <li>
      उदाहरण के लिए, `lastDays=5` पिछले 5 दिनों की पोस्ट लौटाता है और `lastDays=0` `limit` द्वारा निर्धारित सभी पोस्ट लौटाता है।
    </li>
  </ul>
</ParamField>

<ParamField query="status" type="string">
  पोस्ट की वर्तमान स्थिति द्वारा फ़िल्टर करें। मान्य मान: `success`, `error`, `processing`, `pending`, `paused`, `deleted`, और `awaiting approval`.
  Processing इंगित करता है कि पोस्ट वर्तमान में भेजी जा रही है। Pending इंगित करता है कि पोस्ट भविष्य की तारीख पर पोस्ट करने के लिए शेड्यूल की गई है।

  <Info>
    हटाई गई पोस्ट डिफ़ॉल्ट रूप से नहीं लौटाई जाती हैं। वे केवल `status=deleted` सेट किए गए स्थिति क्वेरी फ़िल्टर के साथ लौटाई जाती हैं।
  </Info>
</ParamField>

<ParamField query="type" type="string">
  प्राप्त करने के लिए पोस्ट का प्रकार, या तो तत्काल भेजी गई पोस्ट या `scheduleDate` फ़ील्ड का उपयोग करके शेड्यूल की गई पोस्ट। मान: `immediate` या `scheduled`।
</ParamField>

<ParamField query="autoRepostId" type="string">
  ऑटो रिपोस्ट बनाते समय पोस्ट की उस श्रृंखला को ट्रैक करने के लिए एक ID असाइन की जाती है।
  ऑटो रिपोस्ट ID द्वारा पोस्ट प्राप्त करें या सभी ऑटो रिपोस्ट प्राप्त करने के लिए `all` का मान उपयोग करें।
</ParamField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl \
  -H "Authorization: Bearer API_KEY" \
  -X GET https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100
  ```

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

  fetch("https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100", {
        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?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100', headers=headers)

  print(r.json())
  ```

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

  $apiUrl = 'https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100';
  $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 HistoryGETRequest_csharp
  {
  class History
  {
      static async Task Main(string[] args)
      {
          string API_KEY = "API_KEY";
          string url = "https://api.ayrshare.com/api/history?startDate=2025-01-01T12:30:00Z&endDate=2025-03-01T12:30:00&limit=100";

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

<ResponseExample>
  ```json 200: Success theme={"system"}
  {
    "history": [
      {
          "errors": [],
          "post": "This is the  post I sent",
          "platforms": [
              "twitter",
              "facebook"
          ],
          "postIds": [
              {
                  "status": "success",
                  "id": "1288968500063775749",    // Twitter Social Post ID
                  "platform": "twitter"
              },
              {
                  "id": "104923907983682_108683297607743", // Facebook Social Post ID
                  "status": "success",
                  "platform": "facebook"
              }
          ],
          "urls": [],
          "type": "now",
          "notes": "Approved by John Smith",  // Reference notes set via /post
          "created": "2022-05-20T17:25:06Z",
          "status": "deleted",
          "scheduleDate": {    // In a future release changed to "scheduleDate": "2020-11-05T12:21:29Z"
              "_seconds": 1604578889,
              "_nanoseconds": 211000000,
              "utc": "2020-11-05T12:21:29Z"
          },
          "id": "rhn6u7wwz2WxGv6MZGK9" // Ayrshare Top-Level Post ID
      },
      {
          "status": "success",
          "platforms": [
              "twitter",
              "facebook"
          ],
          "created": "2022-05-20T17:25:06Z",
          "post": "Sometimes we need to take a break for lunch.",
          "scheduleDate": {    // In a future release changed to "scheduleDate": "2020-11-05T12:21:29Z"
              "_seconds": 1604578889,
              "_nanoseconds": 211000000,
              "utc": "2020-11-05T12:21:29Z"
          },
          "type": "now",
          "postIds": [
              {
                  "platform": "twitter",
                  "id": "1288890036000983105", // Twitter Social Post ID
                  "status": "success"
              },
              {
                  "id": "104923907983682_108329970009742", // Facebook Social Post ID
                  "status": "success",
                  "platform": "facebook",
                  "isVideo": true // Video post
              }
          ],
          "errors": [],
          "urls": [],
          "id": "wWIY0OEirdNeYSJYm1Xa" // Ayrshare Post ID
      },
      {   // Awaiting approval post - Approved by user
          "approved": true,
          "approvedBy": "9abf1426d6ce9122ef11c7222e1",
          "approvedDate": "2025-06-06T12:28:12Z",
          "created": "2025-06-06T12:27:56Z",
          "errors": [],
          "id": "sujQsrXtroJU0NEOlY38",
          "mediaUrls": [],
          "platforms": [
              "twitter"
          ],
          "post": "I failed my way to success. - Thomas Edison",
          "postIds": [
              {
                  "status": "success",
                  "id": "193096515330813",
                  "postUrl": "https://twitter.com/RetiretyHQ/status/19309651533081",
                  "platform": "twitter"
              }
          ],
          "profileTitle": "Primary Profile",
          "refId": "9abf1426d6ce9122ef11c7222e1",
          "requiresApproval": true,
          "scheduleDate": "2025-06-06T12:27:56Z",
          "shortenLinks": false,
          "status": "success",
          "type": "now"
      },
      {   // Awaiting approval post - Rejected by user
          "approved": false,
          "created": "2025-06-06T12:23:48Z",
          "id": "XL5xHeNK8HGTg07qxzmd",
          "mediaUrls": [],
          "platforms": [
              "twitter"
          ],
          "post": " Honesty is the first chapter in the book of wisdom. - Thomas Jefferson",
          "profileTitle": "Primary Profile",
          "refId": "9abf1426d6ce9122ef11c72bd62eddw2",
          "rejectedBy": "9abf1426d6ce9122ef11c7222e1",
          "rejectedDate": "2025-06-06T12:23:58Z",
          "requiresApproval": true,
          "scheduleDate": "2025-06-06T12:23:48Z",
          "shortenLinks": false,
          "status": "awaiting approval",
          "type": "now"
      }
          
     ],
      "refId": "9abf1426d6ce9122ef11c72bd62e59807c5cc083",
      "count": 100,
      "lastUpdated": "2025-04-05T22:44:14.209Z",
      "nextUpdate": "2025-04-05T22:45:14.209Z"
  }
  ```

  ```json 400: History not found theme={"system"}
  {
    "action": "history",
    "status": "error",
    "code": 221,
    "message": "History not found for the past 30 days. Please see the docs on how to retrieve additional history. .../ayrshare.com/rest-api/endpoints/history#list-history-of-sent-and-scheduled-posts"
  }
  ```
</ResponseExample>
