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

# Commission Consume

> Manage restricted consumption of goods in a supply chain. Track goods from origin to consumption.

The **Commission Consume** module is built to allow you to manage restricted consumption of goods in a supply chain. Track goods from origin to consumption.

## Overview

The Commission Consume module provides a robust system for tracking the lifecycle of products in a supply chain, from their initial commissioning to final consumption. This is particularly useful for industries where product traceability and consumption verification are critical, such as:

* Seafood and perishable goods
* Controlled substances
* High-value items
* Regulated products

## Key Features

### Commissioning Products

* Record the initial entry of products into the supply chain
* Capture essential metadata including:
  * Product identifier
  * Origin information
  * Timestamp
  * Quantity and units
  * Registered consumers

### Consumption Tracking

* Mark products as consumed by registered entities
* Record consumption details including:
  * Date and time of consumption
  * Consuming entity information
  * Location of consumption
  * Quantity consumed
  * Purpose of consumption

## Use Cases

### Seafood Supply Chain

1. A seafood processor commissions a batch of fish into the system
2. The batch is tracked through distribution channels
3. Restaurants or retailers mark portions as consumed
4. Full traceability is maintained from ocean to plate

### Controlled Substances

1. Pharmaceutical manufacturers commission medication batches
2. Distributors track inventory movements
3. Healthcare facilities record consumption
4. Regulatory compliance is maintained throughout

## Implementation Guidance

### Commissioning Products

In your application, log when a product has been commissioned and should be tracked. The `identifier` could be one generated by the TrustStack SDK for you (as per usage of our `event` module) or a custom identifier.

The `consumers` field is an array of registered consumer identifiers. These are the entities that are allowed to consume the product, and could be your user IDs managed by your application.

```typescript theme={null}
import {TrustStack} from "@truststack/sdk";

const truststack = new TrustStack({
  apiKey: "your-api-key",
});

await truststack.custody.commission({
  // The identifier of the product
  identifier: "your-product-identifier",
  // The quantity of the product
  quantity: 1,
  // The unit of the product
  unit: "EA",
  // The registered consumers of the product
  consumers: ["ABC123", "DEF45"],
});
```

### Consuming Products

When a product is consumed, log the consumption. This will record the consumption details and update the product's status to consumed.
The TrustStack SDK will handle the verification that the consuming entity is registered to consume the product, and the product has not already been consumed.

```typescript theme={null}
import {TrustStack} from "@truststack/sdk";

const truststack = new TrustStack({
  apiKey: "your-api-key",
});

const consumption = await truststack.custody.consume({
  identifier: "your-product-identifier",
  consumer: "ABC123",
});

console.log(consumption);
```

```json theme={null}
{
  "identifier": "your-product-identifier",
  "consumer": "ABC123",
  "consumedAt": "2021-01-01T00:00:00.000Z"
}
```

## API Reference

For detailed API documentation and integration guidelines, refer to the [API Documentation](/api).
