Reorder which group's target ranges win
const url = 'http://localhost:8000/api/client-groups/ranges-priority/';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"group_ids":["b3f1c0a2-0000-4000-8000-000000000002","b3f1c0a2-0000-4000-8000-000000000001"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8000/api/client-groups/ranges-priority/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "group_ids": [ "b3f1c0a2-0000-4000-8000-000000000002", "b3f1c0a2-0000-4000-8000-000000000001" ] }'A client in several groups that each carry their own range for the same metric is scored, per metric, against the group first in (ranges_priority, created_at, id) order (#2518). This sets that order: the listed group_ids take the top positions in the given order, the team’s remaining groups follow in their current order, and every group is renumbered 0..n-1 in one transaction. Returns the team’s groups in the new order.
400 when a listed id is not a group of the caller’s team (the whole request is refused; unknown and foreign ids read the same), when an id repeats, or when group_ids is empty. 403 for a partner API key (human team members only, like the threshold configurator) and when the caller has no active team selected.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Request body for POST /api/client-groups/ranges-priority/ (#2518):
the groups whose ranges should win, highest precedence first. Groups left
out keep their relative order below the listed ones.
object
Client-group UUIDs, highest precedence first. Each must be a group of the caller’s team and appear once.
Examples
U14 first, then the sprint squad
{ "group_ids": [ "b3f1c0a2-0000-4000-8000-000000000002", "b3f1c0a2-0000-4000-8000-000000000001" ]}Request body for POST /api/client-groups/ranges-priority/ (#2518):
the groups whose ranges should win, highest precedence first. Groups left
out keep their relative order below the listed ones.
object
Client-group UUIDs, highest precedence first. Each must be a group of the caller’s team and appear once.
Example generated
group_ids=2489E9AD-2EE2-8E00-8EC9-32D5F69181C0Request body for POST /api/client-groups/ranges-priority/ (#2518):
the groups whose ranges should win, highest precedence first. Groups left
out keep their relative order below the listed ones.
object
Client-group UUIDs, highest precedence first. Each must be a group of the caller’s team and appear once.
Responses
Section titled “Responses”A team-scoped client group (#545). name / description / colour
are writable on create + PATCH; the roster (member_ids) is read-only
here — mutate it via the /members/ endpoints. member_count powers
the board column header without a second round-trip.
object
Group name. Required; unique within the team.
Optional free-text description of the group.
Optional UI tint — a design-token key (e.g. tone-recovery) or empty. Cosmetic; the board falls back to a deterministic colour.
UUIDs of the clients in this group (many-to-many).
Number of clients in the group.
Whether the group carries any target range of its own (#2518) — a MetricThreshold row with client_group = this group. Edit them in /api/thresholds/?client_group=<id>.
Precedence of this group’s own target ranges (#2518) for a client in several groups: per metric, the group first in (ranges_priority, created_at, id) order wins — LOWER wins. Not unique (ties fall back to creation order). Read-only here; set it with POST /api/client-groups/ranges-priority/. A new group starts at the bottom.
Examples
Each group in the new order — U14 first, `ranges_priority` 0
[ { "id": "b3f1c0a2-0000-4000-8000-000000000002", "name": "U14", "description": "", "colour": "tone-recovery", "member_ids": [], "member_count": 0, "has_ranges": true, "ranges_priority": 0, "created_at": "2026-06-10T12:00:00Z", "updated_at": "2026-06-10T12:00:00Z" }]Unknown / other-team / repeated id, or an empty list (keyed on group_ids).
Validation error keyed by field — each value lists its messages.
object
Examples
400 — a group that isn't this team's
{ "group_ids": [ "One or more groups are unknown for this team." ]}object
Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).
Example generated
{ "detail": "example"}object
Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).
Example generated
{ "detail": "example"}