> 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/replace-a-custom-field-group.md).

# Replace a custom field group

Management\
\
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).

````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\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.\\\nTo refresh admin token `POST /api/token/refresh` [Go to definition](#operation/tokenRefresh)\n","bearerFormat":"JWT","scheme":"bearer"},"token":{"type":"apiKey","name":"X-AUTH-TOKEN","in":"header","description":"Send the admin API key in this header. The `?auth_token=` query parameter is deprecated and is being switched off environment by environment — credentials in URLs land in access logs, proxies and browser history — so do not rely on it.\n"}},"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"}}}}}}
````


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
