> 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

# CreateCustomFieldApplication

# Package: customFields

# Namespace: CustomFieldApplications

# Method link: https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/custom-fields/custom-field-applications/create-custom-field-application.md

## Permission Scopes:
Manage Members: SCOPE.DC-MEMBERS.MANAGE-MEMBERS

## Introduction

Creates a custom field application.

---

## REST API

### Schema

```
 Method: createCustomFieldApplication
 Description: Creates a custom field application.
 URL: https://www.wixapis.com/members/v1/custom-fields-applications
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  application, application.customFieldId, application.applications.items.entityId, application.exclusions.items.entityId
 Method parameters: 
   param name: application | type: CustomFieldApplication | description: A custom field application defines which members or entities a custom field applies to. By default, custom fields apply to all members. However, custom field applications allow you to target specific members, roles, badges, or pricing plans, or exclude certain entities. | required: true 
        - name: customFieldId | type: string | description: Custom field GUID. | required: true | validation: format GUID
        - name: applications | type: ApplicationsWrapper | description: Entities to which the custom field applies.  
           - name: items | type: array<AppliesTo> | description: List of up to 100 entities to which the the custom field applies.  | validation: maxItems 100
              - name: applicationType | type: Type | description: Type of the application.  
                     - enum:
                     -     UNKNOWN: Unknown application type. This value isn't used.
                     -     ROLE: The field is applied to members with a specific role.
                     -     BADGE: The field is applied to members with a specific badge.
                     -     PRICING_PLAN: The field is applied to members with a specific pricing plan.
                     -     MEMBER: The field is applied to the specified members.
              - name: entityId | type: string | description: Entity GUID.  | validation: format GUID
        - name: exclusions | type: ExclusionsWrapper | description: Entities from which the custom field is excluded.  
           - name: items | type: array<Exclusion> | description: List of up to 100 entities from which the custom field is excluded.  | validation: maxItems 100
              - name: exclusionType | type: Type | description: Type of the exclusion.  
                     - enum:
                     -     UNKNOWN: Unknown exclusion type. This value isn't used.
                     -     ROLE: The field is excluded from members with a specific role.
                     -     BADGE: The field is excluded from members with a specific badge.
                     -     PRICING_PLAN: The field is excluded from members with a specific pricing plan.
                     -     MEMBER: The field is excluded from the specified members.
              - name: entityId | type: string | description: Entity GUID.  | validation: format GUID
        - name: revision | type: string | description: Revision number, which increments by 1 each time the custom field is updated. To prevent conflicting changes, the existing revision must be used when updating a custom field.  | validation: format uint64
 Return type: CreateCustomFieldApplicationResponse
  - name: application | type: CustomFieldApplication | description: The created custom field application.  
     - name: customFieldId | type: string | description: Custom field GUID.  | validation: format GUID
     - name: customFieldKey | type: string | description: Custom field key.  | read-only: true 
     - name: applications | type: ApplicationsWrapper | description: Entities to which the custom field applies.  
        - name: items | type: array<AppliesTo> | description: List of up to 100 entities to which the the custom field applies.  | validation: maxItems 100
           - name: applicationType | type: Type | description: Type of the application.  
                 - enum:
                 -     UNKNOWN: Unknown application type. This value isn't used.
                 -     ROLE: The field is applied to members with a specific role.
                 -     BADGE: The field is applied to members with a specific badge.
                 -     PRICING_PLAN: The field is applied to members with a specific pricing plan.
                 -     MEMBER: The field is applied to the specified members.
           - name: entityId | type: string | description: Entity GUID.  | validation: format GUID
     - name: exclusions | type: ExclusionsWrapper | description: Entities from which the custom field is excluded.  
        - name: items | type: array<Exclusion> | description: List of up to 100 entities from which the custom field is excluded.  | validation: maxItems 100
           - name: exclusionType | type: Type | description: Type of the exclusion.  
                 - enum:
                 -     UNKNOWN: Unknown exclusion type. This value isn't used.
                 -     ROLE: The field is excluded from members with a specific role.
                 -     BADGE: The field is excluded from members with a specific badge.
                 -     PRICING_PLAN: The field is excluded from members with a specific pricing plan.
                 -     MEMBER: The field is excluded from the specified members.
           - name: entityId | type: string | description: Entity GUID.  | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments by 1 each time the custom field is updated. To prevent conflicting changes, the existing revision must be used when updating a custom field.  | validation: format uint64


```

### Examples

