# Duplicate a draft menu

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidocs.cata.sg/pos-integration-service-api/api/v-1/menus/menu-id/duplicate/llms.txt.
> For full documentation content, see https://apidocs.cata.sg/pos-integration-service-api/api/v-1/menus/menu-id/duplicate/llms-full.txt.

POST http://localhost:8080/api/v1/menus/{menuId}/duplicate

Creates a deep copy of an existing draft menu, including all sections,
section items, and default operating hours. The new draft is named
"Copy of {original name}".

Store operating hours and store assignments are NOT copied.
The caller can rename the duplicate via `PUT /api/v1/menus/{newId}`.


Reference: https://apidocs.cata.sg/pos-integration-service-api/api/v-1/menus/menu-id/duplicate/duplicate-a-draft-menu

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/v1/menus/{menuId}/duplicate:
    post:
      operationId: duplicate-a-draft-menu
      summary: Duplicate a draft menu
      description: |
        Creates a deep copy of an existing draft menu, including all sections,
        section items, and default operating hours. The new draft is named
        "Copy of {original name}".

        Store operating hours and store assignments are NOT copied.
        The caller can rename the duplicate via `PUT /api/v1/menus/{newId}`.
      tags:
        - >-
          subpackage_api.subpackage_api/v1.subpackage_api/v1/menus.subpackage_api/v1/menus/menuId.subpackage_api/v1/menus/menuId/duplicate
      parameters:
        - name: menuId
          in: path
          description: Menu UUID
          required: true
          schema:
            type: string
        - name: X-Api-Key
          in: header
          required: true
          schema:
            type: string
        - name: X-Tenant-ID
          in: header
          description: Tenant identifier
          required: false
          schema:
            type: string
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/api_v1_menus_{menuId}_duplicate_Duplicate
                  a draft menu_Response_201
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiV1MenusMenuidDuplicateRequestNotFoundError
servers:
  - url: http://localhost:8080
components:
  schemas:
    ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuStoresItems:
      type: object
      properties:
        uuid:
          type: string
        name:
          type: string
      required:
        - uuid
        - name
      title: >-
        ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuStoresItems
    ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuOperatingHoursItems:
      type: object
      properties:
        weekday:
          type: integer
        startTime:
          type: string
        endTime:
          type: string
      required:
        - weekday
        - startTime
        - endTime
      title: >-
        ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuOperatingHoursItems
    ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuStoreOperatingHoursKey0Items:
      type: object
      properties:
        weekday:
          type: integer
        startTime:
          type: string
        endTime:
          type: string
      required:
        - weekday
        - startTime
        - endTime
      title: >-
        ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuStoreOperatingHoursKey0Items
    ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuStoreOperatingHoursKey1Items:
      type: object
      properties:
        weekday:
          type: integer
        startTime:
          type: string
        endTime:
          type: string
      required:
        - weekday
        - startTime
        - endTime
      title: >-
        ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuStoreOperatingHoursKey1Items
    ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuStoreOperatingHours:
      type: object
      properties:
        key_0:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuStoreOperatingHoursKey0Items
        key_1:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuStoreOperatingHoursKey1Items
      required:
        - key_0
        - key_1
      title: >-
        ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuStoreOperatingHours
    ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuGroupsItems:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        sortNum:
          type: integer
      required:
        - id
        - name
        - sortNum
      title: >-
        ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuGroupsItems
    ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuSectionsItemsItemsItems:
      type: object
      properties:
        id:
          type: integer
        itemId:
          type: integer
        itemCode:
          type: string
        name:
          type: string
        provider:
          type: string
        sortNum:
          type: integer
        visible:
          type: boolean
        basePrice:
          type: number
          format: double
        specialPrice:
          type: number
          format: double
        deletedAt:
          type: string
          format: date-time
      required:
        - id
        - itemId
        - itemCode
        - name
        - provider
        - sortNum
        - visible
        - basePrice
        - specialPrice
        - deletedAt
      title: >-
        ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuSectionsItemsItemsItems
    ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuSectionsItems:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        displayType:
          type: string
        sortNum:
          type: integer
        visible:
          type: boolean
        items:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuSectionsItemsItemsItems
        createdAt:
          type: string
        updatedAt:
          type: string
      required:
        - id
        - name
        - description
        - displayType
        - sortNum
        - visible
        - items
        - createdAt
        - updatedAt
      title: >-
        ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuSectionsItems
    ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenu:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        internalName:
          type: string
        channelType:
          type: string
        priority:
          type: integer
        isPublishable:
          type: boolean
        warnings:
          type: array
          items:
            type: string
        storeCount:
          type: integer
        stores:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuStoresItems
        startDate:
          type: string
        endDate:
          type: string
        operatingHours:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuOperatingHoursItems
        storeOperatingHours:
          $ref: >-
            #/components/schemas/ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuStoreOperatingHours
        groups:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuGroupsItems
        sections:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenuSectionsItems
        createdAt:
          type: string
        updatedAt:
          type: string
        deletedAt:
          type: string
      required:
        - id
        - name
        - internalName
        - channelType
        - priority
        - isPublishable
        - warnings
        - storeCount
        - stores
        - startDate
        - endDate
        - operatingHours
        - storeOperatingHours
        - groups
        - sections
        - createdAt
        - updatedAt
        - deletedAt
      title: ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenu
    api_v1_menus_{menuId}_duplicate_Duplicate a draft menu_Response_201:
      type: object
      properties:
        code:
          type: integer
        isSuccess:
          type: boolean
        message:
          type: string
        menu:
          $ref: >-
            #/components/schemas/ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaMenu
      required:
        - code
        - isSuccess
        - message
        - menu
      title: api_v1_menus_{menuId}_duplicate_Duplicate a draft menu_Response_201
    ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaError:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
        details:
          type: string
        field:
          type: string
      required:
        - code
        - message
        - details
        - field
      title: ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaError
    PostApiV1MenusMenuidDuplicateRequestNotFoundError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/ApiV1MenusMenuIdDuplicatePostResponsesContentApplicationJsonSchemaError
      required:
        - error
      title: PostApiV1MenusMenuidDuplicateRequestNotFoundError
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

