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

# PM Create Product

## Introduction

The PM API provides functionality for users to create products automatically in Higg Product Module. The product is created using the system defaults for all aspects of the product except the bill of materials. Once the product is created via the API, the user can optionally go into the Product Module tool and manually set additional information about the product.

See [PM Data Dictionary](/data-dictionary/pm) for details about the parameters.

## Create Product

The product requires a name, product type, and product category. The GET `https://api-v2.production.higg.org/pm-api/product/category` endpoint returns a list of the product types and associated categories.

Optionally a product style/model number can be set--this field can be used to hold PLM ids, though note the user can edit this field directly in the Product Module interface.

```json Create theme={null}
{
    "name": "test API aug 20",
    "productType": "Apparel",
    "productCategory": "Dress",
    "modelNumber": "test5"
}
```

## Add Product Bill of Materials

The PM API can also be used to create a bill of materials for the product using example, custom, acquired, trims and packaging from MSI.  The MSI id, amount of the material, and unit of measure are sent via the API to create the bill of material. Optionally, the user can also send a part name for each material.

Note that trims and packaging are always sent as "units" for unit of measure.
Available units for materials are:
"kilograms"
"grams"
"milligram"
"pound"
"ounce"
Additionally, if the user set yields in MSI for the material, those user-defined material yields will be available.

```json Create BoM theme={null}
{
  "name": "test BoM 201",
  "productType": "Apparel",
  "productCategory": "Dress",
  "modelNumber": "test5"
  "packageMaterials":[{
    "_id": "samplepackage:PK012",
    "partName":"XYZ Package",
    "amount": 1,
    "measureUnit": "units"
  }],
  "trimMaterials":[{
    "_id": "sampletrim:TR001",
    "amount": 1,
    "measureUnit": "units"
  }],
  "baseMaterials":[{
    "_id": "TX0001",
    "amount": 1,
    "measureUnit": "kilograms"
  }],
  "customMaterials":[{
    "_id": "material:d68657bf-5c3e-472d-a4da-10c8d8e3614b",
    "amount": 1,
    "measureUnit": "kilograms"
  }]
}
```


## OpenAPI

````yaml api-reference/openapi/product-module-api.json POST /create
openapi: 3.0.0
info:
  title: product-module-api
  version: 1.0.0
servers:
  - url: https://api-v2.production.higg.org/pm-api/v1/product
    description: Production
  - url: https://api-v2.demo.higg.org/pm-api/v1/product
    description: Demo
security:
  - sec0: []
    sec1: []
paths:
  /create:
    post:
      operationId: CreateProduct
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMsiProductApiRequest'
        required: true
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartialMsiProductSearch'
components:
  schemas:
    CreateMsiProductApiRequest:
      properties:
        name:
          type: string
        productType:
          $ref: '#/components/schemas/MsiProductType'
        productCategory:
          type: object
        modelNumber:
          type: string
          nullable: true
        baseMaterials:
          items:
            $ref: '#/components/schemas/MaterialMsiProduct'
          type: array
          nullable: true
        customMaterials:
          items:
            $ref: '#/components/schemas/MaterialMsiProduct'
          type: array
          nullable: true
        packageMaterials:
          items:
            $ref: '#/components/schemas/TrimPackageMsiProduct'
          type: array
          nullable: true
        trimMaterials:
          items:
            $ref: '#/components/schemas/TrimPackageMsiProduct'
          type: array
          nullable: true
        certifications:
          items:
            type: string
          type: array
          nullable: true
        barcodes:
          items:
            type: string
          type: array
          nullable: true
      required:
        - name
        - productCategory
        - productType
      type: object
      additionalProperties: false
    PartialMsiProductSearch:
      properties:
        certifications:
          items:
            $ref: '#/components/schemas/CertificationSearchList'
          type: array
          nullable: true
        productNetWeight:
          type: number
          format: double
          nullable: true
        bomNetWeight:
          type: number
          format: double
          nullable: true
        scores:
          $ref: '#/components/schemas/MsiImpactsApi'
        scoresTotalAltProductCare:
          $ref: '#/components/schemas/MsiImpactsApi'
        billOfMaterialScores:
          $ref: '#/components/schemas/MsiImpactsApi'
        logisticsImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        packagingImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        productCareImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        endOfUseImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        retailImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        dosImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        totalPerUseImpacts:
          $ref: '#/components/schemas/MsiImpactsApi'
        materials:
          items:
            $ref: '#/components/schemas/PartialMsiProductMaterial'
          type: array
          nullable: true
      required:
        - billOfMaterialScores
        - scores
      type: object
      additionalProperties: false
    MsiProductType:
      enum:
        - Apparel
        - Footwear
        - HomeTextiles
        - Other
      type: string
    MaterialMsiProduct:
      properties:
        _id:
          type: string
        amount:
          type: number
          format: double
        partName:
          type: string
          nullable: true
        measureUnit:
          $ref: '#/components/schemas/MaterialMeasureUnit'
      required:
        - _id
        - amount
        - measureUnit
      type: object
      additionalProperties: false
    TrimPackageMsiProduct:
      properties:
        _id:
          type: string
        partName:
          type: string
          nullable: true
        amount:
          type: number
          format: double
      required:
        - _id
        - amount
      type: object
      additionalProperties: false
    CertificationSearchList:
      properties:
        _id:
          type: string
        assertionAuthorityName:
          type: string
        assertionStandardName:
          type: string
        certificateName:
          type: string
        assertionId:
          type: string
        assertionStandardId:
          type: string
        dateExpires:
          type: number
          format: double
        proofBody:
          type: string
          nullable: true
        dateIssued:
          type: number
          format: double
          nullable: true
        certificationFiles:
          items:
            type: string
          type: array
          nullable: true
      required:
        - _id
        - assertionAuthorityName
        - assertionId
        - assertionStandardId
        - assertionStandardName
        - certificateName
        - dateExpires
      type: object
      additionalProperties: false
    MsiImpactsApi:
      properties: {}
      type: object
      additionalProperties: false
    PartialMsiProductMaterial:
      properties:
        scores:
          $ref: '#/components/schemas/MsiImpactsApi'
        baseScores:
          $ref: '#/components/schemas/MsiImpactsApi'
      required:
        - baseScores
        - scores
      type: object
      additionalProperties: false
    MaterialMeasureUnit:
      enum:
        - kilograms
        - grams
        - milligram
        - pound
        - ounce
      type: string
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: x-api-key
    sec1:
      type: apiKey
      in: header
      name: x-developer-request-token

````