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

# शॉर्ट लिंक अपडेट करें

> मौजूदा शॉर्ट लिंक का डेस्टिनेशन URL अपडेट करें

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

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

<PlansAvailable plans={["business"]} maxPackRequired={true} />

किसी मौजूदा शॉर्ट लिंक का डेस्टिनेशन URL अपडेट करें। जब आप पहली बार `POST /links` के माध्यम से शॉर्ट लिंक बनाते हैं तो शॉर्ट लिंक ID लौटाई जाती है।

<Note>
  **सोशल मीडिया प्रीव्यू कैशिंग:** सोशल मीडिया प्लेटफ़ॉर्म मूल डेस्टिनेशन URL से Open Graph प्रीव्यू कार्ड कैश करते हैं। शॉर्ट लिंक अपडेट करने के बाद, कैश के समाप्त होने तक सोशल प्लेटफ़ॉर्मों पर दिखाया गया प्रीव्यू कार्ड नए डेस्टिनेशन से मेल नहीं खा सकता है।
</Note>

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

<HeaderAPI noProfileKey />

## पाथ पैरामीटर

<ParamField path="id" type="string" required>
  `POST /links` से लौटाई गई शॉर्ट लिंक ID (उदा., "TkuWEy")।
</ParamField>

## बॉडी पैरामीटर

<ParamField body="url" type="string" required>
  नया डेस्टिनेशन URL। https\:// से शुरू होने वाला एक वैध URL होना चाहिए
</ParamField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl \
  -H "Authorization: Bearer API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"url": "https://www.new-destination.com"}' \
  -X PUT https://api.ayrshare.com/api/links/TkuWEy
  ```

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

  fetch("https://api.ayrshare.com/api/links/TkuWEy", {
        method: "PUT",
        headers: {
          "Content-Type": "application/json",
          "Authorization": `Bearer ${API_KEY}`
        },
        body: JSON.stringify({
          url: "https://www.new-destination.com", // required
        }),
      })
        .then((res) => res.json())
        .then((json) => console.log(json))
        .catch(console.error);
  ```

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

  payload = {'url': 'https://www.new-destination.com'}
  headers = {'Content-Type': 'application/json',
          'Authorization': 'Bearer API_KEY'}

  r = requests.put('https://api.ayrshare.com/api/links/TkuWEy',
      json=payload,
      headers=headers)

  print(r.json())
  ```

  ```php PHP theme={"system"}
  require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html

  $client = new GuzzleHttp\Client();
  $res = $client->request(
      'PUT',
      'https://api.ayrshare.com/api/links/TkuWEy',
      [
          'headers' => [
              'Content-Type'  => 'application/json',
              'Authorization' => 'Bearer API_KEY'
          ],
          'json' => [
              'url' => 'https://www.new-destination.com',
          ]
      ]
  );

  echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
  ```
</RequestExample>

<ResponseExample>
  ```json 200: सफलता theme={"system"}
  {
      "status": "success",
      "id": "TkuWEy",
      "originalUrl": "https://www.new-destination.com",
      "shortUrl": "https://ayrs.io/TkuWEy",
      "created": "2023-07-17T15:20:51.118Z",
      "updated": "2024-01-10T12:30:00.000Z"
  }
  ```

  ```json 400: अमान्य URL प्रारूप theme={"system"}
  {
    "action": "request",
    "status": "error",
    "code": 126,
    "message": "Shorten URL failed. Please verify the URL is properly formatted and the correct UTM parameters are used."
  }
  ```

  ```json 404: लिंक नहीं मिला theme={"system"}
  {
    "action": "link",
    "status": "error",
    "code": 418,
    "message": "Link not found or not owned by user."
  }
  ```
</ResponseExample>
