# Submit a sample for lab testing

Before product can be sold, a sample has to go to a lab and come back with results attached to the source package.

## Create a sample package

Split a small quantity off the source package into its own trackable unit:

```bash
curl -X POST https://api.seedlink.dev/v1/connections/8f9ab02c-78c2-4292-a43d-79a327a4efd5/facilities/fac_C11-0000123-LIC/packages \
  -H "Authorization: Bearer sl_at_..." \
  -H "Content-Type: application/json" \
  -d '{
    "item_name": "Blue Dream Flower - Sample",
    "item_category": "Flower",
    "item_strain": "Blue Dream",
    "quantity": 2,
    "unit_of_measure": "Grams",
    "source_package_ids": ["pkg_2385762"]
  }'
```

SeedLink doesn't have a dedicated "is sample" flag, so a naming convention or `metadata` is how you keep it distinguishable on your own side.

## Transfer it to the lab

`transfer_type` is a free-text field, not a fixed set of values. Use whatever your own system recognizes.

```bash
curl -X POST https://api.seedlink.dev/v1/connections/8f9ab02c-78c2-4292-a43d-79a327a4efd5/facilities/fac_C11-0000123-LIC/transfers \
  -H "Authorization: Bearer sl_at_..." \
  -H "Content-Type: application/json" \
  -d '{
    "transfer_type": "testing",
    "shipper_facility": "fac_C11-0000123-LIC",
    "recipient_facility": "fac_C8-0000012-LIC",
    "packages": [
      {
        "package_id": "{sample_package_id}",
        "tag": "1A40F0000000001000000099",
        "item_name": "Blue Dream Flower - Sample",
        "quantity": 2,
        "unit_of_measure": "Grams"
      }
    ]
  }'
```

## Record results when they come back

```bash
curl -X POST https://api.seedlink.dev/v1/connections/8f9ab02c-78c2-4292-a43d-79a327a4efd5/facilities/fac_C11-0000123-LIC/lab_results \
  -H "Authorization: Bearer sl_at_..." \
  -H "Content-Type: application/json" \
  -d '{
    "package_id": "pkg_2385762",
    "lab_name": "SC Labs",
    "overall_passed": true,
    "results": [
      { "name": "THC", "category": "potency", "value": 22.4, "unit": "%", "passed": true, "notes": null }
    ]
  }'
```

Results attach to the original source package (`pkg_2385762`), not the sample.

## Gotchas

Package, transfer, and lab result writes only work against sandbox connections.

