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

# Create and Update attribute mappings

> Set your attribute mapping to begin configuring your catalog. You can update the mappings only if there are no SKUs present in the catalog.



## OpenAPI

````yaml pim post /api-product/v1/product/attribute/mapping
openapi: 3.0.0
info:
  title: Product Catalog
  description: >-
    As brands and retailers grow, they often expand their item catalogs,
    resulting in the need to enrich and manage more product (commonly referred
    to as item in fabric) data. fabric Product Catalog alleviates the burden of
    managing large amounts of item data by means of a central storage
    repository. fabric Product Catalog helps you with improved data quality,
    consistent customer experience, reduced time to market, easy integration
    with external systems, reduced management costs and risks, faster and easier
    updates, and easy scaling. You can create, import, enrich, validate,
    distribute, and manage complex item information, centrally. As a result, you
    deliver product experiences that drive sales through every channel. <br />
    <br /> During onboarding, you are given the necessary credentials to access
    Product Catalog - Copilot UI, APIs, or both. As a prerequisite, you create
    the items to be sold, identify their unique as well as common properties,
    and envision their organization into categories and sub categories. A basic
    workflow is: <br /> 1) **Create item attributes** using POST
    /api-product/v1/product/attribute/bulk. <br /> 2) **Update attribute
    mapping** using POST /api-product/v1/product/attribute/mapping <br /> 3)
    **Create Primary category** using the POST /api-category/v1/category to
    create the original organizational structure. <br /> 4) **Assign item
    attributes** to Primary category using POST
    /api-category/v1/category/item-attribute. <br /> 5) **Create items** using
    POST /api-product/v1/product/bulk/insert. <br /> 6) **Create Alternate
    category**, for distribution management and fulfilling various merchandising
    objectives.
  version: 2.0.0
  contact:
    email: support@fabric.inc
  license:
    name: fabric API License
    url: https://fabric.inc/api-license
servers:
  - url: https://live.copilot.fabric.inc
    description: Production
security: []
tags:
  - name: Category
    description: >-
      Categories (also called hierarchies or nodes) are hierarchical structures
      to organize items and services into intuitive groups. Organizing items in
      this way simplifies item discovery and lifecycle management. There are two
      types of categories - **Primary** and **Alternate**. They enable you to
      create, organize, and distribute item data.  - Primary category is the
      original catalog tree with nested levels of categories that place each
      item where it belongs, within a category. For example, `Computers` is a
      parent category with `Laptops` and `Desktops` as children categories, and
      `MacBook Pro` is an item within `Laptops`. This organization can be
      represented as Computers > Laptops > MacBook Pro.  - Alternate categories
      serve as alternate organizations of the Primary category. Their main
      purpose is distribution management by displaying items on your website
      based on separate browsing structure configurations you set to help you
      achieve various merchandizing objectives, such as organizational
      requirements, multi-regional assortments, multi-channel assortments, and
      collections. For example, a company that sells, repairs, and supports
      computers and related items and services will have a Primary category
      containing a full list of their SKUs. However, this Primary category is
      not granular enough to use on their storefront. Hence, multiple Alternate
      hierarchies are created to target specific shopper segment experiences.
      For laptop consumers they'll have one Alternate category, which lists all
      the laptops and PCs. For large businesses they'll have  another Alternate
      category, which lists all commercial laptops, PCs, printers, and servers.
      Both of the Alternate categories act as filters of the Primary category,
      tailored to the purpose of that merchandising strategy.  **Category**, a
      subset of Product Catalog endpoints, aims to simplify catalog management
      by letting you create, update, and get one or more categories, category
      attributes, and item attributes. In addition, you can add and update
      category sources, source exclusions, and item attribute conditions.  
      **Note**: The root name of primary category is PRIMARY, and it cannot be
      changed.
  - name: Product
    description: >-
      **Product**, a subset of Product Catalog endpoints, aims at making item
      management more efficient. They create, update, and get items, which may
      be individual items or collection of items (called bundles). Each item has
      a title, item ID, description, category, and assigned attributes. Multiple
      options of a given item become variants of that item. For example, a
      t-shirt with three sizes may have small, medium, and large variants. Each
      variant has its own item ID, attributes, and other data points. Each
      variant is nested under its parent item, allowing the different options to
      appear on the same product page. You can also create or update one or more
      item attributes and attribute groups.
  - name: Attributes
    description: >-
      Item attributes are the objective and factual descriptions of items that
      shoppers see when they browse through your site. Attributes may be
      technical specifications like size, weight, etc., design specifications
      like color, material, etc., or basic specifications like name,
      description, and ID. Ites attributes are crucial as they directly
      influence purchasing decisions. Complete and correct item information help
      shoppers narrow down their search and filter items with minimal cognitive
      load.
  - name: Bulk Import
    description: >-
      Set of endpoints to help bulk import of items, bundles, categories and
      attributes through CSV files
