# Update Custom Menu Link

PUT https://services.leadconnectorhq.com/custom-menus/{customMenuId}

Updates an existing custom menu for a given company. Requires authentication and proper permissions.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Agency token: OAuth access token or Private Integration Token.** Scopes: `custom-menu-link.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `customMenuId` | string | Yes | ID of the custom menu to update |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/custom-menus/{customMenuId}": {
      "put": {
        "summary": "Update Custom Menu Link",
        "operationId": "updateCustomMenuLink",
        "description": "Updates an existing custom menu for a given company. Requires authentication and proper permissions.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "customMenuId",
            "required": true,
            "in": "path",
            "description": "ID of the custom menu to update",
            "schema": {
              "example": "62e589c1-c456-47e1-a9a7-cb8900014311",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCustomMenuDTO"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Custom menu successfully updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateCustomMenuLinkResponseDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Invalid input"
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - Insufficient permissions"
          },
          "404": {
            "description": "Not Found - Custom menu or company not found"
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Agency-Access": [
              "custom-menu-link.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "UpdateCustomMenuDTO": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "Title of the custom menu",
            "example": "Custom Menu"
          },
          "url": {
            "type": "string",
            "description": "URL of the custom menu",
            "example": "https://custom-menus.com/"
          },
          "icon": {
            "description": "Icon information for the custom menu",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Name of the icon",
                    "example": "yin-yang"
                  },
                  "fontFamily": {
                    "type": "string",
                    "description": "Font family of the icon",
                    "enum": [
                      "fab",
                      "fas",
                      "far"
                    ]
                  }
                },
                "title": "IconSchemaOptional"
              }
            ]
          },
          "showOnCompany": {
            "type": "boolean",
            "description": "Whether the menu must be displayed on the agency's level",
            "example": true,
            "default": true
          },
          "showOnLocation": {
            "type": "boolean",
            "description": "Whether the menu must be displayed for sub-accounts level",
            "example": true,
            "default": true
          },
          "showToAllLocations": {
            "type": "boolean",
            "description": "Whether the menu must be displayed to all sub-accounts",
            "example": true,
            "default": true
          },
          "openMode": {
            "type": "string",
            "description": "Mode for opening the menu link",
            "enum": [
              "iframe",
              "new_tab",
              "current_tab"
            ]
          },
          "locations": {
            "description": "List of sub-account IDs where the menu should be shown. This list is applicable only when showOnLocation is true and showToAllLocations is false",
            "example": [
              "gfWreTIHL8pDbggBb7af",
              "67WreTIHL8pDbggBb7ty"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "userRole": {
            "type": "string",
            "description": "Which user-roles should the menu be accessible to?",
            "enum": [
              "all",
              "admin",
              "user"
            ]
          },
          "allowCamera": {
            "type": "boolean",
            "description": "Whether to allow camera access (only for iframe mode)",
            "example": false
          },
          "allowMicrophone": {
            "type": "boolean",
            "description": "Whether to allow microphone access (only for iframe mode)",
            "example": false
          }
        },
        "title": "UpdateCustomMenuDTO"
      },
      "UpdateCustomMenuLinkResponseDTO": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Status of update"
          },
          "customMenu": {
            "description": "Updated custom menu link",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Unique identifier for the custom menu",
                    "example": "12345"
                  },
                  "icon": {
                    "description": "Icon information for the menu item",
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "Name of the icon",
                            "example": "yin-yang"
                          },
                          "fontFamily": {
                            "type": "string",
                            "description": "Font family of the icon",
                            "enum": [
                              "fab",
                              "fas",
                              "far"
                            ]
                          }
                        },
                        "title": "IconSchemaOptional"
                      }
                    ]
                  },
                  "title": {
                    "type": "string",
                    "description": "Title of the custom menu",
                    "example": "Dashboard"
                  },
                  "url": {
                    "type": "string",
                    "description": "URL of the custom menu",
                    "example": "/dashboard"
                  },
                  "order": {
                    "type": "number",
                    "description": "Order of the custom menu",
                    "example": 1
                  },
                  "showOnCompany": {
                    "type": "boolean",
                    "description": "Filter to show only agency-level menu links. When omitted, fetches both agency and sub-account menu links. Ignored if locationId is provided",
                    "example": true
                  },
                  "showOnLocation": {
                    "type": "boolean",
                    "description": "Whether the menu must be displayed for sub-accounts level",
                    "example": true
                  },
                  "showToAllLocations": {
                    "type": "boolean",
                    "description": "Whether the menu must be displayed to all sub-accounts",
                    "example": true
                  },
                  "locations": {
                    "description": "List of sub-account IDs where the menu should be shown. This list is applicable only when showOnLocation is true and showToAllLocations is false",
                    "example": [
                      "gfWreTIHL8pDbggBb7af",
                      "67WreTIHL8pDbggBb7ty"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "openMode": {
                    "type": "string",
                    "description": "Mode for opening the menu link",
                    "enum": [
                      "iframe",
                      "new_tab",
                      "current_tab"
                    ]
                  },
                  "userRole": {
                    "type": "string",
                    "description": "Which user-roles should the menu be accessible to?",
                    "enum": [
                      "all",
                      "admin",
                      "user"
                    ]
                  },
                  "allowCamera": {
                    "type": "boolean",
                    "description": "Indicates if camera access is allowed for this menu",
                    "example": false
                  },
                  "allowMicrophone": {
                    "type": "boolean",
                    "description": "Indicates if microphone access is allowed for this menu",
                    "example": false
                  }
                },
                "title": "CustomMenuSchema"
              }
            ]
          }
        },
        "title": "UpdateCustomMenuLinkResponseDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X PUT 'https://services.leadconnectorhq.com/custom-menus/<customMenuId>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "title": "Custom Menu",
  "url": "https://custom-menus.com/",
  "icon": {
    "name": "yin-yang"
  },
  "showOnCompany": true,
  "showOnLocation": true,
  "showToAllLocations": true,
  "locations": [
    "gfWreTIHL8pDbggBb7af",
    "67WreTIHL8pDbggBb7ty"
  ],
  "allowCamera": false,
  "allowMicrophone": false
}'
```

