> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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

# CreateSeoUserConfig

# Package: seo

# Namespace: SeoUserConfigService

# Method link: https://dev.wix.com/docs/api-reference/business-management/marketing/seo/seo-user-config/create-seo-user-config.md

## Introduction

Creates the SEO configuration for the current site.

If a configuration already exists for the site, this method returns an `ALREADY_EXISTS` error.
Use [Update Seo User Config](https://dev.wix.com/docs/api-reference/business-management/marketing/seo/seo-user-config/update-seo-user-config.md)
to modify an existing configuration.

---

## REST API

### Schema

```
 Method: createSeoUserConfig
 Description: Creates the SEO configuration for the current site.  If a configuration already exists for the site, this method returns an `ALREADY_EXISTS` error. Use [Update Seo User Config](https://dev.wix.com/docs/api-reference/business-management/marketing/seo/seo-user-config/update-seo-user-config.md) to modify an existing configuration.
 URL: https://www.wixapis.com/seo/user-config/v1/seo-user-configs
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  seoUserConfig, seoUserConfig.shouldFlattenUrlHierarchy, seoUserConfig.shouldUsePartialRouteMatch
 Method parameters: 
   param name: seoUserConfig | type: SeoUserConfig | description: Site-level SEO configuration.  Controls URL structure and non-existent page behavior to optimize how search engines index and resolve a site's pages. | required: true 
        - name: shouldFlattenUrlHierarchy | type: boolean | description: Whether to flatten page URLs.  When `true`, all pages use flat URLs regardless of their position in the page hierarchy. For example, a subpage at `/parent/child-page` is accessible at `/child-page`. When `false`, page URLs reflect the full parent-child hierarchy.  This setting only affects URL structure, it doesn't change the physical page hierarchy in the site's page tree.  Default: `false` | required: true 
        - name: shouldUsePartialRouteMatch | type: boolean | description: Whether non-existent pages return a `200` status code instead of a `404`.  When `false`, requests to non-existent pages return an HTTP `404` status code. This setting is the SEO-recommended behavior that correctly signals missing pages to search engines.  When `true`, non-existent page requests return a `200` status code. Avoid this setting unless you have a specific SEO reason, as it prevents search engines from correctly detecting missing pages.  Default: `false` for sites created on or after September 1, 2024. `true` for sites created before that date. | required: true 
 Return type: CreateSeoUserConfigResponse
  - name: seoUserConfig | type: SeoUserConfig | description: Created SEO configuration.  
     - name: id | type: string | description: SEO configuration GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the SEO configuration is updated. To prevent conflicting changes, the current `revision` must be passed when updating the SEO configuration.  Ignored when creating an SEO configuration.  | read-only: true | validation: format int64
     - name: createdDate | type: string | description: Date and time the SEO configuration was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the SEO configuration was last updated.  | read-only: true | validation: format date-time
     - name: shouldFlattenUrlHierarchy | type: boolean | description: Whether to flatten page URLs.  When `true`, all pages use flat URLs regardless of their position in the page hierarchy. For example, a subpage at `/parent/child-page` is accessible at `/child-page`. When `false`, page URLs reflect the full parent-child hierarchy.  This setting only affects URL structure, it doesn't change the physical page hierarchy in the site's page tree.  Default: `false`  
     - name: shouldUsePartialRouteMatch | type: boolean | description: Whether non-existent pages return a `200` status code instead of a `404`.  When `false`, requests to non-existent pages return an HTTP `404` status code. This setting is the SEO-recommended behavior that correctly signals missing pages to search engines.  When `true`, non-existent page requests return a `200` status code. Avoid this setting unless you have a specific SEO reason, as it prevents search engines from correctly detecting missing pages.  Default: `false` for sites created on or after September 1, 2024. `true` for sites created before that date.  


```

### Examples

### Create SeoUserConfig
Creates a SeoUserConfig with basic info

```curl
curl -X POST \
  'https://www.wixapis.com/seo/user-config/v1/seo-user-configs' \
  -H 'Authorization: <AUTH>' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "seoUserConfig": {
      "shouldFlattenUrlHierarchy": true,
      "shouldUsePartialRouteMatch": false
    }
  }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.seoUserConfig.seoUserConfig.createSeoUserConfig(seoUserConfig)
 Description: Creates the SEO configuration for the current site.  If a configuration already exists for the site, this method returns an `ALREADY_EXISTS` error. Use [Update Seo User Config](https://dev.wix.com/docs/api-reference/business-management/marketing/seo/seo-user-config/update-seo-user-config.md) to modify an existing configuration.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  seoUserConfig, seoUserConfig.shouldFlattenUrlHierarchy, seoUserConfig.shouldUsePartialRouteMatch
 Method parameters: 
   param name: seoUserConfig | type: SeoUserConfig | description: Site-level SEO configuration.  Controls URL structure and non-existent page behavior to optimize how search engines index and resolve a site's pages. | required: true 
        - name: shouldFlattenUrlHierarchy | type: boolean | description: Whether to flatten page URLs.  When `true`, all pages use flat URLs regardless of their position in the page hierarchy. For example, a subpage at `/parent/child-page` is accessible at `/child-page`. When `false`, page URLs reflect the full parent-child hierarchy.  This setting only affects URL structure, it doesn't change the physical page hierarchy in the site's page tree.  Default: `false` | required: true 
        - name: shouldUsePartialRouteMatch | type: boolean | description: Whether non-existent pages return a `200` status code instead of a `404`.  When `false`, requests to non-existent pages return an HTTP `404` status code. This setting is the SEO-recommended behavior that correctly signals missing pages to search engines.  When `true`, non-existent page requests return a `200` status code. Avoid this setting unless you have a specific SEO reason, as it prevents search engines from correctly detecting missing pages.  Default: `false` for sites created on or after September 1, 2024. `true` for sites created before that date. | required: true 
 Return type: PROMISE<SeoUserConfig>
  - name: _id | type: string | description: SEO configuration GUID.  | read-only: true | validation: format GUID
  - name: revision | type: string | description: Revision number, which increments by 1 each time the SEO configuration is updated. To prevent conflicting changes, the current `revision` must be passed when updating the SEO configuration.  Ignored when creating an SEO configuration.  | read-only: true | validation: format int64
  - name: _createdDate | type: Date | description: Date and time the SEO configuration was created.  | read-only: true 
  - name: _updatedDate | type: Date | description: Date and time the SEO configuration was last updated.  | read-only: true 
  - name: shouldFlattenUrlHierarchy | type: boolean | description: Whether to flatten page URLs.  When `true`, all pages use flat URLs regardless of their position in the page hierarchy. For example, a subpage at `/parent/child-page` is accessible at `/child-page`. When `false`, page URLs reflect the full parent-child hierarchy.  This setting only affects URL structure, it doesn't change the physical page hierarchy in the site's page tree.  Default: `false`  
  - name: shouldUsePartialRouteMatch | type: boolean | description: Whether non-existent pages return a `200` status code instead of a `404`.  When `false`, requests to non-existent pages return an HTTP `404` status code. This setting is the SEO-recommended behavior that correctly signals missing pages to search engines.  When `true`, non-existent page requests return a `200` status code. Avoid this setting unless you have a specific SEO reason, as it prevents search engines from correctly detecting missing pages.  Default: `false` for sites created on or after September 1, 2024. `true` for sites created before that date.  


```

### Examples

### createSeoUserConfig
```javascript
import { seoUserConfig } from '@wix/seo-user-config';

async function createSeoUserConfig(seoUserConfig) {
  const response = await seoUserConfig.createSeoUserConfig(seoUserConfig);
};
```

### createSeoUserConfig (with elevated permissions)
```javascript
import { seoUserConfig } from '@wix/seo-user-config';
import { auth } from '@wix/essentials';

async function myCreateSeoUserConfigMethod(seoUserConfig) {
  const elevatedCreateSeoUserConfig = auth.elevate(seoUserConfig.createSeoUserConfig);
  const response = await elevatedCreateSeoUserConfig(seoUserConfig);
}
```

### createSeoUserConfig (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 { seoUserConfig } from '@wix/seo-user-config';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function createSeoUserConfig(seoUserConfig) {
  const response = await myWixClient.seoUserConfig.createSeoUserConfig(seoUserConfig);
};
```

---