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

# Disable or Enable order

> Enable or disable an order template by flipping the active flag.

<ParamField header="x-api-key" type="string" required placeholder="your-api-key">
  Your StarkFi API key. You can find it in your [dashboard](https://app.starkfi.io).
</ParamField>

<ParamField path="order_id" type="string" required>
  Order CUID.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request PATCH \
    --url https://api.starkfi.io/order/clxxxxxxxxxxxxxxxxxxxxxxxx/toggle \
    --header 'x-api-key: <api_key>'
  ```

  ```javascript Node.js theme={null}
  const orderId = "clxxxxxxxxxxxxxxxxxxxxxxxx";
  const response = await fetch(
    `https://api.starkfi.io/order/${orderId}/toggle`,
    { method: "PATCH", headers: { "x-api-key": "<api_key>" } }
  );
  const data = await response.json();
  ```

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

  order_id = "clxxxxxxxxxxxxxxxxxxxxxxxx"
  response = requests.patch(
      f"https://api.starkfi.io/order/{order_id}/toggle",
      headers={"x-api-key": "<api_key>"},
  )
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success (activated) theme={null}
  {
    "statusCode": 200,
    "success": true,
    "status": "order_activated",
    "message": "Order activated successfully.",
    "data": {
      "id": "clxxxxxxxxxxxxxxxxxxxxxxxx",
      "active": true
    }
  }
  ```

  ```json 200 - Success (deactivated) theme={null}
  {
    "statusCode": 200,
    "success": true,
    "status": "order_deactivated",
    "message": "Order deactivated successfully.",
    "data": {
      "id": "clxxxxxxxxxxxxxxxxxxxxxxxx",
      "active": false
    }
  }
  ```

  ```json 404 - Not Found theme={null}
  {
    "statusCode": 404,
    "success": false,
    "status": "order_not_found",
    "message": "Order not found."
  }
  ```
</ResponseExample>

### Response

<ResponseField name="data.id" type="string" required>
  Order id that was toggled.
</ResponseField>

<ResponseField name="data.active" type="boolean" required>
  New `active` value after the toggle.
</ResponseField>
