> 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`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# ListSeoPatternVariables

# Package: seo

# Namespace: PageTypeSeoPatternsService

# Method link: https://dev.wix.com/docs/api-reference/business-management/seo/seo-pattern-v1/list-seo-pattern-variables.md

## Permission Scopes:
View SEO Settings: SCOPE.PROMOTE.VIEW-SEO

## Introduction

Retrieves the variables a pattern for a page type may reference.

Call this method to retrieve the valid variables for a page type before writing a
pattern.

Variables for the page's own tags and variables for its structured data are returned
in separate fields, and a pattern may use either.

---

## REST API

### Schema

```
 Method: listSeoPatternVariables
 Description: Retrieves the variables a pattern for a page type may reference.  Call this method to retrieve the valid variables for a page type before writing a pattern.  Variables for the page's own tags and variables for its structured data are returned in separate fields, and a pattern may use either.
 URL: https://www.wixapis.com/promote/seo/v1/seo-patterns/{pageType}/variables
 Method: GET
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  pageType
 Method parameters: 
   param name: pageType | type:   none | required: true 
 Return type: ListSeoPatternVariablesResponse
  - name: variables | type: array<SeoPatternVariable> | description: Variables a pattern for this page type may use in its tags. For example, `{{product.name}}` in a title template.  A variable can appear more than once, with different `userVisible` values, when both the site and the page type offer it. Either entry can be used in a pattern.  | validation: maxItems 500
     - name: key | type: string | description: Name of the variable, without the surrounding braces. For example, `product.name`, which a pattern references as `{{product.name}}`.  | validation: maxLength 200
     - name: userVisible | type: boolean | description: Whether the variable appears in the list shown to Wix users editing the pattern in the dashboard.  `false` doesn't prevent a pattern from using the variable. It marks a variable that's kept out of the dashboard's list, typically because it's only meaningful in certain cases.  
  - name: structuredDataVariables | type: array<SeoPatternVariable> | description: Variables a pattern for this page type may use in its structured data tags.  A pattern may use these as well as the variables in `variables`.  | validation: maxItems 500

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_PAGE_TYPE | Description: Wix doesn't recognize the specified `pageType`. The error message lists the page types that are supported.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: PAGE_TYPE_NOT_ON_SITE | Description: The page type is valid, but the Wix business solution that provides it isn't installed on the site.


```

### Examples

### Retrieve the variables a page type offers
`page.isHomePage` and `site.business.location.city` have `userVisible` set to false, which keeps them out of the dashboard's list but doesn't stop a pattern from using them.

```curl
curl -X GET \
'https://www.wixapis.com/seo-metatags-server/v1/seo-patterns/STATIC_PAGE/variables' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.seo.seoPatterns.listSeoPatternVariables(pageType)
 Description: Retrieves the variables a pattern for a page type may reference.  Call this method to retrieve the valid variables for a page type before writing a pattern.  Variables for the page's own tags and variables for its structured data are returned in separate fields, and a pattern may use either.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  pageType
 Method parameters: 
   param name: pageType | type: string | description: Page type whose variables to retrieve. For example, `STATIC_PAGE`, `BLOG_POST`, or `STORES_PRODUCT`. | required: true | validation: maxLength 100
 Return type: PROMISE<ListSeoPatternVariablesResponse>
  - name: variables | type: array<SeoPatternVariable> | description: Variables a pattern for this page type may use in its tags. For example, `{{product.name}}` in a title template.  A variable can appear more than once, with different `userVisible` values, when both the site and the page type offer it. Either entry can be used in a pattern.  | validation: maxItems 500
     - name: key | type: string | description: Name of the variable, without the surrounding braces. For example, `product.name`, which a pattern references as `{{product.name}}`.  | validation: maxLength 200
     - name: userVisible | type: boolean | description: Whether the variable appears in the list shown to Wix users editing the pattern in the dashboard.  `false` doesn't prevent a pattern from using the variable. It marks a variable that's kept out of the dashboard's list, typically because it's only meaningful in certain cases.  
  - name: structuredDataVariables | type: array<SeoPatternVariable> | description: Variables a pattern for this page type may use in its structured data tags.  A pattern may use these as well as the variables in `variables`.  | validation: maxItems 500

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_PAGE_TYPE | Description: Wix doesn't recognize the specified `pageType`. The error message lists the page types that are supported.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: PAGE_TYPE_NOT_ON_SITE | Description: The page type is valid, but the Wix business solution that provides it isn't installed on the site.


```

### Examples

### Retrieve the variables a page type offers
A pattern for this page type may use any of these, from either list. A variable can appear in both lists with different `userVisible` values.

```javascript
import { seoPatterns } from "@wix/seo";

async function listSeoPatternVariables() {
  const response = await seoPatterns.listSeoPatternVariables("STATIC_PAGE");
  return response;
}

/* Promise resolves to:
 * {
 *   "variables": [
 *     { "key": "site.name", "userVisible": true },
 *     { "key": "page.name", "userVisible": true }
 *   ],
 *   "structuredDataVariables": [
 *     { "key": "site.url", "userVisible": true },
 *     { "key": "site.business.location.city", "userVisible": false }
 *   ]
 * }
 */

```

### listSeoPatternVariables (self-hosted)
Self-hosted 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 { seoPatterns } from '@wix/seo';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function listSeoPatternVariables(pageType) {
  const response = await myWixClient.seoPatterns.listSeoPatternVariables(pageType);
};
```

---