### Create a custom field application
```curl
curl -X POST \
  https://www.wixapis.com/members/v1/members/custom-fields-applications \
  -H 'Content-Type: application/json;charset=UTF-8' \
  -H 'Authorization: <AUTH>'
  -d '{
        "application": {
            "customFieldId": "4e4b1840-3833-4dbd-93d1-b2c9a33caa7d",
            "applications": {
              "items": [
                {
                  "applicationType": "MEMBER",
                  "entityId": "ca1f9c6a-78f3-4b37-b977-951793410042"
                }
              ]
            },
            "revision": 1
        }
    }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.members.customFieldApplications.createCustomFieldApplication(application)
 Description: Creates a custom field application.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  application, application.customFieldId, application.applications.items.entityId, application.exclusions.items.entityId
 Method parameters: 
   param name: application | type: CustomFieldApplication | description: A custom field application defines which members or entities a custom field applies to. By default, custom fields apply to all members. However, custom field applications allow you to target specific members, roles, badges, or pricing plans, or exclude certain entities. | required: true 
        - name: customFieldId | type: string | description: Custom field GUID. | required: true | validation: format GUID
        - name: applications | type: ApplicationsWrapper | description: Entities to which the custom field applies.  
           - name: items | type: array<AppliesTo> | description: List of up to 100 entities to which the the custom field applies.  | validation: maxItems 100
              - name: applicationType | type: Type | description: Type of the application.  
                     - enum:
                     -     UNKNOWN: Unknown application type. This value isn't used.
                     -     ROLE: The field is applied to members with a specific role.
                     -     BADGE: The field is applied to members with a specific badge.
                     -     PRICING_PLAN: The field is applied to members with a specific pricing plan.
                     -     MEMBER: The field is applied to the specified members.
              - name: entityId | type: string | description: Entity GUID.  | validation: format GUID
        - name: exclusions | type: ExclusionsWrapper | description: Entities from which the custom field is excluded.  
           - name: items | type: array<Exclusion> | description: List of up to 100 entities from which the custom field is excluded.  | validation: maxItems 100
              - name: exclusionType | type: Type | description: Type of the exclusion.  
                     - enum:
                     -     UNKNOWN: Unknown exclusion type. This value isn't used.
                     -     ROLE: The field is excluded from members with a specific role.
                     -     BADGE: The field is excluded from members with a specific badge.
                     -     PRICING_PLAN: The field is excluded from members with a specific pricing plan.
                     -     MEMBER: The field is excluded from the specified members.
              - name: entityId | type: string | description: Entity GUID.  | validation: format GUID
        - name: revision | type: string | description: Revision number, which increments by 1 each time the custom field is updated. To prevent conflicting changes, the existing revision must be used when updating a custom field.  | validation: format uint64
 Return type: PROMISE<CustomFieldApplication>
  - name: customFieldId | type: string | description: Custom field GUID.  | validation: format GUID
  - name: customFieldKey | type: string | description: Custom field key.  | read-only: true 
  - name: applications | type: ApplicationsWrapper | description: Entities to which the custom field applies.  
     - name: items | type: array<AppliesTo> | description: List of up to 100 entities to which the the custom field applies.  | validation: maxItems 100
        - name: applicationType | type: Type | description: Type of the application.  
             - enum:
             -     UNKNOWN: Unknown application type. This value isn't used.
             -     ROLE: The field is applied to members with a specific role.
             -     BADGE: The field is applied to members with a specific badge.
             -     PRICING_PLAN: The field is applied to members with a specific pricing plan.
             -     MEMBER: The field is applied to the specified members.
        - name: entityId | type: string | description: Entity GUID.  | validation: format GUID
  - name: exclusions | type: ExclusionsWrapper | description: Entities from which the custom field is excluded.  
     - name: items | type: array<Exclusion> | description: List of up to 100 entities from which the custom field is excluded.  | validation: maxItems 100
        - name: exclusionType | type: Type | description: Type of the exclusion.  
             - enum:
             -     UNKNOWN: Unknown exclusion type. This value isn't used.
             -     ROLE: The field is excluded from members with a specific role.
             -     BADGE: The field is excluded from members with a specific badge.
             -     PRICING_PLAN: The field is excluded from members with a specific pricing plan.
             -     MEMBER: The field is excluded from the specified members.
        - name: entityId | type: string | description: Entity GUID.  | validation: format GUID
  - name: revision | type: string | description: Revision number, which increments by 1 each time the custom field is updated. To prevent conflicting changes, the existing revision must be used when updating a custom field.  | validation: format uint64


```

### Examples

### createCustomFieldApplication
```javascript
import { customFieldApplications } from '@wix/members';

async function createCustomFieldApplication(application) {
  const response = await customFieldApplications.createCustomFieldApplication(application);
};
```

### createCustomFieldApplication (with elevated permissions)
```javascript
import { customFieldApplications } from '@wix/members';
import { auth } from '@wix/essentials';

async function myCreateCustomFieldApplicationMethod(application) {
  const elevatedCreateCustomFieldApplication = auth.elevate(customFieldApplications.createCustomFieldApplication);
  const response = await elevatedCreateCustomFieldApplication(application);
}
```

### createCustomFieldApplication (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 { customFieldApplications } from '@wix/members';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function createCustomFieldApplication(application) {
  const response = await myWixClient.customFieldApplications.createCustomFieldApplication(application);
};
```

---