> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tracklysms.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Schedule

> Archive a schedule (soft delete). The schedule is not permanently removed.

Soft-delete a schedule by setting its status to `archive`. Archived schedules are excluded from the default [List Schedules](/api-reference/v2/schedules/list-schedules) response but can still be retrieved by explicitly filtering with `status=archive`.

This operation is not reversible through the API. To restore an archived schedule, use the [Update Schedule](/api-reference/v2/schedules/update-schedule) endpoint to change its status back to `draft` or `off`.

## Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier of the schedule to archive.
</ParamField>

## Response Fields

<ResponseField name="success" type="boolean">
  `true` if the schedule was archived successfully.
</ResponseField>

<ResponseField name="archived" type="boolean">
  `true` confirming the schedule has been moved to archive status.
</ResponseField>

## Examples

<RequestExample>
  <CodeGroup>
    ```bash cURL theme={null}
    curl -X DELETE "https://api.tracklysms.com/api/v2/schedules/6651a3f2e4b0a1c2d3e4f567" \
      -H "X-Api-Key: trk_your_api_key_here"
    ```

    ```python Python theme={null}
    import requests

    schedule_id = "6651a3f2e4b0a1c2d3e4f567"

    response = requests.delete(
        f"https://api.tracklysms.com/api/v2/schedules/{schedule_id}",
        headers={"X-Api-Key": "trk_your_api_key_here"},
    )

    data = response.json()
    if data["success"]:
        print("Schedule archived successfully.")
    ```

    ```javascript Node.js theme={null}
    const scheduleId = "6651a3f2e4b0a1c2d3e4f567";

    const response = await fetch(
      `https://api.tracklysms.com/api/v2/schedules/${scheduleId}`,
      {
        method: "DELETE",
        headers: {
          "X-Api-Key": "trk_your_api_key_here"
        }
      }
    );

    const data = await response.json();
    if (data.success) {
      console.log("Schedule archived successfully.");
    }
    ```
  </CodeGroup>
</RequestExample>

<ResponseExample>
  ```json 200 — Success theme={null}
  {
    "success": true,
    "archived": true
  }
  ```

  ```json 404 — Not Found theme={null}
  {
    "error": "Schedule not found",
    "code": "not_found"
  }
  ```

  ```json 401 — Unauthorized theme={null}
  {
    "error": "Invalid credentials",
    "code": "invalid_credentials"
  }
  ```
</ResponseExample>

## Error Codes

| HTTP Status | Error Code            | Description                                                                                                                |
| ----------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| 401         | `invalid_credentials` | API key is missing, invalid, or revoked.                                                                                   |
| 403         | `account_suspended`   | Your account is suspended. Resolve outstanding billing or contact support.                                                 |
| 429         | `rate_limited`        | Request throttled; retry with exponential backoff after the window resets.                                                 |
| 404         | `not_found`           | No schedule exists with the given ID.                                                                                      |
| 409         | `schedule_locked`     | The schedule is inside its execution lock window and cannot be archived until `unlocksAt` (also included in the response). |

## Next Steps

<CardGroup cols={2}>
  <Card title="Campaign Scheduling" icon="calendar" href="/guides/campaigns/scheduling">
    Learn about scheduling
  </Card>

  <Card title="List Audiences" icon="users" href="/api-reference/v2/audiences/list-audiences">
    View audiences
  </Card>
</CardGroup>
