> For the complete documentation index, see [llms.txt](https://docs.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mediarithmics.io/api-reference/datamart-management/compartments.md).

# Compartments

Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.

Relevant documentation:

* [Compartments](https://developer.mediarithmics.io/user-points/compartments)

## GET /user\_account\_compartments/{compartment\_id}/datamart\_selections

> Search datamarts on which the compartment is enabled

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/user_account_compartments/{compartment_id}/datamart_selections":{"get":{"tags":["Compartments"],"description":"","operationId":"findUserAccountCompartmentDatamartSelections","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"first_result":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/UserAccountCompartmentDatamartSelectionResource"}},"status":{"type":"string","enum":["ok"]},"max_results":{"type":"integer"},"total":{"type":"integer"},"count":{"type":"integer"}},"required":["count","data","first_result","max_results","status","total"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"parameters":[{"required":true,"name":"compartment_id","style":"simple","schema":{"type":"string"},"explode":false,"in":"path"},{"explode":true,"name":"organisation_id","required":false,"description":"Id of the organisation to search","style":"form","schema":{"type":"string"},"in":"query"},{"schema":{"type":"string"},"in":"query","name":"id","description":"Id of a specific selection to search for","style":"form","required":false,"explode":true},{"in":"query","style":"form","description":"Id of a specific datamart to search for","explode":true,"required":false,"schema":{"type":"string"},"name":"datamart_id"},{"style":"form","in":"query","explode":true,"description":"Offset from which the search must be performed","name":"first_result","required":false,"schema":{"type":"integer","format":"int32"}},{"style":"form","schema":{"type":"integer","format":"int32"},"explode":true,"in":"query","description":"Number of maximum items that shall be return by this search","name":"max_results","required":false}],"summary":"Search datamarts on which the compartment is enabled"}}},"components":{"schemas":{"UserAccountCompartmentDatamartSelectionResource":{"type":"object","properties":{"type":{"$ref":"#/components/schemas/UserAccountCompartmentType"},"image_uri":{"type":"string","readOnly":false},"datamart_id":{"type":"string","readOnly":false},"token":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"compartment_id":{"type":"string","readOnly":false},"default":{"type":"boolean","default":false,"readOnly":false},"name":{"type":"string","readOnly":true}},"required":["compartment_id","datamart_id","default","id","name","token","type"]},"UserAccountCompartmentType":{"type":"string","enum":["CUSTOM_COMPARTMENT_ID","NETWORK_USER_ID"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## PUT /user\_account\_compartments/{compartment\_id}/datamart\_selections

> Update the set of datamarts on which this compartment is enabled

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/user_account_compartments/{compartment_id}/datamart_selections":{"put":{"responses":{"200":{"$ref":"#/components/responses/simple"},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"summary":"Update the set of datamarts on which this compartment is enabled","parameters":[{"in":"path","schema":{"type":"string"},"required":true,"name":"compartment_id","explode":false,"style":"simple"},{"description":"Organisation id of the selected datamarts","name":"organisation_id","schema":{"type":"string"},"explode":true,"style":"form","in":"query","required":true}],"description":"","tags":["Compartments"],"requestBody":{"description":"The new list of the selected datamarts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAccountCompartmentDatamartSelectionsResource"}}},"required":true},"operationId":"updateUserAccountCompartmentDatamartSelections"}}},"components":{"responses":{"simple":{"description":"Success response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"schemas":{"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]},"UserAccountCompartmentDatamartSelectionsResource":{"type":"object","properties":{"datamart_selections":{"type":"array","items":{"$ref":"#/components/schemas/UserAccountCompartmentDatamartSelectionUpdateResource"},"readOnly":false}},"required":["datamart_selections"]},"UserAccountCompartmentDatamartSelectionUpdateResource":{"type":"object","properties":{"datamart_id":{"type":"string","readOnly":false}},"required":["datamart_id"]}}}}
```

## GET /datamarts/{datamart\_id}/compartments

> Search compartments

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/compartments":{"get":{"description":"","operationId":"findUserAccountCompartmentSelections","summary":"Search compartments","parameters":[{"required":true,"style":"simple","name":"datamart_id","explode":false,"in":"path","schema":{"type":"integer","format":"int64"}},{"in":"query","name":"token","explode":true,"description":"user account compartment token","style":"form","schema":{"type":"string"},"required":false},{"style":"form","name":"default","explode":true,"in":"query","required":false,"schema":{"type":"boolean"},"description":"is a default user account compartment or not"},{"style":"form","in":"query","explode":true,"required":false,"name":"with_source_datamarts","description":"select or not source datamarts selections","schema":{"type":"boolean"}}],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/UserAccountCompartmentDatamartSelectionResource"}},"first_result":{"type":"integer"},"total":{"type":"integer"},"max_results":{"type":"integer"},"count":{"type":"integer"},"status":{"type":"string","enum":["ok"]}},"required":["count","data","first_result","max_results","status","total"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"tags":["Compartments"]}}},"components":{"schemas":{"UserAccountCompartmentDatamartSelectionResource":{"type":"object","properties":{"type":{"$ref":"#/components/schemas/UserAccountCompartmentType"},"image_uri":{"type":"string","readOnly":false},"datamart_id":{"type":"string","readOnly":false},"token":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"compartment_id":{"type":"string","readOnly":false},"default":{"type":"boolean","default":false,"readOnly":false},"name":{"type":"string","readOnly":true}},"required":["compartment_id","datamart_id","default","id","name","token","type"]},"UserAccountCompartmentType":{"type":"string","enum":["CUSTOM_COMPARTMENT_ID","NETWORK_USER_ID"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## POST /datamarts/{datamart\_id}/compartments

> Create compartment on a datamart

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/compartments":{"post":{"parameters":[{"schema":{"type":"integer","format":"int64"},"name":"datamart_id","explode":false,"in":"path","style":"simple","required":true}],"requestBody":{"description":"The user account compartment to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAccountCompartmentDatamartSelectionResource"}}},"required":true},"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/UserAccountCompartmentDatamartSelectionResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"operationId":"createUserAccountCompartmentOnDatamart","summary":"Create compartment on a datamart","tags":["Compartments"],"description":""}}},"components":{"schemas":{"UserAccountCompartmentDatamartSelectionResource":{"type":"object","properties":{"type":{"$ref":"#/components/schemas/UserAccountCompartmentType"},"image_uri":{"type":"string","readOnly":false},"datamart_id":{"type":"string","readOnly":false},"token":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"compartment_id":{"type":"string","readOnly":false},"default":{"type":"boolean","default":false,"readOnly":false},"name":{"type":"string","readOnly":true}},"required":["compartment_id","datamart_id","default","id","name","token","type"]},"UserAccountCompartmentType":{"type":"string","enum":["CUSTOM_COMPARTMENT_ID","NETWORK_USER_ID"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## GET /datamarts/{datamart\_id}/user\_account\_compartments/{token\_or\_id}

> Get the user account compartment by token or id for a datamart

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/user_account_compartments/{token_or_id}":{"get":{"tags":["Compartments"],"deprecated":true,"description":"","parameters":[{"in":"path","explode":false,"style":"simple","schema":{"type":"integer","format":"int64"},"required":true,"name":"datamart_id"},{"schema":{"$ref":"#/components/schemas/TokenOrId"},"style":"simple","name":"token_or_id","required":true,"explode":false,"in":"path"}],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/UserAccountCompartmentResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"summary":"Get the user account compartment by token or id for a datamart","operationId":"findUserAccountCompartmentForDatamart"}}},"components":{"schemas":{"TokenOrId":{"type":"string","description":"Identifier in one of the two following format : - an id, often a number - token=xxx "},"UserAccountCompartmentResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"default":{"type":"boolean","default":false,"readOnly":false},"organisation_id":{"type":"string","readOnly":false},"token":{"type":"string","readOnly":false},"type":{"$ref":"#/components/schemas/UserAccountCompartmentType"},"name":{"type":"string","readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"image_uri":{"type":"string","readOnly":false}},"required":["archived","default","id","organisation_id","type"]},"UserAccountCompartmentType":{"type":"string","enum":["CUSTOM_COMPARTMENT_ID","NETWORK_USER_ID"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## PUT /datamarts/{datamart\_id}/user\_account\_compartments/{token\_or\_id}

> Update the user account compartment for a given token or id for a datamart

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/user_account_compartments/{token_or_id}":{"put":{"deprecated":true,"requestBody":{"description":"The user account compartment to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAccountCompartmentResource"}}},"required":true},"tags":["Compartments"],"parameters":[{"style":"simple","schema":{"type":"integer","format":"int64"},"name":"datamart_id","explode":false,"in":"path","required":true},{"required":true,"in":"path","schema":{"$ref":"#/components/schemas/TokenOrId"},"style":"simple","explode":false,"name":"token_or_id"}],"description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/UserAccountCompartmentResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"summary":"Update the user account compartment for a given token or id for a datamart","operationId":"updateUserAccountCompartmentForDatamart"}}},"components":{"schemas":{"UserAccountCompartmentResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"default":{"type":"boolean","default":false,"readOnly":false},"organisation_id":{"type":"string","readOnly":false},"token":{"type":"string","readOnly":false},"type":{"$ref":"#/components/schemas/UserAccountCompartmentType"},"name":{"type":"string","readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"image_uri":{"type":"string","readOnly":false}},"required":["archived","default","id","organisation_id","type"]},"UserAccountCompartmentType":{"type":"string","enum":["CUSTOM_COMPARTMENT_ID","NETWORK_USER_ID"],"readOnly":false},"TokenOrId":{"type":"string","description":"Identifier in one of the two following format : - an id, often a number - token=xxx "},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## DELETE /datamarts/{datamart\_id}/user\_account\_compartments/{token\_or\_id}

> Delete the user account compartment for a given token or id for a datamart

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/user_account_compartments/{token_or_id}":{"delete":{"summary":"Delete the user account compartment for a given token or id for a datamart","deprecated":true,"responses":{"200":{"$ref":"#/components/responses/simple"},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"description":"","operationId":"removeUserAccountCompartmentForDatamart","parameters":[{"explode":false,"in":"path","style":"simple","required":true,"name":"datamart_id","schema":{"type":"integer","format":"int64"}},{"required":true,"in":"path","style":"simple","name":"token_or_id","explode":false,"schema":{"$ref":"#/components/schemas/TokenOrId"}}],"tags":["Compartments"]}}},"components":{"responses":{"simple":{"description":"Success response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"schemas":{"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]},"TokenOrId":{"type":"string","description":"Identifier in one of the two following format : - an id, often a number - token=xxx "}}}}
```

## GET /user\_account\_compartments/{token\_or\_id}

> Get the user account compartment by token or id

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/user_account_compartments/{token_or_id}":{"get":{"description":"","summary":"Get the user account compartment by token or id","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/UserAccountCompartmentResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"parameters":[{"schema":{"$ref":"#/components/schemas/TokenOrId"},"style":"simple","name":"token_or_id","in":"path","explode":false,"required":true},{"schema":{"type":"boolean"},"style":"form","explode":true,"in":"query","required":false,"name":"user_authorized"}],"tags":["Compartments"],"operationId":"getUserAccountCompartment"}}},"components":{"schemas":{"UserAccountCompartmentResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"default":{"type":"boolean","default":false,"readOnly":false},"organisation_id":{"type":"string","readOnly":false},"token":{"type":"string","readOnly":false},"type":{"$ref":"#/components/schemas/UserAccountCompartmentType"},"name":{"type":"string","readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"image_uri":{"type":"string","readOnly":false}},"required":["archived","default","id","organisation_id","type"]},"UserAccountCompartmentType":{"type":"string","enum":["CUSTOM_COMPARTMENT_ID","NETWORK_USER_ID"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]},"TokenOrId":{"type":"string","description":"Identifier in one of the two following format : - an id, often a number - token=xxx "}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## PUT /user\_account\_compartments/{token\_or\_id}

> Update the user account compartment for a given token or id

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/user_account_compartments/{token_or_id}":{"put":{"parameters":[{"schema":{"$ref":"#/components/schemas/TokenOrId"},"name":"token_or_id","in":"path","style":"simple","explode":false,"required":true}],"tags":["Compartments"],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/UserAccountCompartmentResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"description":"","summary":"Update the user account compartment for a given token or id","operationId":"updateUserAccountCompartment","requestBody":{"description":"The user account compartment input parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAccountCompartmentResource"}}},"required":true}}}},"components":{"schemas":{"TokenOrId":{"type":"string","description":"Identifier in one of the two following format : - an id, often a number - token=xxx "},"UserAccountCompartmentResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"default":{"type":"boolean","default":false,"readOnly":false},"organisation_id":{"type":"string","readOnly":false},"token":{"type":"string","readOnly":false},"type":{"$ref":"#/components/schemas/UserAccountCompartmentType"},"name":{"type":"string","readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"image_uri":{"type":"string","readOnly":false}},"required":["archived","default","id","organisation_id","type"]},"UserAccountCompartmentType":{"type":"string","enum":["CUSTOM_COMPARTMENT_ID","NETWORK_USER_ID"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## DELETE /user\_account\_compartments/{token\_or\_id}

> Delete the user account compartment for a given token or id

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/user_account_compartments/{token_or_id}":{"delete":{"tags":["Compartments"],"operationId":"removeUserAccountCompartment","parameters":[{"in":"path","required":true,"style":"simple","schema":{"$ref":"#/components/schemas/TokenOrId"},"name":"token_or_id","explode":false}],"description":"","summary":"Delete the user account compartment for a given token or id","responses":{"200":{"$ref":"#/components/responses/simple"},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}}}}},"components":{"schemas":{"TokenOrId":{"type":"string","description":"Identifier in one of the two following format : - an id, often a number - token=xxx "},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"simple":{"description":"Success response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## GET /datamarts/{datamart\_id}/user\_account\_compartments

> Search user account compartments for a datamart

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/user_account_compartments":{"get":{"operationId":"findUserAccountCompartmentsForDatamart","deprecated":true,"tags":["Compartments"],"parameters":[{"schema":{"type":"integer","format":"int64"},"required":true,"explode":false,"in":"path","style":"simple","name":"datamart_id"},{"description":"select or not source datamarts selections","schema":{"type":"boolean"},"in":"query","required":false,"name":"with_source_datamarts","style":"form","explode":true}],"summary":"Search user account compartments for a datamart","description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"total":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/UserAccountCompartmentResource"}},"first_result":{"type":"integer"},"max_results":{"type":"integer"},"count":{"type":"integer"}},"required":["count","data","first_result","max_results","status","total"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}}}}},"components":{"schemas":{"UserAccountCompartmentResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"default":{"type":"boolean","default":false,"readOnly":false},"organisation_id":{"type":"string","readOnly":false},"token":{"type":"string","readOnly":false},"type":{"$ref":"#/components/schemas/UserAccountCompartmentType"},"name":{"type":"string","readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"image_uri":{"type":"string","readOnly":false}},"required":["archived","default","id","organisation_id","type"]},"UserAccountCompartmentType":{"type":"string","enum":["CUSTOM_COMPARTMENT_ID","NETWORK_USER_ID"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## POST /datamarts/{datamart\_id}/user\_account\_compartments

> Create user account compartment

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/user_account_compartments":{"post":{"summary":"Create user account compartment","parameters":[{"required":true,"name":"datamart_id","explode":false,"in":"path","style":"simple","schema":{"type":"integer","format":"int64"}}],"description":"","tags":["Compartments"],"deprecated":true,"operationId":"createUserAccountCompartmentAndAddToDatamart","requestBody":{"description":"The user account compartment to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAccountCompartmentResource"}}},"required":true},"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/UserAccountCompartmentResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}}}}},"components":{"schemas":{"UserAccountCompartmentResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"default":{"type":"boolean","default":false,"readOnly":false},"organisation_id":{"type":"string","readOnly":false},"token":{"type":"string","readOnly":false},"type":{"$ref":"#/components/schemas/UserAccountCompartmentType"},"name":{"type":"string","readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"image_uri":{"type":"string","readOnly":false}},"required":["archived","default","id","organisation_id","type"]},"UserAccountCompartmentType":{"type":"string","enum":["CUSTOM_COMPARTMENT_ID","NETWORK_USER_ID"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## GET /datamarts/{datamart\_id}/compartments/{token\_or\_id}

> Get user account compartment by id

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/compartments/{token_or_id}":{"get":{"summary":"Get user account compartment by id","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/UserAccountCompartmentDatamartSelectionResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"parameters":[{"style":"simple","required":true,"schema":{"type":"integer","format":"int64"},"explode":false,"name":"datamart_id","in":"path"},{"name":"token_or_id","style":"simple","in":"path","schema":{"$ref":"#/components/schemas/TokenOrId"},"required":true,"explode":false}],"tags":["Compartments"],"description":"","operationId":"findUserAccountCompartmentSelection"}}},"components":{"schemas":{"UserAccountCompartmentDatamartSelectionResource":{"type":"object","properties":{"type":{"$ref":"#/components/schemas/UserAccountCompartmentType"},"image_uri":{"type":"string","readOnly":false},"datamart_id":{"type":"string","readOnly":false},"token":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"compartment_id":{"type":"string","readOnly":false},"default":{"type":"boolean","default":false,"readOnly":false},"name":{"type":"string","readOnly":true}},"required":["compartment_id","datamart_id","default","id","name","token","type"]},"UserAccountCompartmentType":{"type":"string","enum":["CUSTOM_COMPARTMENT_ID","NETWORK_USER_ID"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]},"TokenOrId":{"type":"string","description":"Identifier in one of the two following format : - an id, often a number - token=xxx "}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## PUT /datamarts/{datamart\_id}/compartments/{token\_or\_id}

> Update user account compartment

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/compartments/{token_or_id}":{"put":{"parameters":[{"in":"path","schema":{"type":"integer","format":"int64"},"explode":false,"style":"simple","required":true,"name":"datamart_id"},{"name":"token_or_id","in":"path","required":true,"style":"simple","schema":{"$ref":"#/components/schemas/TokenOrId"},"explode":false}],"tags":["Compartments"],"requestBody":{"description":"The user account compartment to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAccountCompartmentDatamartSelectionResource"}}},"required":true},"operationId":"updateUserAccountCompartmentSelection","description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/UserAccountCompartmentDatamartSelectionResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"summary":"Update user account compartment"}}},"components":{"schemas":{"TokenOrId":{"type":"string","description":"Identifier in one of the two following format : - an id, often a number - token=xxx "},"UserAccountCompartmentDatamartSelectionResource":{"type":"object","properties":{"type":{"$ref":"#/components/schemas/UserAccountCompartmentType"},"image_uri":{"type":"string","readOnly":false},"datamart_id":{"type":"string","readOnly":false},"token":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"compartment_id":{"type":"string","readOnly":false},"default":{"type":"boolean","default":false,"readOnly":false},"name":{"type":"string","readOnly":true}},"required":["compartment_id","datamart_id","default","id","name","token","type"]},"UserAccountCompartmentType":{"type":"string","enum":["CUSTOM_COMPARTMENT_ID","NETWORK_USER_ID"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## DELETE /datamarts/{datamart\_id}/compartments/{token\_or\_id}

> Delete user account compartment

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/compartments/{token_or_id}":{"delete":{"description":"","tags":["Compartments"],"parameters":[{"required":true,"in":"path","style":"simple","name":"datamart_id","explode":false,"schema":{"type":"integer","format":"int64"}},{"in":"path","style":"simple","explode":false,"name":"token_or_id","required":true,"schema":{"$ref":"#/components/schemas/TokenOrId"}}],"operationId":"removeUserAccountCompartmentSelection","responses":{"200":{"$ref":"#/components/responses/simple"},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"summary":"Delete user account compartment"}}},"components":{"schemas":{"TokenOrId":{"type":"string","description":"Identifier in one of the two following format : - an id, often a number - token=xxx "},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"simple":{"description":"Success response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## GET /user\_account\_compartments

> Search the user account compartments associated with a given organization id and extra optional filters

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/user_account_compartments":{"get":{"description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"first_result":{"type":"integer"},"count":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/UserAccountCompartmentResource"}},"status":{"type":"string","enum":["ok"]},"total":{"type":"integer"},"max_results":{"type":"integer"}},"required":["count","data","first_result","max_results","status","total"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"operationId":"findUserAccountCompartments","summary":"Search the user account compartments associated with a given organization id and extra optional filters","tags":["Compartments"],"parameters":[{"style":"form","name":"organisation_id","required":true,"explode":true,"schema":{"type":"integer","format":"int64"},"in":"query"},{"required":false,"name":"datamart_id","explode":true,"in":"query","style":"form","schema":{"type":"integer","format":"int64"}},{"in":"query","explode":true,"required":false,"schema":{"type":"string"},"style":"form","name":"keywords"},{"required":false,"schema":{"type":"string"},"style":"form","name":"token","explode":true,"in":"query"},{"required":false,"in":"query","name":"include_archived","explode":true,"style":"form","schema":{"type":"boolean"}},{"description":"Fields used to order the result","style":"form","schema":{"type":"array","items":{"type":"string"}},"required":false,"in":"query","name":"order_by","explode":true},{"style":"form","description":"select or not source datamarts selections","in":"query","required":false,"name":"with_source_datamarts","schema":{"type":"boolean"},"explode":true},{"schema":{"type":"integer","format":"int32"},"style":"form","required":false,"in":"query","explode":true,"name":"first_result"},{"in":"query","required":false,"schema":{"type":"integer","format":"int32"},"explode":true,"style":"form","name":"max_results"}]}}},"components":{"schemas":{"UserAccountCompartmentResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"default":{"type":"boolean","default":false,"readOnly":false},"organisation_id":{"type":"string","readOnly":false},"token":{"type":"string","readOnly":false},"type":{"$ref":"#/components/schemas/UserAccountCompartmentType"},"name":{"type":"string","readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"image_uri":{"type":"string","readOnly":false}},"required":["archived","default","id","organisation_id","type"]},"UserAccountCompartmentType":{"type":"string","enum":["CUSTOM_COMPARTMENT_ID","NETWORK_USER_ID"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## POST /user\_account\_compartments

> Create the user account compartments associated with a given organization id

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Compartments","description":"Operations related to **Compartments**, the logical partitions used to namespace User Account identifiers, ensuring uniqueness by combining Compartment ID with User Account ID across different systems (CRM, loyalty programs, partner SSOs). Each Datamart has a **default compartment**, and additional compartments can be created to represent different places where users have accounts and profiles.\n\nRelevant documentation:\n- [Compartments](https://developer.mediarithmics.io/user-points/compartments)\n"}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/user_account_compartments":{"post":{"parameters":[{"name":"organisation_id","explode":true,"required":false,"style":"form","in":"query","schema":{"type":"string"}}],"requestBody":{"description":"The user account compartment input parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAccountCompartmentResource"}}},"required":true},"description":"","summary":"Create the user account compartments associated with a given organization id","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/UserAccountCompartmentResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"operationId":"createUserAccountCompartment","tags":["Compartments"]}}},"components":{"schemas":{"UserAccountCompartmentResource":{"type":"object","properties":{"id":{"type":"string","readOnly":true},"default":{"type":"boolean","default":false,"readOnly":false},"organisation_id":{"type":"string","readOnly":false},"token":{"type":"string","readOnly":false},"type":{"$ref":"#/components/schemas/UserAccountCompartmentType"},"name":{"type":"string","readOnly":false},"archived":{"type":"boolean","default":false,"readOnly":false},"image_uri":{"type":"string","readOnly":false}},"required":["archived","default","id","organisation_id","type"]},"UserAccountCompartmentType":{"type":"string","enum":["CUSTOM_COMPARTMENT_ID","NETWORK_USER_ID"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```


---

# 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://docs.mediarithmics.io/api-reference/datamart-management/compartments.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.
