# COMPONENTS

components endpoints.

**Base URL:** `https://api.trustpager.com/functions/v1/api/v1`

## Endpoints

### GET /product-components

List a product's template components (bill-of-materials parts/bundles). Filter by product_id, type, or search by label. These are product-level and reused across opportunities — for the actual lab samples/units of a job use list_component_instances.

**Scopes:** `products:read` — [full detail](./components/get-product-components.md)

### POST /product-components

Add a template component (a BOM part/bundle) to a product. Product-level, not tied to any opportunity. Requires product_id.

**Scopes:** `products:write` — [full detail](./components/post-product-components.md)

### POST /product-components/bulk

Create up to 500 product template components in one call. Body: { components: [...] }, each item the same shape as create_product_component.

**Scopes:** `products:write` — [full detail](./components/post-product-components-bulk.md)

### GET /product-components/:product_component_id

Fetch a single product template component by UUID.

**Scopes:** `products:read` — [full detail](./components/get-product-components-product-component-id.md)

### PATCH /product-components/:product_component_id

Update a product template component. The product it belongs to cannot be changed.

**Scopes:** `products:write` — [full detail](./components/patch-product-components-product-component-id.md)

### DELETE /product-components/:product_component_id

Delete a product template component by UUID. Destructive.

**Scopes:** `products:delete` — [full detail](./components/delete-product-components-product-component-id.md)

### GET /component-instances

List component instances (the actual units / lab samples processed for jobs), carrying result data in attributes. Filter by opportunity_id, product_id, status, or search by label.

**Scopes:** `products:read` — [full detail](./components/get-component-instances.md)

### POST /component-instances

Create a component instance (a unit / lab sample) for a job. REQUIRES both product_id and opportunity_id — an instance always belongs to a product and a specific opportunity. Carry result data in attributes.

**Scopes:** `products:write` — [full detail](./components/post-component-instances.md)

### POST /component-instances/bulk

Create up to 500 component instances in one call. Body: { instances: [...] }, each item the same shape as create_component_instance (product_id + opportunity_id required). Used for sample-data imports.

**Scopes:** `products:write` — [full detail](./components/post-component-instances-bulk.md)

### GET /component-instances/:instance_id

Fetch a single component instance by UUID.

**Scopes:** `products:read` — [full detail](./components/get-component-instances-instance-id.md)

### PATCH /component-instances/:instance_id

Update a component instance. The product and opportunity it belongs to cannot be changed. Pass only the fields you want to change (e.g. status, attributes).

**Scopes:** `products:write` — [full detail](./components/patch-component-instances-instance-id.md)

### DELETE /component-instances/:instance_id

Delete a component instance by UUID. Destructive.

**Scopes:** `products:delete` — [full detail](./components/delete-component-instances-instance-id.md)
