> For the complete documentation index, see [llms.txt](https://user.netmera.com/netmera-developer-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/category-preferences/set-category-preferences.md). Agents can also search and read this documentation through its [MCP server](https://user.netmera.com/netmera-developer-guide/~gitbook/mcp).

# Set Category Preferences

Opts a user in to or out of message categories.

<details>

<summary>Notes</summary>

* A user's preference is stored per category and channel.
* Send `channel` to update one category and channel pair. Omit it to apply the change to every channel of the category.
* The `channel` field is optional: omitting it behaves exactly as it did before channel-based preferences were introduced.
* An entry whose category or channel name is not recognised is skipped as a whole. The other entries are still processed, and the call returns 200 without reporting the skipped entry.
* An entry without `category` returns 200 but changes none of the user's category preferences. Always send `category`.

</details>

```json
{"openapi":"3.1.0","info":{"title":"Netmera REST API","version":"3.0"},"tags":[{"name":"Category Preferences","description":"Read and change which message categories a user wants to receive, per channel.\n\n<table data-view=\"cards\"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type=\"content-ref\"></th></tr></thead><tbody><tr><td><strong>Get Category Preferences</strong></td><td><code>GET</code> Returns a user's opt-in preference for each message category, with a per-channel breakdown.</td><td><a href=\"https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/category-preferences/get-category-preferences\">Get Category Preferences</a></td></tr><tr><td><strong>Set Category Preferences</strong></td><td><code>POST</code> Opts a user in to or out of message categories.</td><td><a href=\"https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/category-preferences/set-category-preferences\">Set Category Preferences</a></td></tr></tbody></table>\n"}],"servers":[{"url":"https://restapi.netmera.com","description":"Netmera REST API"}],"security":[{"REST-API-key":[]}],"components":{"securitySchemes":{"REST-API-key":{"type":"apiKey","in":"header","name":"X-netmera-api-key","description":"REST API key. Available in the Netmera Panel under Developers > API.\n"}},"schemas":{"NetmeraError":{"type":"object","description":"Standard Netmera error body.","required":["code","error"],"properties":{"code":{"type":"integer","description":"Netmera error code. See the error table in the API description."},"error":{"type":"string","description":"Human readable error message."}}},"ProblemDetail":{"type":"object","description":"RFC 7807 error body returned by the framework instead of the Netmera error body when a\nrequired query parameter is missing or a parameter cannot be converted to its type.\n","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"}}}},"responses":{"InvalidApiKey":{"description":"The `X-netmera-api-key` header is missing or the key is not valid.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NetmeraError"}}}},"IpNotAllowed":{"description":"The application restricts REST calls to a list of allowed IP addresses and the caller's\nIP is not on it. The check runs after the API key is validated and before the request\nbody and parameters are validated, so a restricted application returns this error even\nfor a malformed request.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NetmeraError"}}}}}},"paths":{"/rest/3.0/setCategoryPreferences":{"post":{"operationId":"setCategoryPreferences","tags":["Category Preferences"],"summary":"Set Category Preferences","description":"Opts a user in to or out of message categories.\n\n<details>\n\n<summary>Notes</summary>\n\n- A user's preference is stored per category and channel.\n- Send `channel` to update one category and channel pair. Omit it to apply the change to every\n  channel of the category.\n- The `channel` field is optional: omitting it behaves exactly as it did before channel-based\n  preferences were introduced.\n- An entry whose category or channel name is not recognised is skipped as a whole. The other entries\n  are still processed, and the call returns 200 without reporting the skipped entry.\n- An entry without `category` returns 200 but changes none of the user's category preferences.\n  Always send `category`.\n\n</details>\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"type":"object","required":["extId","category","enable"],"properties":{"extId":{"type":"string","description":"External user ID."},"category":{"type":"string","description":"Message category name, matched exactly (case-sensitive) against active\ncategories. An entry naming a category that does not exist is skipped.\n"},"enable":{"type":"boolean","description":"True to opt-in, false to opt-out."},"channel":{"type":"string","description":"Applies the change only to this channel of the category; every channel when omitted.\nValues are `MOBILE`, `SMS`, `EMAIL`, `WHATS_APP`, `IN_APP` and `WEB`, case-insensitive\n(`whatsapp` and `inapp` are not accepted); an unrecognized value skips the entry and\nleaves that preference unchanged while the other entries are processed, and categories\ncreated before channel selection are valid on all channels.\n"}}}}}}},"responses":{"200":{"description":"The preferences were updated. Returns no response body.\n"},"400":{"description":"Error responses the API can return.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NetmeraError"}},"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}},"401":{"$ref":"#/components/responses/InvalidApiKey"},"403":{"$ref":"#/components/responses/IpNotAllowed"}}}}}}
```


---

# 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://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/category-preferences/set-category-preferences.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.
