Skip to Content
Groups

Update a group

Permissiongroups:updateAdd-onGroupsAuthentication
PATCH
/groups/{id}

Partially updates a group. Changes take effect on the next call.

Omitted fields keep their values. An explicit null clears description and empties metrics; name, overall_enabled and members reject null.

Replacing members

Supplying members replaces the live member set, matched by agent_id:

  • an agent already in the group keeps its member id and label
  • a new agent gets the next unused label
  • an agent left out is removed, and its past calls keep their attribution

Array order sets position. Any member or weight change is recorded in GET /v1/groups/{id}/changes and shown on the results timeline.

Supplying metrics replaces the custom metric list. The group-owned extraction object is rewritten on every save.

Concurrency

If-Match is optional but recommended; a stale strong tag returns 412 with the current ETag. Archived groups reject updates with 409 group_archived. Requires the groups entitlement.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Use a Voice API key or connected-app OAuth access token. Authentication.

Path Parameters

id*string
Formatuuid

Header Parameters

If-Match?string

Optional strong ETag (or *) from a prior response. A stale tag returns 412 without changing the resource.

Request Body

application/json
  1. body

Omitted fields are unchanged; at least one field must be supplied. Explicit null clears description and empties metrics. name, overall_enabled, routing_strategy and members reject null. members REPLACES the live member set, matched by agent_id (existing agents keep their member id and label; agents left out are removed). metrics REPLACES the custom metric list. Maximum encoded body size is 262144 bytes.

Properties1 <= properties
name?string
Length1 <= length <= 200
description?|
Lengthlength <= 2000
overall_enabled?boolean
routing_strategy?GroupRoutingStrategy

Chooses among eligible members in proportion to their weights. sticky assigns a number consistently while the eligible members and weights are unchanged. random draws independently for each new assignment. prefer_new draws from agents with no retained answered call for the number in this group, or from all eligible members once every eligible agent has answered it. When the number is unavailable, sticky and prefer_new use weighted random.

Value in"sticky""random""prefer_new"
members?array<>
Items1 <= items <= 10
metrics?array<>|
Itemsitems <= 20

Response Body

The updated group.

application/json
  1. response

A set of existing agents with traffic weights. A phone number, outbound job or campaign can target a group instead of a single agent or a flow; each call is assigned to one member using routing_strategy and measured on the same metrics, so agents can be compared on real traffic. A group owns no prompt, model or voice configuration — those stay on each member agent's production version. Groups are not versioned: a save is live on the next call, and resource_version feeds the strong ETag that PATCH's If-Match is checked against.

id*string
Formatuuid
org_id*string
Formatuuid
name*string
Length1 <= length <= 200
description?string

Absent when no description is set.

Lengthlength <= 2000
routing_strategy*GroupRoutingStrategy

Chooses among eligible members in proportion to their weights. sticky assigns a number consistently while the eligible members and weights are unchanged. random draws independently for each new assignment. prefer_new draws from agents with no retained answered call for the number in this group, or from all eligible members once every eligible agent has answered it. When the number is unavailable, sticky and prefer_new use weighted random.

Value in"sticky""random""prefer_new"
overall_enabled*boolean

Whether every call is measured on the platform's Overall performance fields: overall_score (integer 1–10) and outcome (achieved, partial, not_achieved or escalated).

members*array<>

The live members in position order.

Itemsitems <= 10
metrics*array<>
Itemsitems <= 20
extraction_object_id?string

The group-owned extraction object that measures overall_enabled and metrics. It runs after every call routed through the group, is hidden from GET /v1/extraction-objects, and PATCH/DELETE on it return 409 extraction_object_managed_by_group — change the group instead.

Formatuuid
used_by*

How many non-archived phone numbers and campaigns point at the group.

used_by_detail?

Returned by the single-group endpoints (GET, POST, PATCH) only.

resource_version*integer

Monotonic row version maintained by the database, never by the handler. It is the value behind the strong ETag.

Formatint64
Range0 <= value
archived_at?string

Absent unless the group has been archived.

Formatdate-time
created_at*string
Formatdate-time
updated_at*string
Formatdate-time
Example Request
curl -X PATCH 'https://api.kejue.co/v1/groups/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{  "routing_strategy": "prefer_new",  "members": [    {      "agent_id": "11111111-1111-4111-8111-111111111111",      "weight": 70    },    {      "agent_id": "22222222-2222-4222-8222-222222222222",      "weight": 30    }  ]}'
Example Response
{  "id": "55555555-5555-4555-8555-555555555555",  "org_id": "44444444-4444-4444-8444-444444444444",  "name": "Debt collection A/B",  "overall_enabled": true,  "routing_strategy": "prefer_new",  "members": [    {      "id": "66666666-6666-4666-8666-666666666666",      "agent_id": "11111111-1111-4111-8111-111111111111",      "agent_name": "Noura",      "agent_slug": "noura",      "label": "A",      "weight": 70,      "position": 0,      "share": 70,      "dispatchable": true,      "created_at": "2026-10-20T09:00:00Z"    },    {      "id": "77777777-7777-4777-8777-777777777777",      "agent_id": "22222222-2222-4222-8222-222222222222",      "agent_name": "Omar",      "agent_slug": "omar",      "label": "B",      "weight": 30,      "position": 1,      "share": 30,      "dispatchable": true,      "created_at": "2026-10-20T09:00:00Z"    }  ],  "metrics": [],  "extraction_object_id": "88888888-8888-4888-8888-888888888888",  "used_by": {    "phone_numbers": 1,    "campaigns": 0  },  "used_by_detail": {    "phone_numbers": [      {        "id": "99999999-9999-4999-8999-999999999999",        "e164": "+97145550100"      }    ],    "campaigns": []  },  "resource_version": 4,  "created_at": "2026-10-20T09:00:00Z",  "updated_at": "2026-10-22T11:45:00Z"}