# Pools and groups (/docs/scheduling/pools-and-groups)

An event type's `kind` says who a booking needs.

## Pools: any available host [#pools-any-available-host]

```ts twoslash
import { Coss } from "coss";
const coss = new Coss();
// ---cut---
const { data: eventType } = await coss.scheduling.eventTypes.create({
  title: "See the next available doctor",
  kind: "pool",
  duration_minutes: 15,
  hosts: [{ host: "doctor_482", weight: 200 }, { host: "doctor_483" }],
  host_filter: { team: "urgent-care" },
});
```

Hosts come from `hosts`, plus any active host matching all of `host_filter`. A slot is offered if anyone's
free, and a booking goes to whoever's furthest behind their share (`weight`), then whoever's waited
longest. If they've just been taken, it moves on to the next.

Narrow one booking with `attributes`, such as who's licensed in the patient's state:

```ts twoslash
import { Coss } from "coss";
const coss = new Coss();
const eventTypeId = "evtype_01kd2m9a0b1c2d3e4f5g6h7j8m";
// ---cut---
await coss.scheduling.bookings.create({
  event_type: eventTypeId,
  start: "2027-01-04T15:00:00Z",
  attributes: { licensed_in: "CA" },
  attendee: { uid: "patient_77", time_zone: "America/Los_Angeles" },
});
```

## Who's free? [#whos-free]

For a marketplace's search page: each matching host's soonest slots, soonest first, across up to 500 hosts.

```ts twoslash
import { Coss } from "coss";
const coss = new Coss();
const eventTypeId = "evtype_01kd2m9a0b1c2d3e4f5g6h7j8m";
// ---cut---
const { data } = await coss.scheduling.availability.search({
  event_type: eventTypeId,
  start: "2027-01-04T00:00:00Z",
  end: "2027-01-18T00:00:00Z",
  attributes: { language: "es" },
  slots_per_host: 3,
});
```

## Collective: several hosts at once [#collective-several-hosts-at-once]

With `kind: "collective"`, every host with `role: "required"` must be free, such as a doctor and an
interpreter. Add at most one `member`, and one of a pool is chosen alongside them.

## Group sessions [#group-sessions]

With `kind: "group"` and a `capacity`, each attendee books a seat in the same session, with a booking and
manage link of their own. The host's time is taken once, by the first seat, and given back with the last.
A full session answers `slot_unavailable`. A seat moves by cancelling it and booking another session.