externalDocs:
  description: Find out more about Product Catalog
  url: /v3/product-catalog/user-guides/product-catalog/overview
paths:
  /api-product/v1/product/attribute/mapping:
    post:
      tags:
        - Attributes
      summary: Create and Update attribute mappings
      description: >-
        Set your attribute mapping to begin configuring your catalog. You can
        update the mappings only if there are no SKUs present in the catalog.
      operationId: modifyAttributeMappings
      parameters:
        - $ref: '#/components/parameters/xSiteContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AttributeMappingModify'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttributeMappingResponse'
        '400':
          description: Client error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientError'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerError'
      security:
        - authorization: []
components:
  parameters:
    xSiteContent:
      name: x-site-context
      in: header
      description: >-
        The `x-site-context` header is a JSON object that contains information
        about the source you wish to pull from. The mandatory `account` is the
        24 character identifier found in Copilot. The `channel` (Sales channel
        ID), `stage` (environment name), and `date` attributes can be used to
        further narrow the scope of your data source.
      required: true
      schema:
        type: string
        example: >-
          {"date": "2023-01-01T00:00:00.000Z", "channel": 12, "account":
          "1234abcd5678efgh9ijklmno","stage":"production"}
  schemas:
    AttributeMappingModify:
      type: object
      properties:
        mappings:
          type: array
          items:
            type: object
            properties:
              attributeId:
                description: Attribute ID
                type: string
                example: ATTR1234
              mapping:
                description: Attribute mapping
                type: string
                example: SKU
              name:
                description: Name of the attribute mapping
                type: string
              description:
                description: Description of the attribute mapping
                type: string
                example: Item SKU
              validation:
                $ref: '#/components/schemas/AttributeValidation'
              required:
                description: 'true: Mapping is mandatory <br /> false: Mapping is optional'
                type: boolean
    AttributeMappingResponse:
      type: object
      properties:
        attributeId:
          description: A 24-character system-generated attribute ID
          type: string
          example: 62e2ae29c3004a000950ad5f
        attribute:
          $ref: '#/components/schemas/AttributeResponse'
          description: >-
            Represents the mapped attributes. Only populated when
            `include.attribute` is true. <br /> **Note**: Not applicable for an
            attribute mapping  modify request
        mapping:
          description: Attribute mapping
          type: string
          example: SKU
        target:
          description: Returns attribute mapping for the specified target
          type: string
          example: ITEM
        name:
          description: Name of attribute mapping
          type: string
          example: Item SKU
        description:
          description: Description for attribute mapping
          type: string
          example: Item SKU
        required:
          description: 'true: Mapping is mandatory; <br /> false: mapping is optional'
          type: boolean
        validation:
          $ref: '#/components/schemas/AttributeValidation'
        createdOn:
          description: Time of attribute creation (UTC format)
          type: string
          format: date-time
          example: '2021-09-23T17:47:04.231Z'
        createdBy:
          description: User ID that created item attribute
          type: string
          example: broma0
        modifiedOn:
          description: Time of when the attribute was last modified
          type: string
          format: date-time
        modifiedBy:
          description: User ID that last modified item attribute
          type: string
          example: broma0
    ClientError:
      type: object
      properties:
        code:
          description: Error code for machine consumption
          type: string
          example: 400
        message:
          description: Human-readable error description
          type: string
          example: Client error
    ServerError:
      type: object
      properties:
        code:
          description: Error code
          type: string
          example: 500
        message:
          description: Human-readable error description
          type: string
          example: >-
            An internal error occurred. If the issue persists please contact
            support@fabric.inc.
    AttributeValidation:
      type: object
      properties:
        required:
          description: Indicates mandatory attribute
          type: boolean
        inheritable:
          description: >-
            true: Parent attributes are inherited to children items <br />
            false: Parent attributes are not inherited to children items.
          type: boolean
          example: true
        inverse:
          description: >-
            true: Inverts existing validation (example - requires that the
            validation does not pass) <br /> false: Follows existing validation
          type: boolean
          example: false
        unique:
          description: >-
            true: Value is unique across all items or categories <br /> false:
            Value is not unique
          type: boolean
        exact:
          description: Specified value must exactly match this value
          oneOf:
            - type: string
            - type: number
            - type: boolean
        attributeTypes:
          description: Attribute types
          type: array
          items:
            type: string
            enum:
              - TEXT
              - BOOLEAN
              - SERIAL
              - DECIMAL
              - INTEGER
              - ASSET
              - DATETIME
        contains:
          description: Specified value must contain this string
          type: string
        range:
          description: Specified range of values must be between this min and/or max
          type: object
          properties:
            min:
              description: Specified value must be greater than or equal to this value
              oneOf:
                - type: string
                - type: number
            max:
              description: Specified value must be less than or equal to this value
              oneOf:
                - type: string
                - type: number
        formula:
          description: JavaScript expression to determine if the value matches
          type: string
          example: value < 10 || value > 20
        oneOf:
          description: Match the value if it is one of these.
          oneOf:
            - type: array
              items:
                type: string
            - type: array
              items:
                type: number
            - type: array
              items:
                type: boolean
    AttributeResponse:
      type: object
      properties:
        id:
          description: Attribute ID
          type: string
        statuses:
          description: >-
            For 'attribute modify request', the `PIM` statuses (if applicable).
            For 'attribute search request', the statuses defined by the
            `include.status` request parameter.
          type: array
          items:
            $ref: '#/components/schemas/StatusResponse'
        files:
          description: Array of file's associated with an item
          type: array
          items:
            $ref: '#/components/schemas/FileResponse'
        name:
          description: Attribute name
          type: string
        description:
          description: Attribute description
          type: string
        locales:
          type: array
          items:
            type: object
            properties:
              locale:
                description: Locale identifier
                type: string
                example: fr-ca
              name:
                description: Localized string value
                type: string
                example: Un Nom Français
        localizable:
          description: >-
            true: attribute can be localized <br /> false: attribute cannot be
            localized
          type: boolean
        mapping:
          description: >-
            Attribute mapping. <br /> **Note**: Most attributes will not have a
            mapping, resulting in null value.
          nullable: true
          type: string
        type:
          description: Data type of the attribute
          type: string
          enum:
            - TEXT
            - BOOLEAN
            - SERIAL
            - DECIMAL
            - INTEGER
            - DATETIME
        serialStart:
          description: >-
            Conditionally required to indicate the starting value of `SERIAL`
            attribute type. When enabled, the subsequent attribute values
            increment by 1.
          type: number
        target:
          description: Indicates whether the attribute is for categories or items.
          type: string
          enum:
            - NODE
            - ITEM
        format:
          description: >-
            Attribute format. Currently used only for the attribute type
            `DATETIME`.
          type: string
          example: YYYY-MM-DD
        formula:
          description: >-
            JavaScript expression to dynamically  compute the attribute's value.
            <br /> **Note**: The type returned must match the attribute's type.
          type: string
          example: value < 10 || value > 20
        validation:
          $ref: '#/components/schemas/AttributeValidation'
        createdOn:
          description: Time of attribute creation
          type: string
          format: date-time
        createdBy:
          description: ID that created the attribute
          type: string
          example: broma0
        modifiedOn:
          description: Time when the attribute was last modified
          type: string
          format: date-time
        modifiedBy:
          description: User ID that last modified the attribute
          type: string
          example: broma0
    StatusResponse:
      type: object
      properties:
        code:
          description: Status code
          type: string
        type:
          description: Status type
          type: string
          enum:
            - ATTRIBUTE
            - ATTRIBUTE_VALUE
            - ITEM
            - BUNDLE
            - NODE
            - HIERARCHY
        source:
          description: Status source
          type: string
          enum:
            - PIM
            - WAM
        name:
          description: Status name
          type: string
        description:
          description: Status description
          type: string
        createdOn:
          description: Time of file creation
          type: string
          format: date-time
        createdBy:
          description: User ID that created the file
          type: string
          example: broma0
        modifiedOn:
          description: Time when file was last modified
          type: string
          format: date-time
        modifiedBy:
          type: string
          example: broma0
          description: User ID that last modified the file
    FileResponse:
      type: object
      properties:
        type:
          description: Status type
          type: string
          enum:
            - IMPORT
            - EXPORT
        name:
          description: File name
          type: string
        statuses:
          description: Current status of the file
          type: array
          items:
            $ref: '#/components/schemas/StatusResponse'
        progress:
          description: Import progress in percentage
          type: number
          example: 100
        createdOn:
          description: Time of file creation
          type: string
          format: date-time
        createdBy:
          description: User ID that created the file
          type: string
          example: broma0
        modifiedOn:
          description: Time when file was last modified
          type: string
          format: date-time
        modifiedBy:
          type: string
          example: broma0
          description: User ID that last modified the file
        secondsTakenToImport:
          description: >-
            Time taken to import the file (doesn't include the whole time for
            the full bulk import process).
          type: number
        secondsTakenToProcess:
          description: Time taken to process the file after the file was read
          type: number
  securitySchemes:
    authorization:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: S2S access token (JWT) from fabric Identity service (during Login)

````