> For the complete documentation index, see [llms.txt](https://help.openloyalty.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.openloyalty.io/api-reference/custom-field-group.md).

# Custom Field Group

These endpoints allow you to manage custom field groups and their definitions.

## List supported entity types

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> Returns the list of entity types enabled for this store via feature flags.\
> The list is store-scoped and flag-gated — do not cache it across tenants or\
> across flag changes. It reflects the values currently accepted in the\
> \`entityType\` path parameter of other Custom Field Group endpoints for this store.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Custom Field Group","description":"These endpoints allow you to manage custom field groups and their definitions."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}}},"schemas":{"CustomFieldEntityTypesResponse":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CustomFieldEntityTypeItem"}}}},"CustomFieldEntityTypeItem":{"type":"object","required":["entityType","currentTotal","maxTotal"],"properties":{"entityType":{"$ref":"#/components/schemas/CustomFieldEntityType"},"currentTotal":{"type":"integer","description":"Current number of active custom field definitions for this entity type in the store"},"maxTotal":{"type":"integer","description":"Maximum allowed total custom field definitions per entity type per store"}}},"CustomFieldEntityType":{"type":"string","description":"Entity type the custom field is associated with.","enum":["member","direct-campaign","automation-campaign","referral-campaign","leaderboard","challenge","reward","fortune-wheel-reward"]},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/custom-field-groups/entity-types":{"get":{"operationId":"_customFieldGroupEntityTypes","tags":["Custom Field Group"],"summary":"List supported entity types","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nReturns the list of entity types enabled for this store via feature flags.\nThe list is store-scoped and flag-gated — do not cache it across tenants or\nacross flag changes. It reflects the values currently accepted in the\n`entityType` path parameter of other Custom Field Group endpoints for this store.\n","parameters":[{"$ref":"#/components/parameters/storeCode"}],"responses":{"200":{"description":"Supported entity types","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldEntityTypesResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## List custom field groups

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> Returns all custom field groups for the given entity type.\
> Results are ordered by sortOrder ascending.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Custom Field Group","description":"These endpoints allow you to manage custom field groups and their definitions."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}},"page":{"name":"_page","in":"query","description":"Number of page with results, starts from 1","required":false,"schema":{"type":"integer","default":1,"minimum":1}},"itemsOnPage":{"name":"_itemsOnPage","in":"query","description":"Items on one page","required":false,"schema":{"type":"integer","default":10,"maximum":50,"minimum":1}},"orderBy":{"name":"_orderBy","in":"query","description":"Sorting order. If sorting is not chosen, the rows will be returned in an unspecified order. Sort order: * `asc` - Ascending, from A to Z * `desc` - Descending, from Z to A","required":false,"style":"deepObject","explode":true,"schema":{"type":"object","additionalProperties":{"type":"string","enum":["asc","desc"]}}}},"schemas":{"CustomFieldEntityType":{"type":"string","description":"Entity type the custom field is associated with.","enum":["member","direct-campaign","automation-campaign","referral-campaign","leaderboard","challenge","reward","fortune-wheel-reward"]},"CustomFieldGroupResponse":{"type":"object","required":["customFieldGroupId","groupKey","name","entityType","definitions","createdAt","updatedAt"],"properties":{"customFieldGroupId":{"type":"string","format":"uuid","description":"Unique identifier of the group"},"groupKey":{"type":"string","description":"Immutable machine-readable identifier"},"name":{"type":"string","description":"Human-readable name of the group"},"description":{"type":"string","nullable":true,"description":"Optional description of the group"},"entityType":{"$ref":"#/components/schemas/CustomFieldEntityType"},"sortOrder":{"type":"integer","nullable":true,"description":"Display order position"},"definitions":{"type":"array","items":{"$ref":"#/components/schemas/CustomFieldDefinitionInGroupResponse"},"description":"Field definitions belonging to this group"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last modification timestamp"},"deletedAt":{"type":"string","format":"date-time","nullable":true,"description":"Soft-deletion timestamp (null if not deleted)"}}},"CustomFieldDefinitionInGroupResponse":{"type":"object","required":["customFieldDefinitionId","key","name","fieldType","config","required","active","createdAt","updatedAt"],"properties":{"customFieldDefinitionId":{"type":"string","format":"uuid","description":"Unique identifier of the field definition"},"key":{"type":"string","description":"Immutable machine-readable identifier"},"name":{"type":"string","description":"Human-readable name of the field"},"description":{"type":"string","nullable":true,"description":"Optional description of the field"},"fieldType":{"$ref":"#/components/schemas/CustomFieldType"},"config":{"type":"object","additionalProperties":true,"description":"Field-type-specific configuration. Structure depends on `fieldType`.\nSee `TextFieldConfig`, `IntegerFieldConfig`, `FloatFieldConfig`,\n`BooleanFieldConfig`, `DateFieldConfig`, `DateTimeFieldConfig`, `SelectFieldConfig` for the per-type shapes.\nValidated server-side against the schema selected by the sibling `fieldType`.\n"},"required":{"type":"boolean","description":"Whether this field must be filled in"},"active":{"type":"boolean","description":"Whether this field definition is currently active"},"sortOrder":{"type":"integer","nullable":true,"description":"Display order position"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last modification timestamp"}}},"CustomFieldType":{"type":"string","description":"Type of the custom field value. Determines the allowed JSON type and the shape\nof `config` on the definition.\n\n| Type            | Value JSON type          | Config required field    |\n|-----------------|--------------------------|--------------------------|\n| `text`          | string                   | `maxLength`              |\n| `integer`       | integer                  | —                        |\n| `float`         | number                   | —                        |\n| `boolean`       | boolean                  | —                        |\n| `date`          | string (YYYY-MM-DD)      | —                        |\n| `datetime`      | string (YYYY-MM-DD HH:mm:ss.SSSSSS) | —             |\n| `single_select` | string                   | `groupOfValuesId`        |\n| `multi_select`  | array of strings         | `groupOfValuesId`        |\n| `object_array`  | array of objects / null  | `objectFields`, `maxItems` |\n","enum":["text","integer","float","boolean","date","datetime","single_select","multi_select","object_array"]},"SearchableTotalResponse":{"required":["all","filtered","estimated"],"properties":{"all":{"type":"integer","deprecated":true},"filtered":{"type":"integer","deprecated":true},"estimated":{"description":"Field estimated is used to show that the results are estimated. It might happen when there are more than 5000 results due to performance optimization.","type":"boolean","deprecated":true}},"type":"object","deprecated":true},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/custom-field-groups/{entityType}":{"get":{"operationId":"_customFieldGroupList","tags":["Custom Field Group"],"summary":"List custom field groups","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nReturns all custom field groups for the given entity type.\nResults are ordered by sortOrder ascending.\n","parameters":[{"$ref":"#/components/parameters/storeCode"},{"name":"entityType","in":"path","required":true,"description":"Entity type","schema":{"$ref":"#/components/schemas/CustomFieldEntityType"}},{"$ref":"#/components/parameters/page"},{"$ref":"#/components/parameters/itemsOnPage"},{"$ref":"#/components/parameters/orderBy"},{"name":"customFieldGroupId","in":"query","required":false,"description":"Filter by group UUID","schema":{"type":"string","format":"uuid"}},{"name":"name","in":"query","required":false,"description":"Filter by group name (partial match)","schema":{"type":"string"}},{"name":"key","in":"query","required":false,"description":"Filter by group key (partial match)","schema":{"type":"string"}},{"name":"includeDeleted","in":"query","required":false,"description":"Whether to include soft-deleted groups. Defaults to `false`.","schema":{"type":"boolean","default":false}}],"responses":{"200":{"description":"List of custom field groups","content":{"application/json":{"schema":{"type":"object","required":["items","total"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CustomFieldGroupResponse"}},"total":{"$ref":"#/components/schemas/SearchableTotalResponse"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Create a custom field group

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> Creates a new custom field group for the given entity type.\
> The groupKey is immutable after creation.\
> The total number of active field definitions per store and entity type combination\
> is capped by a configurable aggregate limit (across all groups); the number of groups\
> is not limited on its own.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Custom Field Group","description":"These endpoints allow you to manage custom field groups and their definitions."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}}},"schemas":{"CustomFieldEntityType":{"type":"string","description":"Entity type the custom field is associated with.","enum":["member","direct-campaign","automation-campaign","referral-campaign","leaderboard","challenge","reward","fortune-wheel-reward"]},"CreateCustomFieldGroupRequest":{"type":"object","additionalProperties":false,"required":["groupKey","name"],"properties":{"groupKey":{"type":"string","description":"Immutable machine-readable identifier for the group","maxLength":64},"name":{"type":"string","description":"Human-readable name of the group","maxLength":255},"description":{"type":"string","nullable":true,"description":"Optional description of the group","maxLength":1000},"sortOrder":{"type":"integer","nullable":true,"description":"Display order position"},"definitions":{"type":"array","items":{"$ref":"#/components/schemas/DefinitionRequest"},"description":"Initial field definitions for the group"}}},"DefinitionRequest":{"type":"object","required":["key","name","fieldType"],"properties":{"key":{"type":"string","description":"Immutable machine-readable identifier. Cannot be changed after creation.","maxLength":128},"name":{"type":"string","description":"Human-readable name of the field.","maxLength":255},"description":{"type":"string","nullable":true,"description":"Optional description.","maxLength":1000},"fieldType":{"$ref":"#/components/schemas/CustomFieldType"},"required":{"type":"boolean","description":"Whether this field must be filled in.","default":false},"active":{"type":"boolean","description":"Whether this field is active. Inactive fields reject value writes (400) and\nare omitted from the member-details read response, but remain visible in the\nmanagement definitions list so they can be reactivated.\n","default":true},"sortOrder":{"type":"integer","nullable":true,"description":"Display order position."},"config":{"type":"object","additionalProperties":true,"description":"Field-type-specific configuration. Structure depends on `fieldType`.\nSee `TextFieldConfig`, `IntegerFieldConfig`, `FloatFieldConfig`,\n`BooleanFieldConfig`, `DateFieldConfig`, `DateTimeFieldConfig`, `SelectFieldConfig` for the per-type shapes.\nValidated server-side against the schema selected by the sibling `fieldType`.\n"}}},"CustomFieldType":{"type":"string","description":"Type of the custom field value. Determines the allowed JSON type and the shape\nof `config` on the definition.\n\n| Type            | Value JSON type          | Config required field    |\n|-----------------|--------------------------|--------------------------|\n| `text`          | string                   | `maxLength`              |\n| `integer`       | integer                  | —                        |\n| `float`         | number                   | —                        |\n| `boolean`       | boolean                  | —                        |\n| `date`          | string (YYYY-MM-DD)      | —                        |\n| `datetime`      | string (YYYY-MM-DD HH:mm:ss.SSSSSS) | —             |\n| `single_select` | string                   | `groupOfValuesId`        |\n| `multi_select`  | array of strings         | `groupOfValuesId`        |\n| `object_array`  | array of objects / null  | `objectFields`, `maxItems` |\n","enum":["text","integer","float","boolean","date","datetime","single_select","multi_select","object_array"]},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/custom-field-groups/{entityType}":{"post":{"operationId":"_customFieldGroupCreate","tags":["Custom Field Group"],"summary":"Create a custom field group","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nCreates a new custom field group for the given entity type.\nThe groupKey is immutable after creation.\nThe total number of active field definitions per store and entity type combination\nis capped by a configurable aggregate limit (across all groups); the number of groups\nis not limited on its own.\n","parameters":[{"$ref":"#/components/parameters/storeCode"},{"name":"entityType","in":"path","required":true,"description":"Entity type","schema":{"$ref":"#/components/schemas/CustomFieldEntityType"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["customFieldGroup"],"properties":{"customFieldGroup":{"$ref":"#/components/schemas/CreateCustomFieldGroupRequest"}}}}}},"responses":{"201":{"description":"Custom field group created successfully","content":{"application/json":{"schema":{"type":"object","required":["groupKey"],"properties":{"groupKey":{"type":"string","description":"Key of the created custom field group"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Bulk create or update custom field groups

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> Creates or updates multiple custom field groups in a single atomic operation.\
> Groups are matched by \`groupKey\` — existing groups are updated, unknown keys are created.\
> Groups not present in the request are left untouched (merge semantics on the collection).\
> All items are validated before any are persisted. If any item fails, nothing is saved.\
> Field definitions within each touched group follow PUT semantics: definitions omitted from\
> the request are deactivated. The \`fieldType\` of an existing definition is immutable.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Custom Field Group","description":"These endpoints allow you to manage custom field groups and their definitions."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}}},"schemas":{"CustomFieldEntityType":{"type":"string","description":"Entity type the custom field is associated with.","enum":["member","direct-campaign","automation-campaign","referral-campaign","leaderboard","challenge","reward","fortune-wheel-reward"]},"UpsertCustomFieldGroupRequest":{"type":"object","additionalProperties":false,"required":["groupKey","name"],"properties":{"groupKey":{"type":"string","description":"Machine-readable identifier. Matched against existing groups — creates if absent, updates if present.","maxLength":64},"name":{"type":"string","description":"Human-readable name of the group","maxLength":255},"description":{"type":"string","nullable":true,"description":"Optional description of the group","maxLength":1000},"sortOrder":{"type":"integer","nullable":true,"description":"Display order position"},"definitions":{"type":"array","items":{"$ref":"#/components/schemas/DefinitionRequest"},"description":"Field definitions for the group. Follows PUT semantics — definitions absent from this\nlist are deactivated. The `fieldType` of an existing definition cannot be changed.\n"}}},"DefinitionRequest":{"type":"object","required":["key","name","fieldType"],"properties":{"key":{"type":"string","description":"Immutable machine-readable identifier. Cannot be changed after creation.","maxLength":128},"name":{"type":"string","description":"Human-readable name of the field.","maxLength":255},"description":{"type":"string","nullable":true,"description":"Optional description.","maxLength":1000},"fieldType":{"$ref":"#/components/schemas/CustomFieldType"},"required":{"type":"boolean","description":"Whether this field must be filled in.","default":false},"active":{"type":"boolean","description":"Whether this field is active. Inactive fields reject value writes (400) and\nare omitted from the member-details read response, but remain visible in the\nmanagement definitions list so they can be reactivated.\n","default":true},"sortOrder":{"type":"integer","nullable":true,"description":"Display order position."},"config":{"type":"object","additionalProperties":true,"description":"Field-type-specific configuration. Structure depends on `fieldType`.\nSee `TextFieldConfig`, `IntegerFieldConfig`, `FloatFieldConfig`,\n`BooleanFieldConfig`, `DateFieldConfig`, `DateTimeFieldConfig`, `SelectFieldConfig` for the per-type shapes.\nValidated server-side against the schema selected by the sibling `fieldType`.\n"}}},"CustomFieldType":{"type":"string","description":"Type of the custom field value. Determines the allowed JSON type and the shape\nof `config` on the definition.\n\n| Type            | Value JSON type          | Config required field    |\n|-----------------|--------------------------|--------------------------|\n| `text`          | string                   | `maxLength`              |\n| `integer`       | integer                  | —                        |\n| `float`         | number                   | —                        |\n| `boolean`       | boolean                  | —                        |\n| `date`          | string (YYYY-MM-DD)      | —                        |\n| `datetime`      | string (YYYY-MM-DD HH:mm:ss.SSSSSS) | —             |\n| `single_select` | string                   | `groupOfValuesId`        |\n| `multi_select`  | array of strings         | `groupOfValuesId`        |\n| `object_array`  | array of objects / null  | `objectFields`, `maxItems` |\n","enum":["text","integer","float","boolean","date","datetime","single_select","multi_select","object_array"]},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"NoContent":{"description":"Success. No content."},"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/custom-field-groups/{entityType}":{"patch":{"operationId":"_customFieldGroupBulkMerge","tags":["Custom Field Group"],"summary":"Bulk create or update custom field groups","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nCreates or updates multiple custom field groups in a single atomic operation.\nGroups are matched by `groupKey` — existing groups are updated, unknown keys are created.\nGroups not present in the request are left untouched (merge semantics on the collection).\nAll items are validated before any are persisted. If any item fails, nothing is saved.\nField definitions within each touched group follow PUT semantics: definitions omitted from\nthe request are deactivated. The `fieldType` of an existing definition is immutable.\n","parameters":[{"$ref":"#/components/parameters/storeCode"},{"name":"entityType","in":"path","required":true,"description":"Entity type","schema":{"$ref":"#/components/schemas/CustomFieldEntityType"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["customFieldGroups"],"additionalProperties":false,"properties":{"customFieldGroups":{"type":"array","items":{"$ref":"#/components/schemas/UpsertCustomFieldGroupRequest"}}}}}}},"responses":{"204":{"$ref":"#/components/responses/NoContent"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"}}}}}}
````

## Get a custom field group

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> Returns a single custom field group with its field definitions.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Custom Field Group","description":"These endpoints allow you to manage custom field groups and their definitions."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}}},"schemas":{"CustomFieldEntityType":{"type":"string","description":"Entity type the custom field is associated with.","enum":["member","direct-campaign","automation-campaign","referral-campaign","leaderboard","challenge","reward","fortune-wheel-reward"]},"CustomFieldGroupResponse":{"type":"object","required":["customFieldGroupId","groupKey","name","entityType","definitions","createdAt","updatedAt"],"properties":{"customFieldGroupId":{"type":"string","format":"uuid","description":"Unique identifier of the group"},"groupKey":{"type":"string","description":"Immutable machine-readable identifier"},"name":{"type":"string","description":"Human-readable name of the group"},"description":{"type":"string","nullable":true,"description":"Optional description of the group"},"entityType":{"$ref":"#/components/schemas/CustomFieldEntityType"},"sortOrder":{"type":"integer","nullable":true,"description":"Display order position"},"definitions":{"type":"array","items":{"$ref":"#/components/schemas/CustomFieldDefinitionInGroupResponse"},"description":"Field definitions belonging to this group"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last modification timestamp"},"deletedAt":{"type":"string","format":"date-time","nullable":true,"description":"Soft-deletion timestamp (null if not deleted)"}}},"CustomFieldDefinitionInGroupResponse":{"type":"object","required":["customFieldDefinitionId","key","name","fieldType","config","required","active","createdAt","updatedAt"],"properties":{"customFieldDefinitionId":{"type":"string","format":"uuid","description":"Unique identifier of the field definition"},"key":{"type":"string","description":"Immutable machine-readable identifier"},"name":{"type":"string","description":"Human-readable name of the field"},"description":{"type":"string","nullable":true,"description":"Optional description of the field"},"fieldType":{"$ref":"#/components/schemas/CustomFieldType"},"config":{"type":"object","additionalProperties":true,"description":"Field-type-specific configuration. Structure depends on `fieldType`.\nSee `TextFieldConfig`, `IntegerFieldConfig`, `FloatFieldConfig`,\n`BooleanFieldConfig`, `DateFieldConfig`, `DateTimeFieldConfig`, `SelectFieldConfig` for the per-type shapes.\nValidated server-side against the schema selected by the sibling `fieldType`.\n"},"required":{"type":"boolean","description":"Whether this field must be filled in"},"active":{"type":"boolean","description":"Whether this field definition is currently active"},"sortOrder":{"type":"integer","nullable":true,"description":"Display order position"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"updatedAt":{"type":"string","format":"date-time","description":"Last modification timestamp"}}},"CustomFieldType":{"type":"string","description":"Type of the custom field value. Determines the allowed JSON type and the shape\nof `config` on the definition.\n\n| Type            | Value JSON type          | Config required field    |\n|-----------------|--------------------------|--------------------------|\n| `text`          | string                   | `maxLength`              |\n| `integer`       | integer                  | —                        |\n| `float`         | number                   | —                        |\n| `boolean`       | boolean                  | —                        |\n| `date`          | string (YYYY-MM-DD)      | —                        |\n| `datetime`      | string (YYYY-MM-DD HH:mm:ss.SSSSSS) | —             |\n| `single_select` | string                   | `groupOfValuesId`        |\n| `multi_select`  | array of strings         | `groupOfValuesId`        |\n| `object_array`  | array of objects / null  | `objectFields`, `maxItems` |\n","enum":["text","integer","float","boolean","date","datetime","single_select","multi_select","object_array"]},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/custom-field-groups/{entityType}/{groupKey}":{"get":{"operationId":"_customFieldGroupGet","tags":["Custom Field Group"],"summary":"Get a custom field group","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nReturns a single custom field group with its field definitions.\n","parameters":[{"$ref":"#/components/parameters/storeCode"},{"name":"entityType","in":"path","required":true,"description":"Entity type","schema":{"$ref":"#/components/schemas/CustomFieldEntityType"}},{"name":"groupKey","in":"path","required":true,"description":"Group key","schema":{"type":"string"}}],"responses":{"200":{"description":"Custom field group details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldGroupResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Replace a custom field group

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> Replaces all mutable fields of a custom field group.\
> The groupKey and entityType are immutable and cannot be changed.\
> Existing field definitions not included in the request are removed (if not immutable).<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Custom Field Group","description":"These endpoints allow you to manage custom field groups and their definitions."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}}},"schemas":{"CustomFieldEntityType":{"type":"string","description":"Entity type the custom field is associated with.","enum":["member","direct-campaign","automation-campaign","referral-campaign","leaderboard","challenge","reward","fortune-wheel-reward"]},"UpdateCustomFieldGroupRequest":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","description":"Human-readable name of the group","maxLength":255},"description":{"type":"string","nullable":true,"description":"Optional description of the group","maxLength":1000},"sortOrder":{"type":"integer","nullable":true,"description":"Display order position"},"definitions":{"type":"array","items":{"$ref":"#/components/schemas/DefinitionRequest"},"description":"Full replacement set of field definitions"}}},"DefinitionRequest":{"type":"object","required":["key","name","fieldType"],"properties":{"key":{"type":"string","description":"Immutable machine-readable identifier. Cannot be changed after creation.","maxLength":128},"name":{"type":"string","description":"Human-readable name of the field.","maxLength":255},"description":{"type":"string","nullable":true,"description":"Optional description.","maxLength":1000},"fieldType":{"$ref":"#/components/schemas/CustomFieldType"},"required":{"type":"boolean","description":"Whether this field must be filled in.","default":false},"active":{"type":"boolean","description":"Whether this field is active. Inactive fields reject value writes (400) and\nare omitted from the member-details read response, but remain visible in the\nmanagement definitions list so they can be reactivated.\n","default":true},"sortOrder":{"type":"integer","nullable":true,"description":"Display order position."},"config":{"type":"object","additionalProperties":true,"description":"Field-type-specific configuration. Structure depends on `fieldType`.\nSee `TextFieldConfig`, `IntegerFieldConfig`, `FloatFieldConfig`,\n`BooleanFieldConfig`, `DateFieldConfig`, `DateTimeFieldConfig`, `SelectFieldConfig` for the per-type shapes.\nValidated server-side against the schema selected by the sibling `fieldType`.\n"}}},"CustomFieldType":{"type":"string","description":"Type of the custom field value. Determines the allowed JSON type and the shape\nof `config` on the definition.\n\n| Type            | Value JSON type          | Config required field    |\n|-----------------|--------------------------|--------------------------|\n| `text`          | string                   | `maxLength`              |\n| `integer`       | integer                  | —                        |\n| `float`         | number                   | —                        |\n| `boolean`       | boolean                  | —                        |\n| `date`          | string (YYYY-MM-DD)      | —                        |\n| `datetime`      | string (YYYY-MM-DD HH:mm:ss.SSSSSS) | —             |\n| `single_select` | string                   | `groupOfValuesId`        |\n| `multi_select`  | array of strings         | `groupOfValuesId`        |\n| `object_array`  | array of objects / null  | `objectFields`, `maxItems` |\n","enum":["text","integer","float","boolean","date","datetime","single_select","multi_select","object_array"]},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"NoContent":{"description":"Success. No content."},"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/custom-field-groups/{entityType}/{groupKey}":{"put":{"operationId":"_customFieldGroupReplace","tags":["Custom Field Group"],"summary":"Replace a custom field group","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nReplaces all mutable fields of a custom field group.\nThe groupKey and entityType are immutable and cannot be changed.\nExisting field definitions not included in the request are removed (if not immutable).\n","parameters":[{"$ref":"#/components/parameters/storeCode"},{"name":"entityType","in":"path","required":true,"description":"Entity type","schema":{"$ref":"#/components/schemas/CustomFieldEntityType"}},{"name":"groupKey","in":"path","required":true,"description":"Group key","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["customFieldGroup"],"properties":{"customFieldGroup":{"$ref":"#/components/schemas/UpdateCustomFieldGroupRequest"}}}}}},"responses":{"204":{"$ref":"#/components/responses/NoContent"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Delete a custom field group

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> Soft-deletes a custom field group. The record is not permanently removed.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Custom Field Group","description":"These endpoints allow you to manage custom field groups and their definitions."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}}},"schemas":{"CustomFieldEntityType":{"type":"string","description":"Entity type the custom field is associated with.","enum":["member","direct-campaign","automation-campaign","referral-campaign","leaderboard","challenge","reward","fortune-wheel-reward"]},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"NoContent":{"description":"Success. No content."},"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/custom-field-groups/{entityType}/{groupKey}":{"delete":{"operationId":"_customFieldGroupDelete","tags":["Custom Field Group"],"summary":"Delete a custom field group","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nSoft-deletes a custom field group. The record is not permanently removed.\n","parameters":[{"$ref":"#/components/parameters/storeCode"},{"name":"entityType","in":"path","required":true,"description":"Entity type","schema":{"$ref":"#/components/schemas/CustomFieldEntityType"}},{"name":"groupKey","in":"path","required":true,"description":"Group key","schema":{"type":"string"}}],"responses":{"204":{"$ref":"#/components/responses/NoContent"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````

## Partially update a custom field group

> \<label style="background-color: #D4EDBC;padding:5px;">Management\</label>\<br>\<br>\
> Updates only the provided fields of a custom field group.\
> Omitted fields are left unchanged.<br>

````json
{"openapi":"3.0.0","info":{"title":"Open Loyalty","version":"0.0.1"},"tags":[{"name":"Custom Field Group","description":"These endpoints allow you to manage custom field groups and their definitions."}],"servers":[{"url":"http://openloyalty.localhost"}],"security":[{"Bearer":[]},{"token":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"Open Loyalty has the JWT authorization.\nTo learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens <https://jwt.io/introduction/>\n\n### Obtain an access token\n\nSend a request with the parameters username and password\n\n#### Definition\n\n`POST /api/admin/login_check` [Go to definition](#operation/adminLoginCheck)\\\n`POST /api/{storeCode}/member/login_check` [Go to definition](#operation/memberLoginCheck)\n\n#### Example\n\n```bash\ncurl {HOST}/api/admin/login_check\n    -H 'Content-Type: application/json;charset=UTF-8'\n    -H 'Accept: application/json, text/plain, */*'\n    --data-binary '{\"username\":\"admin\",\"password\":\"password\"}'\n```\n\n#### Example Response\n\n```json\n{\n    \"token\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6...\",\n    \"refresh_token\":\"0558f8bb29948c4e54c443f...\"\n}\n```\n\n### Using JSON Web Token\n\nAdd authorization header to each request\\\n`Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...`\\\nYou can now access any API method you want under the /api prefix.\n\n#### Example\n```bash\ncurl {HOST}/api/{storeCode}/analytics/members\n    -H 'Accept: application/json'\n    -H 'Content-type: application/x-www-form-urlencoded'\n    -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'\n```\n\n### Refresh JSON Web Token\nYou can refresh token using refresh_token that was given during login.\\\nThere are two endpoints\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\\\nTo refresh member token `POST /api/{storeCode}/token/refresh` [Go to definition](#operation/tokenRefreshMember)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header"}},"parameters":{"storeCode":{"name":"storeCode","in":"path","description":"Store code","required":true,"schema":{"type":"string"}}},"schemas":{"CustomFieldEntityType":{"type":"string","description":"Entity type the custom field is associated with.","enum":["member","direct-campaign","automation-campaign","referral-campaign","leaderboard","challenge","reward","fortune-wheel-reward"]},"PatchCustomFieldGroupRequest":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string","description":"Human-readable name of the group","maxLength":255},"description":{"type":"string","nullable":true,"description":"Optional description of the group","maxLength":1000},"sortOrder":{"type":"integer","nullable":true,"description":"Display order position"},"definitions":{"type":"array","items":{"$ref":"#/components/schemas/DefinitionRequest"},"description":"Updated field definitions (replaces existing definitions if provided)"}}},"DefinitionRequest":{"type":"object","required":["key","name","fieldType"],"properties":{"key":{"type":"string","description":"Immutable machine-readable identifier. Cannot be changed after creation.","maxLength":128},"name":{"type":"string","description":"Human-readable name of the field.","maxLength":255},"description":{"type":"string","nullable":true,"description":"Optional description.","maxLength":1000},"fieldType":{"$ref":"#/components/schemas/CustomFieldType"},"required":{"type":"boolean","description":"Whether this field must be filled in.","default":false},"active":{"type":"boolean","description":"Whether this field is active. Inactive fields reject value writes (400) and\nare omitted from the member-details read response, but remain visible in the\nmanagement definitions list so they can be reactivated.\n","default":true},"sortOrder":{"type":"integer","nullable":true,"description":"Display order position."},"config":{"type":"object","additionalProperties":true,"description":"Field-type-specific configuration. Structure depends on `fieldType`.\nSee `TextFieldConfig`, `IntegerFieldConfig`, `FloatFieldConfig`,\n`BooleanFieldConfig`, `DateFieldConfig`, `DateTimeFieldConfig`, `SelectFieldConfig` for the per-type shapes.\nValidated server-side against the schema selected by the sibling `fieldType`.\n"}}},"CustomFieldType":{"type":"string","description":"Type of the custom field value. Determines the allowed JSON type and the shape\nof `config` on the definition.\n\n| Type            | Value JSON type          | Config required field    |\n|-----------------|--------------------------|--------------------------|\n| `text`          | string                   | `maxLength`              |\n| `integer`       | integer                  | —                        |\n| `float`         | number                   | —                        |\n| `boolean`       | boolean                  | —                        |\n| `date`          | string (YYYY-MM-DD)      | —                        |\n| `datetime`      | string (YYYY-MM-DD HH:mm:ss.SSSSSS) | —             |\n| `single_select` | string                   | `groupOfValuesId`        |\n| `multi_select`  | array of strings         | `groupOfValuesId`        |\n| `object_array`  | array of objects / null  | `objectFields`, `maxItems` |\n","enum":["text","integer","float","boolean","date","datetime","single_select","multi_select","object_array"]},"ExpiredToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"InvalidToken":{"required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"type":"object"},"Unauthorized":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}},"responses":{"NoContent":{"description":"Success. No content."},"BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"required":["code","message","errors"],"properties":{"code":{"type":"integer"},"message":{"type":"string"},"errors":{"type":"array","items":{"required":["message","parameters","plural","code","path"],"properties":{"message":{"type":"string"},"parameters":{},"plural":{"type":"integer","nullable":true},"code":{"type":"string"},"path":{"type":"string"}},"type":"object"}}},"type":"object"}}}},"AccessDenied":{"description":"Forbidden.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}},"NotFound":{"description":"Not found.","content":{"application/json":{"schema":{"required":["code","message"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}},"type":"object"}}}}}},"paths":{"/api/{storeCode}/custom-field-groups/{entityType}/{groupKey}":{"patch":{"operationId":"_customFieldGroupUpdate","tags":["Custom Field Group"],"summary":"Partially update a custom field group","description":"<label style=\"background-color: #D4EDBC;padding:5px;\">Management</label><br><br>\nUpdates only the provided fields of a custom field group.\nOmitted fields are left unchanged.\n","parameters":[{"$ref":"#/components/parameters/storeCode"},{"name":"entityType","in":"path","required":true,"description":"Entity type","schema":{"$ref":"#/components/schemas/CustomFieldEntityType"}},{"name":"groupKey","in":"path","required":true,"description":"Group key","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["customFieldGroup"],"properties":{"customFieldGroup":{"$ref":"#/components/schemas/PatchCustomFieldGroupRequest"}}}}}},"responses":{"204":{"$ref":"#/components/responses/NoContent"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ExpiredToken"},{"$ref":"#/components/schemas/InvalidToken"},{"$ref":"#/components/schemas/Unauthorized"}]}}}},"403":{"$ref":"#/components/responses/AccessDenied"},"404":{"$ref":"#/components/responses/NotFound"}}}}}}
````


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.openloyalty.io/api-reference/custom-field-group.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
