---
updatedAt: 2026-04-27T22:25:47.000Z
agentTools:
  projectIndex: https://zm.docs.digitax.tech/llms.txt
---

# Create item composition

Adds component items and quantities that make up an existing item. At least one supplied component must belong to the authenticated business, and an item cannot be a component of itself.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "DigiTax Zambia API Endpoints",
    "description": "DigiTax Zambia Public API",
    "version": "3",
    "termsOfService": "https://docs.digitax.tech/page/terms",
    "contact": {
      "name": "DigiTax",
      "url": "https://digitax.tech",
      "email": "support@namiri.tech"
    },
    "license": {
      "name": "Apache 2.0"
    }
  },
  "servers": [
    {
      "url": "https://api.digitax.tech/zm/v1",
      "description": "Production"
    }
  ],
  "paths": {
    "/items/item_composition": {
      "post": {
        "tags": [
          "Items"
        ],
        "summary": "Create item composition",
        "description": "Adds component items and quantities that make up an existing item. At least one supplied component must belong to the authenticated business, and an item cannot be a component of itself.",
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "item_id": {
                    "type": "string",
                    "description": "The DigiTax ID of the item whose composition is being set.",
                    "example": "item_01HC3J1VVVM05YCTS61G7V3KC6"
                  },
                  "composition": {
                    "type": "array",
                    "description": "The component items and their quantities.",
                    "items": {
                      "type": "object",
                      "required": [
                        "composition_item_id",
                        "quantity"
                      ],
                      "properties": {
                        "composition_item_id": {
                          "type": "string",
                          "description": "The DigiTax ID of a component item. It must not be the same as item_id.",
                          "example": "item_01J47XGVT004DFVCVFYN50SRSF"
                        },
                        "quantity": {
                          "type": "integer",
                          "description": "The quantity of this component item in the composition.",
                          "example": 30
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Item composition created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ItemComposition"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "description": "Describes a rejected request or processing error.",
        "required": [
          "message",
          "code"
        ],
        "properties": {
          "message": {
            "type": "string",
            "description": "A message explaining the error.",
            "example": "not a valid currency code"
          },
          "code": {
            "type": "string",
            "description": "The HTTP status code represented as a string.",
            "example": "400"
          },
          "metadata": {
            "type": "object",
            "description": "Additional error details, when available.",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "ItemComposition": {
        "type": "object",
        "description": "A component item and quantity used to make another item.",
        "required": [
          "id",
          "item_id",
          "composition_item_id",
          "composition_item_quantity",
          "business_id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The DigiTax ID of this item composition record.",
            "example": "itemcomposition_01J58XV8W45SHFZGKVERMB5XCA"
          },
          "item_id": {
            "type": "string",
            "description": "The DigiTax ID of the item being composed.",
            "example": "item_01HC3J1VVVM05YCTS61G7V3KC6"
          },
          "composition_item_id": {
            "type": "string",
            "description": "The DigiTax ID of a component item.",
            "example": "item_01J47XGVT004DFVCVFYN50SRSF"
          },
          "composition_item_quantity": {
            "type": "integer",
            "description": "The quantity of the component item used in the composed item.",
            "example": 30
          }
        }
      }
    },
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  }
}
```