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

# Activate Food Item

> Make a menu item available for ordering

## Overview

Activates a specific menu item, making it available for customers to order.

## Path Parameters

<ParamField path="food_id" type="integer" required>
  Food/product ID from the menu
</ParamField>

## Headers

<ParamField header="Access-Token" type="string" required>
  Your API access token
</ParamField>

## Response

<ResponseField name="status" type="boolean">
  `true` if successful
</ResponseField>

<ResponseField name="data" type="string">
  `"OK"` on success
</ResponseField>

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT https://www.xn--dkkango-n2a.com/api/integrations/foods/status-active/1 \
    -H 'Access-Token: your-access-token'
  ```

  ```javascript JavaScript theme={null}
  const foodId = 1; // Beef Burrito

  const response = await fetch(
    `https://www.xn--dkkango-n2a.com/api/integrations/foods/status-active/${foodId}`,
    {
      method: 'PUT',
      headers: {
        'Access-Token': 'your-access-token'
      }
    }
  );

  const data = await response.json();
  // Food item is now available
  ```

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

  food_id = 1  # Beef Burrito

  response = requests.put(
      f'https://www.xn--dkkango-n2a.com/api/integrations/foods/status-active/{food_id}',
      headers={'Access-Token': 'your-access-token'}
  )

  data = response.json()
  # Food item is now available
  ```

  ```php PHP theme={null}
  <?php
  $foodId = 1; // Beef Burrito
  $url = "https://www.xn--dkkango-n2a.com/api/integrations/foods/status-active/{$foodId}";

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      'Access-Token: your-access-token'
  ));
  $response = curl_exec($ch);
  curl_close($ch);
  // Food item is now available
  ?>
  ```
</CodeGroup>

## Success Response (200)

```json theme={null}
{
  "status": true,
  "data": "OK"
}
```

## Error Responses

<ResponseExample>
  ```json Authentication Error (401) theme={null}
  {
    "status": false,
    "error": "yetkisiz erişim"
  }
  ```

  ```json Invalid ID (403) theme={null}
  {
    "status": false,
    "error": "URL hatalı"
  }
  ```

  ```json Not Found (404) theme={null}
  {
    "status": false,
    "error": "ürün bulunamadı"
  }
  ```
</ResponseExample>

## Use Cases

<AccordionGroup>
  <Accordion title="Stock Replenished">
    Reactivate item when ingredients are back in stock.

    ```javascript theme={null}
    async function restockItem(foodId, itemName) {
      await activateFood(foodId);
      
      notifyStaff(`${itemName} is back in stock and available`);
      logInventoryChange(foodId, 'activated');
    }
    ```
  </Accordion>

  <Accordion title="Daily Specials">
    Activate special menu items for the day.

    ```javascript theme={null}
    async function enableDailySpecials() {
      const specials = [
        { id: 15, name: 'Lunch Special' },
        { id: 16, name: 'Chef\'s Choice' }
      ];
      
      for (const special of specials) {
        await activateFood(special.id);
        console.log(`Activated: ${special.name}`);
      }
    }
    ```
  </Accordion>

  <Accordion title="Time-Based Availability">
    Activate items based on time of day.

    ```javascript theme={null}
    // Activate breakfast items at 7 AM
    scheduleDaily('07:00', async () => {
      const breakfastItems = [5, 6, 7, 8];
      for (const id of breakfastItems) {
        await activateFood(id);
      }
    });

    // Deactivate breakfast items at 11 AM
    scheduleDaily('11:00', async () => {
      const breakfastItems = [5, 6, 7, 8];
      for (const id of breakfastItems) {
        await deactivateFood(id);
      }
    });
    ```
  </Accordion>

  <Accordion title="Bulk Activation">
    Activate multiple items at once.

    ```javascript theme={null}
    async function activateCategory(categoryName) {
      const menu = await getMenu();
      const items = menu.filter(item => 
        item.category.name === categoryName
      );
      
      for (const item of items) {
        await activateFood(item.food_id);
      }
      
      console.log(`Activated ${items.length} items in ${categoryName}`);
    }
    ```
  </Accordion>
</AccordionGroup>

## What Happens

<Steps>
  <Step title="Status Updated">
    Item's `status` changes to `"ACTIVE"` in the database
  </Step>

  <Step title="Visible to Customers">
    Item becomes visible and orderable in customer apps
  </Step>

  <Step title="Orders Accepted">
    Customers can add this item to their cart and place orders
  </Step>
</Steps>

<Info>
  Changes take effect immediately - customers will see the item as available right away.
</Info>

## Best Practices

<Tabs>
  <Tab title="Verify Ingredients">
    ```javascript theme={null}
    async function safeActivate(foodId) {
      // Check inventory first
      const inStock = await checkInventory(foodId);
      
      if (inStock) {
        await activateFood(foodId);
        return true;
      } else {
        console.warn('Cannot activate - out of stock');
        return false;
      }
    }
    ```
  </Tab>

  <Tab title="Log Changes">
    ```javascript theme={null}
    async function activateWithLogging(foodId, reason) {
      await activateFood(foodId);
      
      await logChange({
        type: 'food_activated',
        foodId,
        reason,
        timestamp: new Date(),
        user: currentUser.id
      });
    }
    ```
  </Tab>

  <Tab title="Batch Operations">
    ```javascript theme={null}
    async function activateBatch(foodIds) {
      const results = {
        success: [],
        failed: []
      };
      
      for (const id of foodIds) {
        try {
          await activateFood(id);
          results.success.push(id);
        } catch (error) {
          results.failed.push({ id, error: error.message });
        }
      }
      
      return results;
    }
    ```
  </Tab>
</Tabs>

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Deactivate Food" icon="xmark" href="/api-reference/foods/status-passive">
    Make item unavailable
  </Card>

  <Card title="Get Menu" icon="list" href="/api-reference/foods/get-foods">
    View all menu items
  </Card>
</CardGroup>

<Tip>
  Use this endpoint in combination with your inventory management system for automatic availability updates.
</Tip>
