# Get Custom Menu Links

GET https://services.leadconnectorhq.com/custom-menus/

Fetches a collection of custom menus based on specified criteria. This endpoint allows clients to retrieve custom menu configurations, which may include menu items, categories, and associated metadata. The response can be tailored using query parameters for filtering, sorting, and pagination.

## Authentication

Send `Authorization: Bearer <token>` using:

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

## Parameters

### Header Parameters

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

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | No | Unique identifier of the location |
| `skip` | number | No | Number of items to skip for pagination |
| `limit` | number | No | Maximum number of items to return |
| `query` | string | No | Search query to filter custom menus by name, supports partial || full names |
| `showOnCompany` | boolean | No | Filter to show only agency-level menu links. When omitted, fetches both agency and sub-account menu links. Ignored if locationId is provided |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/custom-menus/": {
      "get": {
        "summary": "Get Custom Menu Links",
        "operationId": "getCustomMenuLinks",
        "description": "Fetches a collection of custom menus based on specified criteria. This endpoint allows clients to retrieve custom menu configurations, which may include menu items, categories, and associated metadata. The response can be tailored using query parameters for filtering, sorting, and pagination.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "locationId",
            "required": false,
            "in": "query",
            "description": "Unique identifier of the location",
            "schema": {
              "example": "5DP4iH6HLkQsiKESj6rh",
              "type": "string"
            }
          },
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "description": "Number of items to skip for pagination",
            "schema": {
              "minimum": 0,
              "default": 0,
              "example": 0,
              "type": "number"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of items to return",
            "schema": {
              "minimum": 1,
              "default": 20,
              "example": 10,
              "type": "number"
            }
          },
          {
            "name": "query",
            "required": false,
            "in": "query",
            "description": "Search query to filter custom menus by name, supports partial || full names",
            "schema": {
              "example": "custom-menu-link-name",
              "type": "string"
            }
          },
          {
            "name": "showOnCompany",
            "required": false,
            "in": "query",
            "description": "Filter to show only agency-level menu links. When omitted, fetches both agency and sub-account menu links. Ignored if locationId is provided",
            "schema": {
              "example": true,
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved custom menus. Returns an array of custom menu objects, potentially including their structure, items, and relevant metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetCustomMenusResponseDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request. Invalid query parameters provided."
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. The client does not have necessary permissions to access custom menus."
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Agency-Access": [
              "custom-menu-link.readonly"
            ]
          }
        ]
      }
    }
  },
  "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": {
      "GetCustomMenusResponseDTO": {
        "type": "object",
        "properties": {
          "customMenus": {
            "description": "Array of custom menu links",
            "type": "array",
            "items": {
              "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"
            }
          },
          "totalLinks": {
            "type": "number",
            "description": "Total number of custom menu records",
            "example": 100
          }
        },
        "title": "GetCustomMenusResponseDTO"
      },
      "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 GET 'https://services.leadconnectorhq.com/custom-menus/' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/custom-menus/', 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/"

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

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

**PHP**

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

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/custom-menus/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/custom-menus/")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/custom-menus/"
  req, _ := http.NewRequest("GET", url, nil)
  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/")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

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

**PowerShell**

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

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/custom-menus/' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
