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

# Manage Resolver Groups

> List, create and fill lot groups and serial groups -- named, brand-owned sets of lots or serials that a resolution rule can be scoped to -- the programmatic equivalent of the dashboard's Lot groups and Serial groups pages.

Programmatic equivalent of the dashboard's `resolver/lot-groups/` and `resolver/serial-groups/`
pages. A lot group (or serial group) is a named set of one brand's lots (or serials). A resolution
rule scoped to the group applies to every member, so one rule can treat a whole batch run or a set
of units alike. Adding or removing a member changes which rule a scan of that lot or serial
resolves to straight away.

## When to use

* A brand wants one rule to cover several lots, for example every lot of a recalled production run.
* A brand wants one treatment for a set of serials, for example trial units.
* A lot or serial must join or leave such a set.

Creating the lots and serials themselves is `manage-product-lots` and `manage-product-serials`;
writing the rule that points at a group is `manage-resolution-rules`.

## Auth

`X-API-Key` header or OAuth token with `resolver:write` scope (`resolver:read` for reads). Reading
needs membership of the organization; writing needs the contribute role (Editor or Manager). A
read-only key is refused with `403` on a write; an organization the caller cannot view, and a group,
brand, lot or serial of another organization, answer `404`.

The paths carry no organization: an API key acts on its own organization, and a session or OAuth
caller on its only one. A caller in more than one adds `?organization_id=<id>` (`400` without it);
naming an organization the caller cannot see answers `404`.

## Flow

```
GET    /resolver/api/v1/lot-groups
POST   /resolver/api/v1/lot-groups
GET    /resolver/api/v1/lot-groups/{group_id}
GET    /resolver/api/v1/lot-groups/{group_id}/members
POST   /resolver/api/v1/lot-groups/{group_id}/members
DELETE /resolver/api/v1/lot-groups/{group_id}/members/{lot_id}
```

`/serial-groups` is the same set of routes over serials (`serial_ids`, `{serial_id}`).

* **`GET` list** -- every group of the organization, paginated (`{data, pagination}`), each with its
  `member_count`.
* **`POST` create** -- body `brand_id` (one of the organization's brands) and `name` (at most 120
  characters, unique within the brand). The group starts empty.
* **`GET` one / members** -- read a group, or page through its lots (`id`, `gtin`,
  `lot_identifier`) or serials (`id`, `gtin`, `serial`).
* **`POST` members** -- body `lot_ids` (or `serial_ids`), 1 to 500 ids as the lots and serials APIs
  return them. Answers `{"added": n}`. An id that does not belong to a product of the group's brand,
  or does not exist, is skipped, so compare `added` with what you sent.
* **`DELETE` a member** -- removes one lot or serial from the group and keeps the lot or serial.
  Removing a non-member is not an error.
* There is **no rename and no delete** for a group: a group a rule points at must not vanish under it.

## Errors

* `403` -- the key is read-only.
* `404` -- unknown organization, group or brand, or one that belongs to another organization.
* `422` -- a name that is empty, over 120 characters, or already used by the brand.

## Verify

`GET` the group and check `member_count`, then list its members and check the ids you meant to add.
To prove the effect on a scan, resolve a GTIN with a matching lot or serial as described in
`manage-resolution-rules`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.