> 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

# CreateDataExtensionSchema

# Package: dataExtensionSchema

# Namespace: DataExtensionSchemaService

# Method link: https://dev.wix.com/docs/api-reference/business-management/data-extension-schema/create-data-extension-schema?apiView=SDK.md

## Permission Scopes:
Manage Data Extensions Schemas: SCOPE.DATAEXTENSIONS.MANAGE-SCHEMAS

## Introduction

Creates a user-defined data extension schema.

---

## REST API

### Schema

```
 Method: createDataExtensionSchema
 Description: Creates a user-defined data extension schema.
 URL: https://www.wixapis.com/schema-service/v1/schemas
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  dataExtensionSchema, dataExtensionSchema.jsonSchema, dataExtensionSchema.fqdn, dataExtensionSchema.namespace
 Method parameters: 
   param name: dataExtensionSchema | type: DataExtensionSchema | description: A Data Extension Schema is the [JSON schema](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/the-json-schema.md) within a [schema plugin extension](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) defining `extendedFields` that are added to a Wix API's service object. | required: true 
        - name: fqdn | type: string | description: FQDN of the entity this schema extends. Use a wildcard (`*`) in place of the version number, for example `wix.ecom.*.order`. See [Supported objects](https://dev.wix.com/docs/api-reference/business-management/data-extension-schema/introduction.md#supported-objects) for valid FQDNs. | required: true | validation: maxLength 255, immutable
        - name: namespace | type: string | description: Namespace for this schema. For example, an app creating schemas might use their app name as a namespace. When a site owner creates a user-defined schema, the namespace is: `_user_fields`. | required: true | validation: maxLength 164, immutable
        - name: jsonSchema | type: object | description: Schema definition in [JSON schema format](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/the-json-schema.md) with the following [vocab](https://docs.json-everything.net/schema/vocabs/) extension: ``` { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://wixapis.com/v1/json-schema/extensions", "$vocabulary": { "https://wixapis.com/v1/json-schema/extensions/vocab/data-extensions": true }, "$dynamicAnchor": "meta", "title": "Wix' data-extensions vocabulary meta schema", "type": [ "object", "boolean" ], "properties": { "x-wix-permissions": { "type": "object", "description": "list of identity types that are allowed reading schema properties", "properties": { "read": { "type": "array", "items": { "type": "string", "enum": [ "apps", "owning-app", "users", "users-of-users" ] } }, "write": { "type": "array", "items": { "type": "string", "enum": [ "apps", "owning-app", "users", "users-of-users" ] } } } }, "x-wix-display": { "type": "object", "description": "field display properties", "schema": { "properties": { "placeholder": { "type": "string", "maxLength": 255, "description": "placeholder text for input fields" }, "label": { "type": "string", "maxLength": 255, "description": "label of the input fields" }, "hint": { "type": "string", "maxLength": 255, "description": "a short explanation that appears next to the input field" } } } } } } ``` | required: true 
 Return type: CreateDataExtensionSchemaResponse
  - name: dataExtensionSchema | type: DataExtensionSchema | description: Created schema.  
     - name: id | type: string | description: Schema GUID.  | read-only: true | validation: format GUID, immutable
     - name: fqdn | type: string | description: FQDN of the entity this schema extends. Use a wildcard (`*`) in place of the version number, for example `wix.ecom.*.order`. See [Supported objects](https://dev.wix.com/docs/api-reference/business-management/data-extension-schema/introduction.md#supported-objects) for valid FQDNs.  | validation: maxLength 255, immutable
     - name: namespace | type: string | description: Namespace for this schema. For example, an app creating schemas might use their app name as a namespace. When a site owner creates a user-defined schema, the namespace is: `_user_fields`.  | validation: maxLength 164, immutable
     - name: jsonSchema | type: object | description: Schema definition in [JSON schema format](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/the-json-schema.md) with the following [vocab](https://docs.json-everything.net/schema/vocabs/) extension: ``` { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://wixapis.com/v1/json-schema/extensions", "$vocabulary": { "https://wixapis.com/v1/json-schema/extensions/vocab/data-extensions": true }, "$dynamicAnchor": "meta", "title": "Wix' data-extensions vocabulary meta schema", "type": [ "object", "boolean" ], "properties": { "x-wix-permissions": { "type": "object", "description": "list of identity types that are allowed reading schema properties", "properties": { "read": { "type": "array", "items": { "type": "string", "enum": [ "apps", "owning-app", "users", "users-of-users" ] } }, "write": { "type": "array", "items": { "type": "string", "enum": [ "apps", "owning-app", "users", "users-of-users" ] } } } }, "x-wix-display": { "type": "object", "description": "field display properties", "schema": { "properties": { "placeholder": { "type": "string", "maxLength": 255, "description": "placeholder text for input fields" }, "label": { "type": "string", "maxLength": 255, "description": "label of the input fields" }, "hint": { "type": "string", "maxLength": 255, "description": "a short explanation that appears next to the input field" } } } } } } ```  
     - name: updatedDate | type: string | description: Date and time the schema was last updated.  | read-only: true | validation: format date-time
     - name: createdDate | type: string | description: Date and time the schema was created.  | read-only: true | validation: format date-time
     - name: revision | type: string | description: Revision number, which increments by 1 each time the schema is updated. To prevent conflicting changes, the existing revision must be used when updating a schema.  | read-only: true | validation: format int64
     - name: maxLimitBytes | type: integer | description: Maximum allowed schema size in bytes.  | read-only: true | validation: format int32
     - name: currentSizeBytes | type: integer | description: Current schema size in bytes.  | read-only: true | validation: format int32


```

### Examples

### CreateDataExtensionSchema
```curl
~~~cURL
curl -X POST \
  'https://www.wixapis.com/schema-service/v1/schemas' \
  -H 'Content-type: application/json' \
  -H 'Authorization: <AUTH>' \
  -d '{
    "dataExtensionSchema": {
        "id": "01ea0c8d-80b8-46e3-bfda-611b3678545b",
        "fqdn": "wix.ecom.*.order",
        "namespace": "_user_fields",
        "jsonSchema": {
            "additionalProperties": false,
            "properties": {
                "personalization": {
                    "type": "object",
                    "x-wix-permissions": {
                        "read": [
                            "users-of-users",
                            "users",
                            "apps"
                        ],
                        "write": [
                            "users"
                        ]
                    },
                    "additionalProperties": false,
                    "properties": {
                        "giftMessage": {
                            "maxLength": 50,
                            "type": "string",
                            "x-wix-permissions": {
                                "read": [
                                    "users-of-users",
                                    "users",
                                    "apps"
                                ],
                                "write": [
                                    "users"
                                ]
                            }
                        }
                    }
                }
            }
        }
    }
}'
~~~
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.dataExtensionSchema.schemas.createDataExtensionSchema(dataExtensionSchema)
 Description: Creates a user-defined data extension schema.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  dataExtensionSchema, dataExtensionSchema.jsonSchema, dataExtensionSchema.fqdn, dataExtensionSchema.namespace
 Method parameters: 
   param name: dataExtensionSchema | type: DataExtensionSchema | description: A Data Extension Schema is the [JSON schema](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/the-json-schema.md) within a [schema plugin extension](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions.md) defining `extendedFields` that are added to a Wix API's service object. | required: true 
        - name: fqdn | type: string | description: FQDN of the entity this schema extends. Use a wildcard (`*`) in place of the version number, for example `wix.ecom.*.order`. See [Supported objects](https://dev.wix.com/docs/api-reference/business-management/data-extension-schema/introduction.md#supported-objects) for valid FQDNs. | required: true | validation: maxLength 255, immutable
        - name: namespace | type: string | description: Namespace for this schema. For example, an app creating schemas might use their app name as a namespace. When a site owner creates a user-defined schema, the namespace is: `_user_fields`. | required: true | validation: maxLength 164, immutable
        - name: jsonSchema | type: object | description: Schema definition in [JSON schema format](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/the-json-schema.md) with the following [vocab](https://docs.json-everything.net/schema/vocabs/) extension: ``` { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://wixapis.com/v1/json-schema/extensions", "$vocabulary": { "https://wixapis.com/v1/json-schema/extensions/vocab/data-extensions": true }, "$dynamicAnchor": "meta", "title": "Wix' data-extensions vocabulary meta schema", "type": [ "object", "boolean" ], "properties": { "x-wix-permissions": { "type": "object", "description": "list of identity types that are allowed reading schema properties", "properties": { "read": { "type": "array", "items": { "type": "string", "enum": [ "apps", "owning-app", "users", "users-of-users" ] } }, "write": { "type": "array", "items": { "type": "string", "enum": [ "apps", "owning-app", "users", "users-of-users" ] } } } }, "x-wix-display": { "type": "object", "description": "field display properties", "schema": { "properties": { "placeholder": { "type": "string", "maxLength": 255, "description": "placeholder text for input fields" }, "label": { "type": "string", "maxLength": 255, "description": "label of the input fields" }, "hint": { "type": "string", "maxLength": 255, "description": "a short explanation that appears next to the input field" } } } } } } ``` | required: true 
 Return type: PROMISE<DataExtensionSchema>
  - name: _id | type: string | description: Schema GUID.  | read-only: true | validation: format GUID, immutable
  - name: fqdn | type: string | description: FQDN of the entity this schema extends. Use a wildcard (`*`) in place of the version number, for example `wix.ecom.*.order`. See [Supported objects](https://dev.wix.com/docs/api-reference/business-management/data-extension-schema/introduction.md#supported-objects) for valid FQDNs.  | validation: maxLength 255, immutable
  - name: namespace | type: string | description: Namespace for this schema. For example, an app creating schemas might use their app name as a namespace. When a site owner creates a user-defined schema, the namespace is: `_user_fields`.  | validation: maxLength 164, immutable
  - name: jsonSchema | type: object | description: Schema definition in [JSON schema format](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/the-json-schema.md) with the following [vocab](https://docs.json-everything.net/schema/vocabs/) extension: ``` { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://wixapis.com/v1/json-schema/extensions", "$vocabulary": { "https://wixapis.com/v1/json-schema/extensions/vocab/data-extensions": true }, "$dynamicAnchor": "meta", "title": "Wix' data-extensions vocabulary meta schema", "type": [ "object", "boolean" ], "properties": { "x-wix-permissions": { "type": "object", "description": "list of identity types that are allowed reading schema properties", "properties": { "read": { "type": "array", "items": { "type": "string", "enum": [ "apps", "owning-app", "users", "users-of-users" ] } }, "write": { "type": "array", "items": { "type": "string", "enum": [ "apps", "owning-app", "users", "users-of-users" ] } } } }, "x-wix-display": { "type": "object", "description": "field display properties", "schema": { "properties": { "placeholder": { "type": "string", "maxLength": 255, "description": "placeholder text for input fields" }, "label": { "type": "string", "maxLength": 255, "description": "label of the input fields" }, "hint": { "type": "string", "maxLength": 255, "description": "a short explanation that appears next to the input field" } } } } } } ```  
  - name: _updatedDate | type: Date | description: Date and time the schema was last updated.  | read-only: true 
  - name: _createdDate | type: Date | description: Date and time the schema was created.  | read-only: true 
  - name: revision | type: string | description: Revision number, which increments by 1 each time the schema is updated. To prevent conflicting changes, the existing revision must be used when updating a schema.  | read-only: true | validation: format int64
  - name: maxLimitBytes | type: integer | description: Maximum allowed schema size in bytes.  | read-only: true | validation: format int32
  - name: currentSizeBytes | type: integer | description: Current schema size in bytes.  | read-only: true | validation: format int32


```

### Examples

### createDataExtensionSchema
```javascript
import { schemas } from '@wix/data-extension-schema';

async function createDataExtensionSchema(dataExtensionSchema) {
  const response = await schemas.createDataExtensionSchema(dataExtensionSchema);
};
```

### createDataExtensionSchema (with elevated permissions)
```javascript
import { schemas } from '@wix/data-extension-schema';
import { auth } from '@wix/essentials';

async function myCreateDataExtensionSchemaMethod(dataExtensionSchema) {
  const elevatedCreateDataExtensionSchema = auth.elevate(schemas.createDataExtensionSchema);
  const response = await elevatedCreateDataExtensionSchema(dataExtensionSchema);
}
```

### createDataExtensionSchema (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 { schemas } from '@wix/data-extension-schema';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function createDataExtensionSchema(dataExtensionSchema) {
  const response = await myWixClient.schemas.createDataExtensionSchema(dataExtensionSchema);
};
```

---