> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xenia.team/llms.txt
> Use this file to discover all available pages before exploring further.

# Bulk Upsert Sub-Location Attribute Values

> Sets or clears attribute values on sub-locations. Safe to re-run: each row replaces that sub-location's value for that attribute.

Up to **2000** rows per call.

**Sub-location:** exactly one of `subLocationExternalId` or `subLocationId`. **Attribute** (looked up on the sub-location's type): `attributeExternalId` → `attributeId` → `attributeKey` → `attributeName` (case-insensitive); supply at least one.

**Value** uses the same shape as location attribute values, and its `type` must match the attribute's type. For select attributes, `selected` accepts option ids **or option labels** (case-insensitive). Send `null` to clear a value; a required attribute cannot be cleared.

The call is all-or-nothing; the error message names the failing row (e.g. `values[2]`).

Requires the **Public API** workspace feature, `CAN_MANAGE_LOCATIONS`, and **Sub-Locations** enabled for the workspace (contact Xenia to enable it; until then every sub-location endpoint returns `404`).



## OpenAPI

````yaml POST /api/v1/mgt/enterprise/workspaces/{workspaceId}/sub-location-attribute-values/bulk-upsert
openapi: 3.1.0
info:
  title: Xenia Team API - Bulk Upsert Sub-Location Attribute Values
  description: >-
    Sets or clears attribute values on sub-locations. Safe to re-run: each row
    replaces that sub-location's value for that attribute.
  version: 1.0.0
servers:
  - url: https://api.xenia.team
security: []
paths:
  /api/v1/mgt/enterprise/workspaces/{workspaceId}/sub-location-attribute-values/bulk-upsert:
    post:
      tags:
        - Enterprise Sub-Locations
      summary: Bulk Upsert Sub-Location Attribute Values
      description: >-
        Sets or clears attribute values on sub-locations. Safe to re-run: each
        row replaces that sub-location's value for that attribute.


        Up to **2000** rows per call.


        **Sub-location:** exactly one of `subLocationExternalId` or
        `subLocationId`. **Attribute** (looked up on the sub-location's type):
        `attributeExternalId` → `attributeId` → `attributeKey` → `attributeName`
        (case-insensitive); supply at least one.


        **Value** uses the same shape as location attribute values, and its
        `type` must match the attribute's type. For select attributes,
        `selected` accepts option ids **or option labels** (case-insensitive).
        Send `null` to clear a value; a required attribute cannot be cleared.


        The call is all-or-nothing; the error message names the failing row
        (e.g. `values[2]`).


        Requires the **Public API** workspace feature, `CAN_MANAGE_LOCATIONS`,
        and **Sub-Locations** enabled for the workspace (contact Xenia to enable
        it; until then every sub-location endpoint returns `404`).
      parameters:
        - name: workspaceId
          in: path
          required: true
          description: >-
            UUID of the workspace. Must be the workspace your API key is bound
            to.
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                values:
                  type: array
                  minItems: 1
                  maxItems: 2000
                  items:
                    type: object
                    properties:
                      subLocationExternalId:
                        type: string
                        maxLength: 255
                      subLocationId:
                        type: string
                        format: uuid
                      attributeExternalId:
                        type: string
                        maxLength: 255
                      attributeId:
                        type: string
                        format: uuid
                      attributeKey:
                        type: string
                        maxLength: 64
                      attributeName:
                        type: string
                        maxLength: 120
                      value:
                        oneOf:
                          - type: object
                            properties:
                              type:
                                const: single_select
                              selected:
                                type: string
                                description: Option id or option label (case-insensitive).
                            required:
                              - type
                              - selected
                          - type: object
                            properties:
                              type:
                                const: multi_select
                              selected:
                                type: array
                                minItems: 1
                                items:
                                  type: string
                                description: Option ids or labels.
                            required:
                              - type
                              - selected
                          - type: object
                            properties:
                              type:
                                const: number
                              value:
                                type: number
                            required:
                              - type
                              - value
                          - type: object
                            properties:
                              type:
                                const: boolean
                              value:
                                type: boolean
                            required:
                              - type
                              - value
                          - type: object
                            properties:
                              type:
                                const: text
                              value:
                                type: string
                                minLength: 1
                                maxLength: 2000
                            required:
                              - type
                              - value
                          - type: object
                            properties:
                              type:
                                const: date
                              value:
                                type: string
                                format: date
                            required:
                              - type
                              - value
                          - type: 'null'
                            description: >-
                              Clears the value (not allowed for required
                              attributes).
                    required:
                      - value
              required:
                - values
            example:
              values:
                - subLocationExternalId: STORE-001-FRIDGE-1
                  attributeExternalId: ZONE
                  value:
                    type: single_select
                    selected: Back
                - subLocationExternalId: STORE-001-FRIDGE-1
                  attributeKey: capacity
                  value:
                    type: number
                    value: 40
                - subLocationExternalId: STORE-001-FRIDGE-2
                  attributeKey: zone
                  value: null
      responses:
        '200':
          description: One result per input row, in request order.
          content:
            application/json:
              example:
                data:
                  - subLocationId: 54fd6d64-4e76-4c9e-8171-f1a4f1c95bf9
                    attributeId: 8b1d2c3e-4f50-4a61-8b72-93a4b5c6d7e8
                  - subLocationId: 54fd6d64-4e76-4c9e-8171-f1a4f1c95bf9
                    attributeId: 9c2e3d4f-5061-4b72-9c83-a4b5c6d7e8f9
                extra_meta:
                  message: Sub-location values upserted
        '400':
          description: >-
            Bad Request - the value's `type` does not match the attribute, a
            select value names an unknown option, or `null` targets a required
            attribute.
        '401':
          description: >-
            Unauthorized - invalid client credentials, or the `workspaceId` in
            the path is not the workspace your key is bound to (`Client does not
            belong to this workspace`).
        '403':
          description: >-
            Forbidden - missing `CAN_MANAGE_LOCATIONS`, or the **Public API**
            feature is not enabled for the workspace.
        '404':
          description: Not Found - Sub-Locations is not enabled for this workspace.
        '422':
          description: >-
            Unprocessable Entity - body failed validation, the sub-location does
            not resolve in this workspace, or the attribute is not on the
            sub-location's type.
        '500':
          description: Internal Server Error.
      security:
        - clientKey: []
          clientSecret: []
components:
  securitySchemes:
    clientKey:
      type: apiKey
      in: header
      name: x-client-key
    clientSecret:
      type: apiKey
      in: header
      name: x-client-secret

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.