> To build a Wix site agentically, follow https://www.wix.com/headless/skill.md
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Search

# Package: dashboard

# Namespace: BackOfficeSearch

# Method link: https://dev.wix.com/docs/api-reference/business-management/dashboard/back-office-search/search.md

## Permission Scopes:
SCOPE.BACK_OFFICE.SEARCH: SCOPE.BACK_OFFICE.SEARCH

## Introduction

Searches the site's dashboard for a term and returns the matches grouped into sections.

Each section is one category, such as Tools & Settings, Apps or Contacts, and the sections come
in the order to show them, up to 10. A category has no section when the caller can't see it,
when it matched nothing, or when it failed: a missing section doesn't mean the category has no
matches. A category that didn't answer in time comes back as a section with no items, after the
others, when there's room left among the 10.

Each category returns only what the caller may see: a user's own permissions, or an app's.

To keep the terms the user searched for, call [Add Recent Search](https://dev.wix.com/docs/api-reference/business-management/dashboard/back-office-search/add-recent-search.md).

---

## REST API

### Schema

```
 Method: search
 Description: Searches the site's dashboard for a term and returns the matches grouped into sections.  Each section is one category, such as Tools & Settings, Apps or Contacts, and the sections come in the order to show them, up to 10. A category has no section when the caller can't see it, when it matched nothing, or when it failed: a missing section doesn't mean the category has no matches. A category that didn't answer in time comes back as a section with no items, after the others, when there's room left among the 10.  Each category returns only what the caller may see: a user's own permissions, or an app's.  To keep the terms the user searched for, call [Add Recent Search](https://dev.wix.com/docs/api-reference/business-management/dashboard/back-office-search/add-recent-search.md).
 URL: https://www.wixapis.com/back-office-search/v1/search
 Method: POST
 Method parameters:
   param name: searchTerm | type: searchTerm | description: Term to search for, such as `domain`.  | validation: minLength 2, maxLength 200
 Return type: SearchResponse
  - name: sections | type: array<SearchSection> | description: Sections, in the order to show them. A category that matched nothing has no section.  | validation: maxItems 10
     - name: key | type: string | description: Category key, such as `tools`. Stays the same across searches.  | validation: minLength 3, maxLength 40
     - name: displayName | type: string | description: Section heading, in the caller's language.  | validation: minLength 1, maxLength 40
     - name: allResultsPage | type: AllResultsPage | description: Where to see every result of this category, for a "Search in" link. Not returned when the category has no such page.  
        - ONE-OF: 
           - name: page | type: AllResultsBackOfficePage | description: Dashboard page.  
              - name: pageId | type: string | description: Dashboard page GUID: a page component's GUGUID or a Wix page name.  | validation: minLength 1, maxLength 100
              - name: path | type: string | description: Path to open within the page, relative to the page's own route.  | validation: minLength 1, maxLength 100
           - name: url | type: string | description: URL to open in a new tab.  | validation: maxLength 400, format WEB_URL
        - name: label | type: string | description: Name of the place the link searches, in the caller's language, such as `Help Center`. When not returned, use the section's `displayName`.  | validation: maxLength 40
     - name: items | type: array<SearchItem> | description: Matches in this section, in the order to show them, up to 50. Empty only when the category didn't answer in time; such sections come after the others.  | validation: maxItems 50
        - name: id | type: string | description: Result GUID, unique within its section.  | validation: maxLength 100
        - name: title | type: string | description: Result title, such as a product name or a contact's full name.  | validation: minLength 1, maxLength 200
        - name: iconKey | type: string | description: Name of a Wix Design System icon for this result, such as `Settings`. Ignored when `imageUrl` is returned.  | validation: maxLength 20
        - name: imageUrl | type: string | description: Image to show instead of an icon, such as a contact's avatar or an app's logo.  | validation: format WEB_URL
        - name: descriptions | type: array<string> | description: Up to 3 lines to show under the title, in order, such as an order's customer, total and date.  | validation: maxItems 3, maxLength 200
        - name: actions | type: array<SearchAction> | description: What a click runs, in order. Start each action when the one before it is done: a page or link right away, a modal when it closes successfully. A modal closed any other way ends the run. Empty when the result opens nothing.  | validation: maxItems 5
           - ONE-OF: 
              - name: pageOptions | type: PageOptions | description: Set when `type` is `PAGE`.  
                 - name: pageId | type: string | description: Dashboard page GUID: a page component's GUGUID or a Wix page name.  | validation: minLength 1, maxLength 100
                 - name: path | type: string | description: Where to go within the page, relative to the page's own route, such as a product GUID. Empty opens the page itself.  | validation: maxLength 150
              - name: urlOptions | type: UrlOptions | description: Set when `type` is `URL`.  
                 - name: url | type: string | description: URL to open.  | validation: format WEB_URL
              - name: modalOptions | type: ModalOptions | description: Set when `type` is `MODAL`.  
                 - name: modalId | type: string | description: Dashboard modal GUID: a modal component's GUGUID or a Wix modal name, such as `mediaManager`.  | validation: minLength 1, maxLength 100
                 - name: inputs | type: object | description: Values to open the modal with, by the name the modal reads each one by, such as `appDefId`. Pass them to the modal as is. Empty when the modal needs none.  | validation: maxItems 20, format map
              - name: anchorOptions | type: AnchorOptions | description: Set when `type` is `ANCHOR`.  
                 - name: pageId | type: string | description: Dashboard page GUID, as in `pageOptions.pageId`.  | validation: minLength 1, maxLength 100
                 - name: relativeUrl | type: string | description: Where the section is, relative to the page's own route, such as `?focus=favicon`.  | validation: minLength 1, maxLength 100
           - name: type | type: SearchActionType | description: Action type. Matches the options object that is returned.  
                 - enum:
                 -     PAGE: Open a dashboard page.
                 -     URL: Open a URL in a new tab.
                 -     MODAL: Open a dashboard modal.
                 -     ANCHOR: Open a dashboard page at one of its sections.
     - name: pagingMetadata | type: SearchSectionPagingMetadata | description: How many `items` the section holds, and whether the category found more, for example to show `50+`.  
        - name: count | type: integer | description: How many items the section holds.  | validation: format int32
        - name: hasNext | type: boolean | description: Whether the category found more than the section holds. Set whenever the section has items.  
        - name: total | type: integer | description: Total number of matches the category has.  Currently not returned.  | validation: format int32


```

### Examples

### Search a site's dashboard
Searches the site's dashboard for `domain` and returns the matches grouped into sections.

```curl
curl -X POST \
'https://www.wixapis.com/back-office-search/v1/search' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "searchTerm": "domain"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.backOfficeSearch.backOfficeSearch.search(options)
 Description: Searches the site's dashboard for a term and returns the matches grouped into sections.  Each section is one category, such as Tools & Settings, Apps or Contacts, and the sections come in the order to show them, up to 10. A category has no section when the caller can't see it, when it matched nothing, or when it failed: a missing section doesn't mean the category has no matches. A category that didn't answer in time comes back as a section with no items, after the others, when there's room left among the 10.  Each category returns only what the caller may see: a user's own permissions, or an app's.  To keep the terms the user searched for, call [Add Recent Search](https://dev.wix.com/docs/api-reference/business-management/dashboard/back-office-search/add-recent-search.md).
 Method parameters:
   param name: options | type: SearchOptions  none  
        - name: searchTerm | type: string | description: Term to search for, such as `domain`.  | validation: minLength 2, maxLength 200
 Return type: PROMISE<SearchResponse>
  - name: sections | type: array<SearchSection> | description: Sections, in the order to show them. A category that matched nothing has no section.  | validation: maxItems 10
     - name: key | type: string | description: Category key, such as `tools`. Stays the same across searches.  | validation: minLength 3, maxLength 40
     - name: displayName | type: string | description: Section heading, in the caller's language.  | validation: minLength 1, maxLength 40
     - name: allResultsPage | type: AllResultsPage | description: Where to see every result of this category, for a "Search in" link. Not returned when the category has no such page.  
        - ONE-OF: 
           - name: page | type: AllResultsBackOfficePage | description: Dashboard page.  
              - name: pageId | type: string | description: Dashboard page GUID: a page component's GUGUID or a Wix page name.  | validation: minLength 1, maxLength 100
              - name: path | type: string | description: Path to open within the page, relative to the page's own route.  | validation: minLength 1, maxLength 100
           - name: url | type: string | description: URL to open in a new tab.  | validation: maxLength 400, format WEB_URL
        - name: label | type: string | description: Name of the place the link searches, in the caller's language, such as `Help Center`. When not returned, use the section's `displayName`.  | validation: maxLength 40
     - name: items | type: array<SearchItem> | description: Matches in this section, in the order to show them, up to 50. Empty only when the category didn't answer in time; such sections come after the others.  | validation: maxItems 50
        - name: _id | type: string | description: Result GUID, unique within its section.  | validation: maxLength 100
        - name: title | type: string | description: Result title, such as a product name or a contact's full name.  | validation: minLength 1, maxLength 200
        - name: iconKey | type: string | description: Name of a Wix Design System icon for this result, such as `Settings`. Ignored when `imageUrl` is returned.  | validation: maxLength 20
        - name: imageUrl | type: string | description: Image to show instead of an icon, such as a contact's avatar or an app's logo.  | validation: format WEB_URL
        - name: descriptions | type: array<string> | description: Up to 3 lines to show under the title, in order, such as an order's customer, total and date.  | validation: maxItems 3, maxLength 200
        - name: actions | type: array<SearchAction> | description: What a click runs, in order. Start each action when the one before it is done: a page or link right away, a modal when it closes successfully. A modal closed any other way ends the run. Empty when the result opens nothing.  | validation: maxItems 5
           - ONE-OF: 
              - name: pageOptions | type: PageOptions | description: Set when `type` is `PAGE`.  
                 - name: pageId | type: string | description: Dashboard page GUID: a page component's GUGUID or a Wix page name.  | validation: minLength 1, maxLength 100
                 - name: path | type: string | description: Where to go within the page, relative to the page's own route, such as a product GUID. Empty opens the page itself.  | validation: maxLength 150
              - name: urlOptions | type: UrlOptions | description: Set when `type` is `URL`.  
                 - name: url | type: string | description: URL to open.  | validation: format WEB_URL
              - name: modalOptions | type: ModalOptions | description: Set when `type` is `MODAL`.  
                 - name: modalId | type: string | description: Dashboard modal GUID: a modal component's GUGUID or a Wix modal name, such as `mediaManager`.  | validation: minLength 1, maxLength 100
                 - name: inputs | type: object | description: Values to open the modal with, by the name the modal reads each one by, such as `appDefId`. Pass them to the modal as is. Empty when the modal needs none.  | validation: maxItems 20, format map
              - name: anchorOptions | type: AnchorOptions | description: Set when `type` is `ANCHOR`.  
                 - name: pageId | type: string | description: Dashboard page GUID, as in `pageOptions.pageId`.  | validation: minLength 1, maxLength 100
                 - name: relativeUrl | type: string | description: Where the section is, relative to the page's own route, such as `?focus=favicon`.  | validation: minLength 1, maxLength 100
           - name: type | type: SearchActionType | description: Action type. Matches the options object that is returned.  
                 - enum:
                 -     PAGE: Open a dashboard page.
                 -     URL: Open a URL in a new tab.
                 -     MODAL: Open a dashboard modal.
                 -     ANCHOR: Open a dashboard page at one of its sections.
     - name: pagingMetadata | type: SearchSectionPagingMetadata | description: How many `items` the section holds, and whether the category found more, for example to show `50+`.  
        - name: count | type: integer | description: How many items the section holds.  | validation: format int32
        - name: hasNext | type: boolean | description: Whether the category found more than the section holds. Set whenever the section has items.  
        - name: total | type: integer | description: Total number of matches the category has.  Currently not returned.  | validation: format int32


```

### Examples

### Search a site's dashboard
Searches the site's dashboard for `domain` and returns the matches grouped into sections.

```javascript
import { backOfficeSearch } from "@wix/back-office-search";

async function search() {
  const response = await backOfficeSearch.search({ searchTerm: "domain" });
}

/* Promise resolves to:
 * {
 *   "sections": [
 *     {
 *       "key": "tools",
 *       "displayName": "Tools & Settings",
 *       "items": [
 *         {
 *           "id": "domains",
 *           "title": "Domains",
 *           "iconKey": "Globe",
 *           "descriptions": ["Connect or buy a domain for your site"],
 *           "actions": [
 *             {
 *               "type": "PAGE",
 *               "pageOptions": {
 *                 "pageId": "2e96bad1-df32-47b6-942f-e3ecabd74e57",
 *                 "path": ""
 *               }
 *             }
 *           ]
 *         }
 *       ],
 *       "pagingMetadata": {
 *         "count": 1,
 *         "hasNext": false
 *       }
 *     },
 *     {
 *       "key": "help",
 *       "displayName": "Help Articles",
 *       "allResultsPage": {
 *         "label": "Help Center",
 *         "url": "https://support.wix.com/en/search?term=domain"
 *       },
 *       "items": [
 *         {
 *           "id": "c4b1e7a2-58d3-4f60-9a1e-2d7f8b3c9e14",
 *           "title": "Connecting a domain to your Wix site",
 *           "iconKey": "HelpCircle",
 *           "descriptions": ["Domains", "4 min read"],
 *           "actions": [
 *             {
 *               "type": "URL",
 *               "urlOptions": {
 *                 "url": "https://support.wix.com/en/article/connecting-a-domain-to-your-wix-site"
 *               }
 *             }
 *           ]
 *         }
 *       ],
 *       "pagingMetadata": {
 *         "count": 1,
 *         "hasNext": true
 *       }
 *     }
 *   ]
 * }
 */

```

### search (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { backOfficeSearch } from '@wix/back-office-search';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { backOfficeSearch },
  // Include the auth strategy and host as relevant
});


async function search(options) {
  const response = await myWixClient.backOfficeSearch.search(options);
};
```

---