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

# Close Restaurant

> Set restaurant status to closed

## Overview

Sets a restaurant status to closed, preventing new orders from being placed by customers.

<Warning>
  Existing orders in progress will still need to be completed even after closing.
</Warning>

## Path Parameters

<ParamField path="rest_id" type="string" required>
  Restaurant/branch UUID
</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/restaurants/status/close/8f2b9ce2-04de-4712-842d-a39f64596fdf \
    -H 'Access-Token: your-access-token'
  ```

  ```javascript JavaScript theme={null}
  const restaurantId = '8f2b9ce2-04de-4712-842d-a39f64596fdf';

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

  const data = await response.json();
  // Restaurant is now closed
  ```

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

  restaurant_id = '8f2b9ce2-04de-4712-842d-a39f64596fdf'

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

  data = response.json()
  # Restaurant is now closed
  ```

  ```php PHP theme={null}
  <?php
  $restaurantId = '8f2b9ce2-04de-4712-842d-a39f64596fdf';
  $url = "https://www.xn--dkkango-n2a.com/api/integrations/restaurants/status/close/{$restaurantId}";

  $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);
  // Restaurant is now closed
  ?>
  ```
</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 UUID (403) theme={null}
  {
    "status": false,
    "error": "URL hatalı"
  }
  ```

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

## When to Use

<AccordionGroup>
  <Accordion title="Daily Closing">
    Close restaurant at end of business day.

    ```javascript theme={null}
    async function closeRestaurant() {
      // Check for pending orders
      const pendingOrders = await getPendingOrders();
      
      if (pendingOrders.length > 0) {
        const confirm = await askStaff(
          `${pendingOrders.length} orders pending. Close anyway?`
        );
        if (!confirm) return;
      }
      
      // Close restaurant
      await setRestaurantStatus(restaurantId, 'close');
      
      // Update UI
      showClosedStatus();
      
      // Log event
      console.log('Restaurant closed at', new Date());
    }
    ```
  </Accordion>

  <Accordion title="Break Time">
    Temporarily close for lunch break or maintenance.

    ```javascript theme={null}
    async function startBreak(duration) {
      await setRestaurantStatus(restaurantId, 'close');
      notifyStaff(`Restaurant closed for ${duration} minutes`);
      
      // Auto-reopen after break
      setTimeout(async () => {
        await setRestaurantStatus(restaurantId, 'open');
        notifyStaff('Break ended - restaurant is open');
      }, duration * 60 * 1000);
    }
    ```
  </Accordion>

  <Accordion title="Emergency Closure">
    Close immediately due to emergency or technical issues.

    ```javascript theme={null}
    async function emergencyClose(reason) {
      await setRestaurantStatus(restaurantId, 'close');
      
      // Cancel pending orders
      const pending = await getPendingOrders();
      for (const order of pending) {
        await cancelOrder(order.id, 5); // Technical issue
      }
      
      logEmergency(reason);
      notifyManagement(reason);
    }
    ```
  </Accordion>

  <Accordion title="Capacity Limit">
    Close when too busy or understaffed.

    ```javascript theme={null}
    async function checkCapacity() {
      const activeOrders = await getActiveOrderCount();
      const MAX_CAPACITY = 20;
      
      if (activeOrders >= MAX_CAPACITY) {
        await setRestaurantStatus(restaurantId, 'close');
        notifyStaff('Capacity reached - closed temporarily');
      }
    }
    ```
  </Accordion>
</AccordionGroup>

## What Happens

<Steps>
  <Step title="Status Updated">
    Restaurant status changes to "Closed" in Dükkango platform
  </Step>

  <Step title="Hidden from Customers">
    Restaurant becomes unavailable in customer apps (or shown as closed)
  </Step>

  <Step title="No New Orders">
    Customers cannot place new orders
  </Step>

  <Step title="Existing Orders Continue">
    Orders already in progress must still be completed
  </Step>
</Steps>

## Important Notes

<Note>
  **Closing does NOT:**

  * Cancel existing orders
  * Stop you from receiving orders already in the system
  * Affect orders that were placed before closing

  **You must still:**

  * Complete all pending orders
  * Accept/reject received orders
  * Deliver in-progress orders
</Note>

## Best Practices

<AccordionGroup>
  <Accordion title="Check Before Closing">
    ```javascript theme={null}
    async function safeClose() {
      // 1. Check active orders
      const active = await getActiveOrders();
      if (active.length > 0) {
        console.warn(`${active.length} orders still active`);
      }
      
      // 2. Check unaccepted orders
      const received = await getReceivedOrders();
      if (received.length > 0) {
        alert(`${received.length} orders need attention!`);
        return false;
      }
      
      // 3. Close
      await setRestaurantStatus(restaurantId, 'close');
      return true;
    }
    ```
  </Accordion>

  <Accordion title="Notify Customers">
    Consider notifying customers before closing (if platform supports it).
  </Accordion>

  <Accordion title="Scheduled Closing">
    Automate daily closing time.

    ```javascript theme={null}
    // Close at 10:00 PM daily
    scheduleDaily('22:00', async () => {
      await closeRestaurant();
    });
    ```
  </Accordion>
</AccordionGroup>

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Open Restaurant" icon="door-open" href="/api-reference/restaurants/status-open">
    Set restaurant to open
  </Card>

  <Card title="Check Status" icon="circle-question" href="/api-reference/restaurants/status-get">
    Get current status
  </Card>

  <Card title="Cancel Orders" icon="xmark" href="/api-reference/orders/cancel">
    Cancel pending orders
  </Card>
</CardGroup>
