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

# Xóa Automation

> Xóa mềm một automation

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={["business", "enterprise"]} maxPackRequired={false} />

<Note>
  **Beta.** Xem [Tổng quan về Automations](/apis/automations/overview) để biết mô tả đầy đủ về tính năng.
</Note>

Xóa mềm automation. Hàng master được đánh dấu `deleted: true, active: false`; không có điều phối mới nào xảy ra từ thời điểm này trở đi.

Các trigger, action và hàng activity hiện có **không** được cascade. Lịch sử activity vẫn có thể truy vấn qua [`GET /automations/:id/activity`](/apis/automations/get-activity) miễn là các hàng vẫn tồn tại trong Firestore (retention là vô thời hạn cho theo dõi và phân tích).

Các automation đã bị xóa mềm không còn tính vào giới hạn automation đang hoạt động của bạn. Chúng không thể được khôi phục qua API; hãy tạo một automation mới thay thế.

## Tham số Header

<HeaderAPI />

## Tham số Path

<ParamField path="id" type="string" required>
  ID automation được trả về từ `POST /automations`.
</ParamField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl \
  -H "Authorization: Bearer API_KEY" \
  -X DELETE https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ
  ```

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

  fetch(`https://api.ayrshare.com/api/automations/${id}`, {
    method: "DELETE",
    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"}
  automation_id = "auto_9xKp2Lm4nQ"

  r = requests.delete(
      f"https://api.ayrshare.com/api/automations/{automation_id}",
      headers=headers,
  )

  print(r.json())
  ```

  ```php PHP theme={"system"}
  $id = "auto_9xKp2Lm4nQ";
  $curl = curl_init();

  curl_setopt_array($curl, [
      CURLOPT_URL => "https://api.ayrshare.com/api/automations/" . $id,
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => "DELETE",
      CURLOPT_HTTPHEADER => ["Authorization: Bearer API_KEY"],
  ]);

  $response = curl_exec($curl);
  curl_close($curl);
  echo $response;
  ```
</RequestExample>

<ResponseExample>
  ```json 200: Success theme={"system"}
  {
    "status": "success",
    "id": "auto_9xKp2Lm4nQ"
  }
  ```

  ```json 404: Not found theme={"system"}
  {
    "action": "automation",
    "status": "error",
    "code": 469,
    "message": "Automation not found"
  }
  ```
</ResponseExample>
