# Items Assignments

Manage item assignments to segments

## Retrieving category trees for a customer segments

> \
> Retrieves category trees for the customer segments. Category trees are built based on only \`active\` segments.<br>

```json
{"openapi":"3.0.0","info":{"title":"Customer Segment Service","version":"0.0.1"},"tags":[{"name":"Items Assignments","description":"Manage item assignments to segments"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":["customersegment.segment_read_own"]}],"components":{"securitySchemes":{},"schemas":{"CategoryTreeResponse":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier of an existing category."},"code":{"type":"string","description":"Unique code of an existing category."},"name":{"type":"object","description":"Localized name of the category.","additionalProperties":{"type":"string"}},"localizedDescription":{"type":"object","description":"Localized description of the category.","additionalProperties":{"type":"string"}},"localizedSlug":{"type":"object","description":"Localized category name or code without diacritics for the URL.","additionalProperties":{"type":"string"}},"ecn":{"type":"array","description":"List of external category numbers (ECNs) unique for every category.","items":{"type":"string"}},"validity":{"type":"object","description":"Indicates the time frame in which the category is valid.","properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"}}},"position":{"type":"integer","description":"Category's position, set in relation to the categories on the same level (sharing the same parent) in the tree."},"published":{"type":"boolean","description":"Indicates whether the category has been published or not."},"isSegmentAssigned":{"type":"boolean","description":"Indicates if the category is assigned to any segment."},"subcategories":{"type":"array","items":{"type":"object","description":"Subcategories of this category."}}},"required":["id","code","name","isSegmentAssigned"]}},"Error":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Error message."},"resourceId":{"type":"string","description":"An ID of the resource which caused the error."},"details":{"type":"object","description":"Error details","properties":{"field":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"}}}}}},"responses":{"Common_response_Unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Common_response_Forbidden_403":{"description":"Access forbidden. The caller is not allowed to access this resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":{"acceptLanguage":{"schema":{"type":"string"},"in":"header","name":"Accept-Language","description":"The Accept-Language request HTTP header defines which languages the client is able to understand, and which locale variant is preferred. If empty, the default system language is assumed. It can be a priority list working as a fallback mechanism."},"legalEntityId":{"schema":{"type":"string"},"in":"query","name":"legalEntityId","required":false,"description":"The parameter is utilized for searching in relation to the legalEntityId. Parameter is only taken into account when customer is assigned to more than one Legal Entity.\n"},"siteCode":{"schema":{"type":"string"},"in":"query","name":"siteCode","required":false,"description":"The parameter is utilized for searching in relation to the siteCode. Only items will be returned which are assigned to segment from given siteCode.\n"}}},"paths":{"/customer-segment/{tenant}/segments/items/category-trees":{"get":{"summary":"Retrieving category trees for a customer segments","tags":["Items Assignments"],"description":"\nRetrieves category trees for the customer segments. Category trees are built based on only `active` segments.\n","responses":{"200":{"description":"Customer categories assignments were successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryTreeResponse"}}}},"401":{"$ref":"#/components/responses/Common_response_Unauthorized_401"},"403":{"$ref":"#/components/responses/Common_response_Forbidden_403"}},"operationId":"GET-customer-segment-retrieve-category-trees","parameters":[{"$ref":"#/components/parameters/acceptLanguage"},{"$ref":"#/components/parameters/legalEntityId"},{"$ref":"#/components/parameters/siteCode"}]}}}}
```

## Retrieving all items assignments for all customer segments

> \
> Retrieves all items assignments for all customer segments.<br>

```json
{"openapi":"3.0.0","info":{"title":"Customer Segment Service","version":"0.0.1"},"tags":[{"name":"Items Assignments","description":"Manage item assignments to segments"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":["customersegment.segment_read_own","customersegment.segment_read"]}],"components":{"securitySchemes":{},"schemas":{"ItemAssignmentResponse":{"allOf":[{"type":"object","properties":{"segmentId":{"type":"string","description":"Unique identifier of the customer segment."},"item":{"properties":{"id":{"type":"string","description":"Unique identifier of an existing product/category."},"code":{"type":"string","description":"Unique code of an existing product/category."},"name":{"type":"object","description":"Localized name of the product/category","additionalProperties":{"type":"string"}}}},"type":{"type":"string","description":"Determines whether item is a `PRODUCT` or `CATEGORY`","enum":["PRODUCT","CATEGORY"]}}},{"$ref":"#/components/schemas/ItemAssignmentUpsert"},{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/MetadataResponse"}}}]},"ItemAssignmentUpsert":{"type":"object","description":"","allOf":[{"type":"object","properties":{"mixins":{"type":"object","description":"A key-value map of additional attributes.","additionalProperties":true}}},{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/MetadataUpdate"}}}]},"MetadataUpdate":{"allOf":[{"type":"object","properties":{"version":{"type":"integer","description":"The document version number."}}},{"$ref":"#/components/schemas/MetadataCreate"}]},"MetadataCreate":{"type":"object","properties":{"mixins":{"type":"object","description":"A key-value map, where key is a mixin name and value is a link to the mixin schema.","additionalProperties":true}}},"MetadataResponse":{"allOf":[{"type":"object","properties":{"createdAt":{"description":"The creation date.","type":"string","format":"date-time"},"modifiedAt":{"description":"The modification date.","type":"string","format":"date-time"}}},{"$ref":"#/components/schemas/MetadataUpdate"}]},"Error":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Error message."},"resourceId":{"type":"string","description":"An ID of the resource which caused the error."},"details":{"type":"object","description":"Error details","properties":{"field":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"}}}}}},"responses":{"Common_response_Unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Common_response_Forbidden_403":{"description":"Access forbidden. The caller is not allowed to access this resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":{"qParam":{"in":"query","name":"q","description":"A standard query parameter is used to search for specific values. \n\nSee: [Standard practises - Query parameter](https://developer.emporix.io/api-references/standard-practices/q-param)\n","schema":{"type":"string"}},"pageSize":{"schema":{"type":"string"},"in":"query","name":"pageSize","description":"The number of documents to be retrieved per page."},"pageNumber":{"schema":{"type":"string"},"in":"query","name":"pageNumber","description":"The page number to be retrieved. The size of the pages should be specified by the pageSize parameter."},"sort":{"schema":{"type":"string"},"in":"query","name":"sort","description":"List of properties used to sort the results, separated by colons."},"fields":{"schema":{"type":"string"},"in":"query","name":"fields","description":"Fields to be returned in the response."},"xTotalCount":{"schema":{"type":"boolean"},"in":"header","name":"X-Total-Count","description":"Flag indicating whether the total number of retrieved results should be returned."},"acceptLanguage":{"schema":{"type":"string"},"in":"header","name":"Accept-Language","description":"The Accept-Language request HTTP header defines which languages the client is able to understand, and which locale variant is preferred. If empty, the default system language is assumed. It can be a priority list working as a fallback mechanism."},"legalEntityId":{"schema":{"type":"string"},"in":"query","name":"legalEntityId","required":false,"description":"The parameter is utilized for searching in relation to the legalEntityId. Parameter is only taken into account when customer is assigned to more than one Legal Entity.\n"},"siteCode":{"schema":{"type":"string"},"in":"query","name":"siteCode","required":false,"description":"The parameter is utilized for searching in relation to the siteCode. Only items will be returned which are assigned to segment from given siteCode.\n"},"onlyActive":{"schema":{"type":"boolean","default":false},"in":"query","name":"onlyActive","required":false,"description":"The parameter is utilized for filtering items which belong only to `active` segments. The parameter is always `true` for users with `customersegment.segment_read_own` scope.\n"}}},"paths":{"/customer-segment/{tenant}/segments/items":{"get":{"summary":"Retrieving all items assignments for all customer segments","tags":["Items Assignments"],"description":"\nRetrieves all items assignments for all customer segments.\n","responses":{"200":{"description":"Customer items assignments were successfully retrieved.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ItemAssignmentResponse"}}}}},"401":{"$ref":"#/components/responses/Common_response_Unauthorized_401"},"403":{"$ref":"#/components/responses/Common_response_Forbidden_403"}},"operationId":"GET-customer-segment-retrieve-segments-items","parameters":[{"$ref":"#/components/parameters/qParam"},{"$ref":"#/components/parameters/pageSize"},{"$ref":"#/components/parameters/pageNumber"},{"$ref":"#/components/parameters/sort"},{"$ref":"#/components/parameters/fields"},{"$ref":"#/components/parameters/xTotalCount"},{"$ref":"#/components/parameters/acceptLanguage"},{"$ref":"#/components/parameters/legalEntityId"},{"$ref":"#/components/parameters/siteCode"},{"$ref":"#/components/parameters/onlyActive"}]}}}}
```

## Retrieving all item assignments for a customer segment

> \
> Retrieves all item assignments for a given customer segment.<br>

```json
{"openapi":"3.0.0","info":{"title":"Customer Segment Service","version":"0.0.1"},"tags":[{"name":"Items Assignments","description":"Manage item assignments to segments"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":["customersegment.segment_read","customersegment.segment_read_own"]}],"components":{"securitySchemes":{},"schemas":{"ItemAssignmentResponse":{"allOf":[{"type":"object","properties":{"segmentId":{"type":"string","description":"Unique identifier of the customer segment."},"item":{"properties":{"id":{"type":"string","description":"Unique identifier of an existing product/category."},"code":{"type":"string","description":"Unique code of an existing product/category."},"name":{"type":"object","description":"Localized name of the product/category","additionalProperties":{"type":"string"}}}},"type":{"type":"string","description":"Determines whether item is a `PRODUCT` or `CATEGORY`","enum":["PRODUCT","CATEGORY"]}}},{"$ref":"#/components/schemas/ItemAssignmentUpsert"},{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/MetadataResponse"}}}]},"ItemAssignmentUpsert":{"type":"object","description":"","allOf":[{"type":"object","properties":{"mixins":{"type":"object","description":"A key-value map of additional attributes.","additionalProperties":true}}},{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/MetadataUpdate"}}}]},"MetadataUpdate":{"allOf":[{"type":"object","properties":{"version":{"type":"integer","description":"The document version number."}}},{"$ref":"#/components/schemas/MetadataCreate"}]},"MetadataCreate":{"type":"object","properties":{"mixins":{"type":"object","description":"A key-value map, where key is a mixin name and value is a link to the mixin schema.","additionalProperties":true}}},"MetadataResponse":{"allOf":[{"type":"object","properties":{"createdAt":{"description":"The creation date.","type":"string","format":"date-time"},"modifiedAt":{"description":"The modification date.","type":"string","format":"date-time"}}},{"$ref":"#/components/schemas/MetadataUpdate"}]},"Error":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Error message."},"resourceId":{"type":"string","description":"An ID of the resource which caused the error."},"details":{"type":"object","description":"Error details","properties":{"field":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"}}}}}},"responses":{"Common_response_Unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Common_response_Forbidden_403":{"description":"Access forbidden. The caller is not allowed to access this resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":{"qParam":{"in":"query","name":"q","description":"A standard query parameter is used to search for specific values. \n\nSee: [Standard practises - Query parameter](https://developer.emporix.io/api-references/standard-practices/q-param)\n","schema":{"type":"string"}},"pageSize":{"schema":{"type":"string"},"in":"query","name":"pageSize","description":"The number of documents to be retrieved per page."},"pageNumber":{"schema":{"type":"string"},"in":"query","name":"pageNumber","description":"The page number to be retrieved. The size of the pages should be specified by the pageSize parameter."},"sort":{"schema":{"type":"string"},"in":"query","name":"sort","description":"List of properties used to sort the results, separated by colons."},"fields":{"schema":{"type":"string"},"in":"query","name":"fields","description":"Fields to be returned in the response."},"xTotalCount":{"schema":{"type":"boolean"},"in":"header","name":"X-Total-Count","description":"Flag indicating whether the total number of retrieved results should be returned."},"acceptLanguage":{"schema":{"type":"string"},"in":"header","name":"Accept-Language","description":"The Accept-Language request HTTP header defines which languages the client is able to understand, and which locale variant is preferred. If empty, the default system language is assumed. It can be a priority list working as a fallback mechanism."},"legalEntityId":{"schema":{"type":"string"},"in":"query","name":"legalEntityId","required":false,"description":"The parameter is utilized for searching in relation to the legalEntityId. Parameter is only taken into account when customer is assigned to more than one Legal Entity.\n"}}},"paths":{"/customer-segment/{tenant}/segments/{segmentId}/items":{"get":{"summary":"Retrieving all item assignments for a customer segment","tags":["Items Assignments"],"description":"\nRetrieves all item assignments for a given customer segment.\n","responses":{"200":{"description":"Customer segment assignments were successfully retrieved.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ItemAssignmentResponse"}}}}},"401":{"$ref":"#/components/responses/Common_response_Unauthorized_401"},"403":{"$ref":"#/components/responses/Common_response_Forbidden_403"}},"operationId":"GET-customer-segment-retrieve-segment-items","parameters":[{"$ref":"#/components/parameters/qParam"},{"$ref":"#/components/parameters/pageSize"},{"$ref":"#/components/parameters/pageNumber"},{"$ref":"#/components/parameters/sort"},{"$ref":"#/components/parameters/fields"},{"$ref":"#/components/parameters/xTotalCount"},{"$ref":"#/components/parameters/acceptLanguage"},{"$ref":"#/components/parameters/legalEntityId"}]}}}}
```

## Retrieving all item assignments for a customer segment

> \
> Retrieves all item assignments for a given customer segment.<br>

```json
{"openapi":"3.0.0","info":{"title":"Customer Segment Service","version":"0.0.1"},"tags":[{"name":"Items Assignments","description":"Manage item assignments to segments"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":["customersegment.segment_read","customersegment.segment_read_own"]}],"components":{"securitySchemes":{},"schemas":{"SegmentsSearch":{"type":"object","properties":{"q":{"type":"string","description":"A standard query parameter is used to search for specific values. \n\nSee: [Standard practises - Query parameter](https://developer.emporix.io/api-references/standard-practices/q-param/)\n"}}},"ItemAssignmentResponse":{"allOf":[{"type":"object","properties":{"segmentId":{"type":"string","description":"Unique identifier of the customer segment."},"item":{"properties":{"id":{"type":"string","description":"Unique identifier of an existing product/category."},"code":{"type":"string","description":"Unique code of an existing product/category."},"name":{"type":"object","description":"Localized name of the product/category","additionalProperties":{"type":"string"}}}},"type":{"type":"string","description":"Determines whether item is a `PRODUCT` or `CATEGORY`","enum":["PRODUCT","CATEGORY"]}}},{"$ref":"#/components/schemas/ItemAssignmentUpsert"},{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/MetadataResponse"}}}]},"ItemAssignmentUpsert":{"type":"object","description":"","allOf":[{"type":"object","properties":{"mixins":{"type":"object","description":"A key-value map of additional attributes.","additionalProperties":true}}},{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/MetadataUpdate"}}}]},"MetadataUpdate":{"allOf":[{"type":"object","properties":{"version":{"type":"integer","description":"The document version number."}}},{"$ref":"#/components/schemas/MetadataCreate"}]},"MetadataCreate":{"type":"object","properties":{"mixins":{"type":"object","description":"A key-value map, where key is a mixin name and value is a link to the mixin schema.","additionalProperties":true}}},"MetadataResponse":{"allOf":[{"type":"object","properties":{"createdAt":{"description":"The creation date.","type":"string","format":"date-time"},"modifiedAt":{"description":"The modification date.","type":"string","format":"date-time"}}},{"$ref":"#/components/schemas/MetadataUpdate"}]},"Error":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Error message."},"resourceId":{"type":"string","description":"An ID of the resource which caused the error."},"details":{"type":"object","description":"Error details","properties":{"field":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"}}}}}},"responses":{"Common_response_Unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Common_response_Forbidden_403":{"description":"Access forbidden. The caller is not allowed to access this resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":{"pageSize":{"schema":{"type":"string"},"in":"query","name":"pageSize","description":"The number of documents to be retrieved per page."},"pageNumber":{"schema":{"type":"string"},"in":"query","name":"pageNumber","description":"The page number to be retrieved. The size of the pages should be specified by the pageSize parameter."},"sort":{"schema":{"type":"string"},"in":"query","name":"sort","description":"List of properties used to sort the results, separated by colons."},"fields":{"schema":{"type":"string"},"in":"query","name":"fields","description":"Fields to be returned in the response."},"xTotalCount":{"schema":{"type":"boolean"},"in":"header","name":"X-Total-Count","description":"Flag indicating whether the total number of retrieved results should be returned."},"acceptLanguage":{"schema":{"type":"string"},"in":"header","name":"Accept-Language","description":"The Accept-Language request HTTP header defines which languages the client is able to understand, and which locale variant is preferred. If empty, the default system language is assumed. It can be a priority list working as a fallback mechanism."},"legalEntityId":{"schema":{"type":"string"},"in":"query","name":"legalEntityId","required":false,"description":"The parameter is utilized for searching in relation to the legalEntityId. Parameter is only taken into account when customer is assigned to more than one Legal Entity.\n"}}},"paths":{"/customer-segment/{tenant}/segments/{segmentId}/items/search":{"post":{"summary":"Retrieving all item assignments for a customer segment","tags":["Items Assignments"],"description":"\nRetrieves all item assignments for a given customer segment.\n","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentsSearch"}}}},"responses":{"200":{"description":"Customer segment assignments were successfully retrieved.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ItemAssignmentResponse"}}}}},"401":{"$ref":"#/components/responses/Common_response_Unauthorized_401"},"403":{"$ref":"#/components/responses/Common_response_Forbidden_403"}},"operationId":"POST-customer-segment-search-items","parameters":[{"$ref":"#/components/parameters/pageSize"},{"$ref":"#/components/parameters/pageNumber"},{"$ref":"#/components/parameters/sort"},{"$ref":"#/components/parameters/fields"},{"$ref":"#/components/parameters/xTotalCount"},{"$ref":"#/components/parameters/acceptLanguage"},{"$ref":"#/components/parameters/legalEntityId"}]}}}}
```

## Retrieving an item assignment

> \
> Retrieves an item assignment by specified ID for a given customer segment.<br>

```json
{"openapi":"3.0.0","info":{"title":"Customer Segment Service","version":"0.0.1"},"tags":[{"name":"Items Assignments","description":"Manage item assignments to segments"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":["customersegment.segment_read","customersegment.segment_read_own"]}],"components":{"securitySchemes":{},"schemas":{"ItemAssignmentResponse":{"allOf":[{"type":"object","properties":{"segmentId":{"type":"string","description":"Unique identifier of the customer segment."},"item":{"properties":{"id":{"type":"string","description":"Unique identifier of an existing product/category."},"code":{"type":"string","description":"Unique code of an existing product/category."},"name":{"type":"object","description":"Localized name of the product/category","additionalProperties":{"type":"string"}}}},"type":{"type":"string","description":"Determines whether item is a `PRODUCT` or `CATEGORY`","enum":["PRODUCT","CATEGORY"]}}},{"$ref":"#/components/schemas/ItemAssignmentUpsert"},{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/MetadataResponse"}}}]},"ItemAssignmentUpsert":{"type":"object","description":"","allOf":[{"type":"object","properties":{"mixins":{"type":"object","description":"A key-value map of additional attributes.","additionalProperties":true}}},{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/MetadataUpdate"}}}]},"MetadataUpdate":{"allOf":[{"type":"object","properties":{"version":{"type":"integer","description":"The document version number."}}},{"$ref":"#/components/schemas/MetadataCreate"}]},"MetadataCreate":{"type":"object","properties":{"mixins":{"type":"object","description":"A key-value map, where key is a mixin name and value is a link to the mixin schema.","additionalProperties":true}}},"MetadataResponse":{"allOf":[{"type":"object","properties":{"createdAt":{"description":"The creation date.","type":"string","format":"date-time"},"modifiedAt":{"description":"The modification date.","type":"string","format":"date-time"}}},{"$ref":"#/components/schemas/MetadataUpdate"}]},"Error":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Error message."},"resourceId":{"type":"string","description":"An ID of the resource which caused the error."},"details":{"type":"object","description":"Error details","properties":{"field":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"}}}}}},"responses":{"Common_response_Unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Common_response_Forbidden_403":{"description":"Access forbidden. The caller is not allowed to access this resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Common_response_NotFound_404":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":{"fields":{"schema":{"type":"string"},"in":"query","name":"fields","description":"Fields to be returned in the response."},"acceptLanguage":{"schema":{"type":"string"},"in":"header","name":"Accept-Language","description":"The Accept-Language request HTTP header defines which languages the client is able to understand, and which locale variant is preferred. If empty, the default system language is assumed. It can be a priority list working as a fallback mechanism."},"legalEntityId":{"schema":{"type":"string"},"in":"query","name":"legalEntityId","required":false,"description":"The parameter is utilized for searching in relation to the legalEntityId. Parameter is only taken into account when customer is assigned to more than one Legal Entity.\n"}}},"paths":{"/customer-segment/{tenant}/segments/{segmentId}/items/{type}/{itemId}":{"get":{"summary":"Retrieving an item assignment","tags":["Items Assignments"],"description":"\nRetrieves an item assignment by specified ID for a given customer segment.\n","responses":{"200":{"description":"Customer segment item assignment was successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemAssignmentResponse"}}}},"401":{"$ref":"#/components/responses/Common_response_Unauthorized_401"},"403":{"$ref":"#/components/responses/Common_response_Forbidden_403"},"404":{"$ref":"#/components/responses/Common_response_NotFound_404"}},"operationId":"GET-customer-segment-retrieve-item","parameters":[{"$ref":"#/components/parameters/fields"},{"$ref":"#/components/parameters/acceptLanguage"},{"$ref":"#/components/parameters/legalEntityId"}]}}}}
```

## Updating an item assignment

> \
> Performs \`UPSERT\` operation. Updates an item assignment to a customer segment. A new item assignment is created if it's not present in the system.<br>

```json
{"openapi":"3.0.0","info":{"title":"Customer Segment Service","version":"0.0.1"},"tags":[{"name":"Items Assignments","description":"Manage item assignments to segments"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":["customersegment.segment_manage"]}],"components":{"securitySchemes":{},"schemas":{"ItemAssignmentUpsert":{"type":"object","description":"","allOf":[{"type":"object","properties":{"mixins":{"type":"object","description":"A key-value map of additional attributes.","additionalProperties":true}}},{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/MetadataUpdate"}}}]},"MetadataUpdate":{"allOf":[{"type":"object","properties":{"version":{"type":"integer","description":"The document version number."}}},{"$ref":"#/components/schemas/MetadataCreate"}]},"MetadataCreate":{"type":"object","properties":{"mixins":{"type":"object","description":"A key-value map, where key is a mixin name and value is a link to the mixin schema.","additionalProperties":true}}},"Error":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Error message."},"resourceId":{"type":"string","description":"An ID of the resource which caused the error."},"details":{"type":"object","description":"Error details","properties":{"field":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"}}}}}},"responses":{"Common_response_BadRequest_400":{"description":"Bad request due to validation, incorrect parameters, etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Common_response_Unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Common_response_Forbidden_403":{"description":"Access forbidden. The caller is not allowed to access this resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Common_response_Conflict_409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/customer-segment/{tenant}/segments/{segmentId}/items/{type}/{itemId}":{"put":{"summary":"Updating an item assignment","tags":["Items Assignments"],"operationId":"PUT-customer-segment-update-item","description":"\nPerforms `UPSERT` operation. Updates an item assignment to a customer segment. A new item assignment is created if it's not present in the system.\n","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ItemAssignmentUpsert"}}}},"responses":{"201":{"description":"A new assignment was successfully created."},"204":{"description":"Item assignment was successfully updated."},"400":{"$ref":"#/components/responses/Common_response_BadRequest_400"},"401":{"$ref":"#/components/responses/Common_response_Unauthorized_401"},"403":{"$ref":"#/components/responses/Common_response_Forbidden_403"},"409":{"$ref":"#/components/responses/Common_response_Conflict_409"}}}}}}
```

## Removing an assignment

> \
> Removes an item assignment.<br>

```json
{"openapi":"3.0.0","info":{"title":"Customer Segment Service","version":"0.0.1"},"tags":[{"name":"Items Assignments","description":"Manage item assignments to segments"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":["customersegment.segment_manage"]}],"components":{"securitySchemes":{},"responses":{"Common_response_Unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Common_response_Forbidden_403":{"description":"Access forbidden. The caller is not allowed to access this resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Error message."},"resourceId":{"type":"string","description":"An ID of the resource which caused the error."},"details":{"type":"object","description":"Error details","properties":{"field":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"}}}}}}},"paths":{"/customer-segment/{tenant}/segments/{segmentId}/items/{type}/{itemId}":{"delete":{"summary":"Removing an assignment","tags":["Items Assignments"],"operationId":"DELETE-customer-segment-remove-item","description":"\nRemoves an item assignment.\n","responses":{"204":{"description":"Item assignment was successfully removed."},"401":{"$ref":"#/components/responses/Common_response_Unauthorized_401"},"403":{"$ref":"#/components/responses/Common_response_Forbidden_403"}}}}}}
```

## Updating item assignments to a customer segment in bulk

> \
> Performs \`UPSERT\` operation. Updates multiple item assignments to a customer segments. The maximum batch size is 200.<br>

```json
{"openapi":"3.0.0","info":{"title":"Customer Segment Service","version":"0.0.1"},"tags":[{"name":"Items Assignments","description":"Manage item assignments to segments"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":["customersegment.segment_manage"]}],"components":{"securitySchemes":{},"schemas":{"ItemAssignmentUpsertBulk":{"allOf":[{"$ref":"#/components/schemas/ItemAssignmentUpsert"}],"properties":{"id":{"type":"string","description":"Unique identifier of an existing product/category (itemId)."}},"required":["id"]},"ItemAssignmentUpsert":{"type":"object","description":"","allOf":[{"type":"object","properties":{"mixins":{"type":"object","description":"A key-value map of additional attributes.","additionalProperties":true}}},{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/MetadataUpdate"}}}]},"MetadataUpdate":{"allOf":[{"type":"object","properties":{"version":{"type":"integer","description":"The document version number."}}},{"$ref":"#/components/schemas/MetadataCreate"}]},"MetadataCreate":{"type":"object","properties":{"mixins":{"type":"object","description":"A key-value map, where key is a mixin name and value is a link to the mixin schema.","additionalProperties":true}}},"BulkAssignmentResponse":{"type":"object","properties":{"index":{"type":"integer","description":"Index of the processed item, matching the item position in request body.\n"},"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status description."},"message":{"type":"string","description":"Error message."}}},"Error":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Error message."},"resourceId":{"type":"string","description":"An ID of the resource which caused the error."},"details":{"type":"object","description":"Error details","properties":{"field":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"}}}}}},"responses":{"Common_response_BadRequest_400":{"description":"Bad request due to validation, incorrect parameters, etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Common_response_Unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Common_response_Forbidden_403":{"description":"Access forbidden. The caller is not allowed to access this resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/customer-segment/{tenant}/segments/{segmentId}/items/{type}/bulk":{"put":{"summary":"Updating item assignments to a customer segment in bulk","tags":["Items Assignments"],"operationId":"PUT-customer-segment-update-items-bulk","description":"\nPerforms `UPSERT` operation. Updates multiple item assignments to a customer segments. The maximum batch size is 200.\n","requestBody":{"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ItemAssignmentUpsertBulk"}}}}},"responses":{"207":{"description":"Multi-status response.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BulkAssignmentResponse"}}}}},"400":{"$ref":"#/components/responses/Common_response_BadRequest_400"},"401":{"$ref":"#/components/responses/Common_response_Unauthorized_401"},"403":{"$ref":"#/components/responses/Common_response_Forbidden_403"}}}}}}
```

## Deleting item assignments to a customer segment in bulk

> \
> Removes multiple customer segments item assignments. The maximum batch size is 200.\
> \
> \* The IDs of items should be defined in the request body as an array of strings.\
> Example: \`\["firstItemId", "secondItemId", "thirdItemId"]\`<br>

```json
{"openapi":"3.0.0","info":{"title":"Customer Segment Service","version":"0.0.1"},"tags":[{"name":"Items Assignments","description":"Manage item assignments to segments"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":["customersegment.segment_manage"]}],"components":{"securitySchemes":{},"schemas":{"BulkAssignmentResponse":{"type":"object","properties":{"index":{"type":"integer","description":"Index of the processed item, matching the item position in request body.\n"},"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status description."},"message":{"type":"string","description":"Error message."}}},"Error":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code."},"status":{"type":"string","description":"HTTP Status."},"message":{"type":"string","description":"Error message."},"resourceId":{"type":"string","description":"An ID of the resource which caused the error."},"details":{"type":"object","description":"Error details","properties":{"field":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"}}}}}},"responses":{"Common_response_BadRequest_400":{"description":"Bad request due to validation, incorrect parameters, etc.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Common_response_Unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"Common_response_Forbidden_403":{"description":"Access forbidden. The caller is not allowed to access this resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/customer-segment/{tenant}/segments/{segmentId}/items/{type}/bulk":{"delete":{"summary":"Deleting item assignments to a customer segment in bulk","tags":["Items Assignments"],"operationId":"DELETE-customer-segment-remove-items-bulk","description":"\nRemoves multiple customer segments item assignments. The maximum batch size is 200.\n\n* The IDs of items should be defined in the request body as an array of strings.\nExample: `[\"firstItemId\", \"secondItemId\", \"thirdItemId\"]`\n","responses":{"207":{"description":"Multi-status response.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BulkAssignmentResponse"}}}}},"400":{"$ref":"#/components/responses/Common_response_BadRequest_400"},"401":{"$ref":"#/components/responses/Common_response_Unauthorized_401"},"403":{"$ref":"#/components/responses/Common_response_Forbidden_403"}}}}}}
```


---

# Agent Instructions: 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:

```
GET https://developer.emporix.io/api-references/api-guides/companies-and-customers/customer-segments/api-reference/items-assignments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