**Node.js**

```javascript
const options = {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "title": "Custom Menu",
      "url": "https://custom-menus.com/",
      "icon": {
        "name": "yin-yang"
      },
      "showOnCompany": true,
      "showOnLocation": true,
      "showToAllLocations": true,
      "locations": [
        "gfWreTIHL8pDbggBb7af",
        "67WreTIHL8pDbggBb7ty"
      ],
      "allowCamera": false,
      "allowMicrophone": false
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/custom-menus/<customMenuId>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/custom-menus/{customMenuId}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

payload = {
    "title": "Custom Menu",
    "url": "https://custom-menus.com/",
    "icon": {
        "name": "yin-yang"
    },
    "showOnCompany": true,
    "showOnLocation": true,
    "showToAllLocations": true,
    "locations": [
        "gfWreTIHL8pDbggBb7af",
        "67WreTIHL8pDbggBb7ty"
    ],
    "allowCamera": false,
    "allowMicrophone": false
}

response = requests.put(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/custom-menus/<customMenuId>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "title": "Custom Menu",
  "url": "https://custom-menus.com/",
  "icon": {
    "name": "yin-yang"
  },
  "showOnCompany": true,
  "showOnLocation": true,
  "showToAllLocations": true,
  "locations": [
    "gfWreTIHL8pDbggBb7af",
    "67WreTIHL8pDbggBb7ty"
  ],
  "allowCamera": false,
  "allowMicrophone": false
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .put("https://services.leadconnectorhq.com/custom-menus/<customMenuId>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"title\":\"Custom Menu\",\"url\":\"https://custom-menus.com/\",\"icon\":{\"name\":\"yin-yang\"},\"showOnCompany\":true,\"showOnLocation\":true,\"showToAllLocations\":true,\"locations\":[\"gfWreTIHL8pDbggBb7af\",\"67WreTIHL8pDbggBb7ty\"],\"allowCamera\":false,\"allowMicrophone\":false}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/custom-menus/<customMenuId>"
  payload := strings.NewReader(`{
  "title": "Custom Menu",
  "url": "https://custom-menus.com/",
  "icon": {
    "name": "yin-yang"
  },
  "showOnCompany": true,
  "showOnLocation": true,
  "showToAllLocations": true,
  "locations": [
    "gfWreTIHL8pDbggBb7af",
    "67WreTIHL8pDbggBb7ty"
  ],
  "allowCamera": false,
  "allowMicrophone": false
}`)
  req, _ := http.NewRequest("PUT", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/custom-menus/<customMenuId>")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "title": "Custom Menu",
  "url": "https://custom-menus.com/",
  "icon": {
    "name": "yin-yang"
  },
  "showOnCompany": true,
  "showOnLocation": true,
  "showToAllLocations": true,
  "locations": [
    "gfWreTIHL8pDbggBb7af",
    "67WreTIHL8pDbggBb7ty"
  ],
  "allowCamera": false,
  "allowMicrophone": false
}'

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$body = '{
  "title": "Custom Menu",
  "url": "https://custom-menus.com/",
  "icon": {
    "name": "yin-yang"
  },
  "showOnCompany": true,
  "showOnLocation": true,
  "showToAllLocations": true,
  "locations": [
    "gfWreTIHL8pDbggBb7af",
    "67WreTIHL8pDbggBb7ty"
  ],
  "allowCamera": false,
  "allowMicrophone": false
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/custom-menus/<customMenuId>' -Method 'PUT' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
