# Sync inventory between SeedLink and your system

Keeping your own database in step with what's actually active in Metrc or BioTrack is the most common integration job there is. This is the pattern for doing it on a schedule.

## Pull active packages

```bash
curl "https://api.seedlink.dev/v1/connections/8f9ab02c-78c2-4292-a43d-79a327a4efd5/facilities/fac_C11-0000123-LIC/packages?status=active&per_page=100" \
  -H "Authorization: Bearer sl_at_..."
```

Page through with `page`/`per_page` until `pagination.total_pages` is reached. Do the same with `status=inactive` if you also track packages that have left the facility.

## Reconcile against your own records

Diff the results against what you have stored. A package that's active in SeedLink but missing on your side needs to be created; one that's gone needs to be marked inactive.

## Push corrections back where they apply

If your side is the source of truth for quantity or hold status, write it back:

```bash
curl -X PATCH https://api.seedlink.dev/v1/connections/8f9ab02c-78c2-4292-a43d-79a327a4efd5/facilities/fac_C11-0000123-LIC/packages/pkg_2385762 \
  -H "Authorization: Bearer sl_at_..." \
  -H "Content-Type: application/json" \
  -d '{ "quantity": 428.1 }'
```

## Gotchas

There's no `modified_since` filter on any resource yet, so every sync is a full pull of the current active set, not an incremental diff. Budget for that in how often you run this.