```

## SDK Code Examples

```python api_v1_menus_{menuId}_duplicate_Duplicate a draft menu_example
import requests

url = "http://localhost:8080/api/v1/menus/string/duplicate"

headers = {
    "X-Tenant-ID": "string",
    "X-Api-Key": "<apiKey>"
}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript api_v1_menus_{menuId}_duplicate_Duplicate a draft menu_example
const url = 'http://localhost:8080/api/v1/menus/string/duplicate';
const options = {method: 'POST', headers: {'X-Tenant-ID': 'string', 'X-Api-Key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go api_v1_menus_{menuId}_duplicate_Duplicate a draft menu_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:8080/api/v1/menus/string/duplicate"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("X-Tenant-ID", "string")
	req.Header.Add("X-Api-Key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby api_v1_menus_{menuId}_duplicate_Duplicate a draft menu_example
require 'uri'
require 'net/http'

url = URI("http://localhost:8080/api/v1/menus/string/duplicate")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["X-Tenant-ID"] = 'string'
request["X-Api-Key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java api_v1_menus_{menuId}_duplicate_Duplicate a draft menu_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("http://localhost:8080/api/v1/menus/string/duplicate")
  .header("X-Tenant-ID", "string")
  .header("X-Api-Key", "<apiKey>")
  .asString();
```

```php api_v1_menus_{menuId}_duplicate_Duplicate a draft menu_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:8080/api/v1/menus/string/duplicate', [
  'headers' => [
    'X-Api-Key' => '<apiKey>',
    'X-Tenant-ID' => 'string',
  ],
]);

echo $response->getBody();
```

```csharp api_v1_menus_{menuId}_duplicate_Duplicate a draft menu_example
using RestSharp;

var client = new RestClient("http://localhost:8080/api/v1/menus/string/duplicate");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Tenant-ID", "string");
request.AddHeader("X-Api-Key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift api_v1_menus_{menuId}_duplicate_Duplicate a draft menu_example
import Foundation

let headers = [
  "X-Tenant-ID": "string",
  "X-Api-Key": "<apiKey>"
]

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8080/api/v1/menus/string/duplicate")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```