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

# Get Foods (Menu Items)

> Retrieve all menu items with modifiers

<Note>
  **Rate Limited:** This endpoint has a 30-second cooldown between requests.
</Note>

## Overview

Retrieves all menu items across accessible restaurants with complete details including categories, prices, and modifier groups.

## 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="array">
  Array of food/menu item objects

  <Expandable title="Food Object">
    <ResponseField name="food_id" type="integer">
      Unique identifier for the menu item
    </ResponseField>

    <ResponseField name="name" type="string">
      Display name of the food item
    </ResponseField>

    <ResponseField name="category" type="object">
      <Expandable title="Category Details">
        <ResponseField name="id" type="integer">
          Category ID
        </ResponseField>

        <ResponseField name="name" type="string">
          Category name (e.g., "Burritos", "Tacos")
        </ResponseField>

        <ResponseField name="sort" type="integer">
          Display order
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="desc" type="string">
      Product description
    </ResponseField>

    <ResponseField name="image" type="string | null">
      Full URL to product image
    </ResponseField>

    <ResponseField name="restaurant_id" type="string">
      Branch UUID this item belongs to
    </ResponseField>

    <ResponseField name="price" type="number">
      Base price in smallest currency unit (cents/kuruş)
    </ResponseField>

    <ResponseField name="add_substract" type="array">
      Array of modifier groups

      <Expandable title="Modifier Group">
        <ResponseField name="ilave_basligi" type="string">
          Modifier group name (e.g., "Sos Seçimi")
        </ResponseField>

        <ResponseField name="secim_turu" type="string">
          Selection type: `"tekli"` (single choice) or `"coklu"` (multiple choice)
        </ResponseField>

        <ResponseField name="ekleme_cikarma" type="string">
          Operation type: always `"ekleme"` (addition)
        </ResponseField>

        <ResponseField name="zorunlu_turu" type="string">
          Requirement: `"zorunlu"` (required) or `"opsiyonel"` (optional)
        </ResponseField>

        <ResponseField name="ilave_opsiyonlari" type="array">
          Available options

          <Expandable title="Option">
            <ResponseField name="name" type="string">
              Option name
            </ResponseField>

            <ResponseField name="price" type="number">
              Additional price for this option
            </ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## Examples

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

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://www.xn--dkkango-n2a.com/api/integrations/foods/get-foods',
    {
      headers: {
        'Access-Token': 'your-access-token'
      }
    }
  );

  const data = await response.json();
  ```

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

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

  data = response.json()
  ```
</CodeGroup>

## Response Example

```json theme={null}
{
  "status": true,
  "data": [
    {
      "food_id": 1,
      "name": "Beef Burrito",
      "category": {
        "id": 1,
        "name": "Burritos",
        "sort": 0
      },
      "desc": "Delicious beef burrito with fresh ingredients",
      "image": "https://example.com/images/beef-burrito.jpg",
      "restaurant_id": "0ca1d2b1-a199-4960-8617-83a659d890c8",
      "sort": 0,
      "price": 675,
      "add_substract": [
        {
          "ilave_basligi": "Sos Seçimi",
          "secim_turu": "coklu",
          "ekleme_cikarma": "ekleme",
          "zorunlu_turu": "opsiyonel",
          "ilave_opsiyonlari": [
            {
              "name": "Ballı Hardal",
              "price": 10
            },
            {
              "name": "Balzamik Hardal",
              "price": 15
            }
          ]
        }
      ]
    }
  ]
}
```

## Understanding Modifiers

### Selection Types

<Tabs>
  <Tab title="Tekli (Single)">
    Customer can select **only one** option from the group.

    **Example:** Size selection (Small, Medium, Large)

    ```json theme={null}
    {
      "secim_turu": "tekli",
      "ilave_opsiyonlari": [
        {"name": "Small", "price": 0},
        {"name": "Medium", "price": 50},
        {"name": "Large", "price": 100}
      ]
    }
    ```
  </Tab>

  <Tab title="Çoklu (Multiple)">
    Customer can select **multiple** options from the group.

    **Example:** Toppings (Lettuce, Tomato, Onion)

    ```json theme={null}
    {
      "secim_turu": "coklu",
      "ilave_opsiyonlari": [
        {"name": "Lettuce", "price": 0},
        {"name": "Tomato", "price": 5},
        {"name": "Onion", "price": 5}
      ]
    }
    ```
  </Tab>
</Tabs>

### Requirement Types

<Tabs>
  <Tab title="Zorunlu (Required)">
    Customer **must** select at least one option.

    ```json theme={null}
    {
      "zorunlu_turu": "zorunlu",
      "ilave_basligi": "Protein Choice"
    }
    ```
  </Tab>

  <Tab title="Opsiyonel (Optional)">
    Customer **can** skip this modifier group.

    ```json theme={null}
    {
      "zorunlu_turu": "opsiyonel",
      "ilave_basligi": "Extra Toppings"
    }
    ```
  </Tab>
</Tabs>

## Caching Strategy

<Warning>
  Due to the 30-second rate limit, **cache this data locally** in your POS system.
</Warning>

<Steps>
  <Step title="Initial Fetch">
    Call `/get-foods` when your POS starts or when user manually refreshes.
  </Step>

  <Step title="Store Locally">
    Cache the complete menu structure in memory or local database.
  </Step>

  <Step title="Periodic Refresh">
    Refresh menu every 30-60 minutes or on manual request.
  </Step>

  <Step title="Real-time Updates">
    Use `/foods/status-active` and `/foods/status-passive` to toggle availability without full refresh.
  </Step>
</Steps>

## Error Responses

<ResponseExample>
  ```json Rate Limit Error (429) theme={null}
  {
    "status": false,
    "error": "çok fazla istek",
    "message": "Çok fazla istek. Lütfen 30 saniye bekleyin."
  }
  ```

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

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Activate Food" icon="check" href="/api-reference/foods/status-active">
    Make menu item available
  </Card>

  <Card title="Deactivate Food" icon="xmark" href="/api-reference/foods/status-passive">
    Mark item as unavailable
  </Card>
</CardGroup>

## Price Calculation Example

```javascript theme={null}
function calculateItemTotal(food, selectedModifiers) {
  let total = food.price;
  
  // Add modifier prices
  for (const modifier of selectedModifiers) {
    for (const option of modifier.selected_options) {
      total += option.price;
    }
  }
  
  return total;
}

// Example usage
const food = { price: 675 }; // Beef Burrito
const modifiers = [
  {
    selected_options: [
      { name: "Ballı Hardal", price: 10 },
      { name: "Balzamik Hardal", price: 15 }
    ]
  }
];

const total = calculateItemTotal(food, modifiers);
// Result: 675 + 10 + 15 = 700 (₺7.00)
```

<Tip>
  Always convert prices to human-readable format: divide by 100 for display (e.g., `675` → `₺6.75`).
</Tip>
