Skip to Content
Groups

Create a group

Permissiongroups:createAdd-onGroupsRetriesIdempotency-Key requiredAuthentication
POST
/groups

Creates a group from agents you already have, so live calls can be split across them by weight and the agents compared on real traffic.

name and members are required.

Members

A group holds 1–10 agents, each at most once. Every member must name an un-archived agent in the same workspace that has a production version. Weights are 0–100 and at least one must be above 0. Members are labelled A, B, C… in the order given.

What gets measured

  • overall_enabled (default true) measures every call on the platform's Overall performance fields: overall_score 1–10 and outcome.
  • metrics adds up to 20 custom fields.

Both are written into one group-owned extraction object (extraction_object_id) that runs after every call routed through the group, on top of the answering agent's own after-call extractions. That object is hidden from GET /v1/extraction-objects and can only be changed here.

Validation failures list every offending field with its path. Requires the groups entitlement.

Authorization

bearerAuth
headerAuthorizationBearer <token>

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

Header Parameters

Idempotency-Key*string

Required. Reuse the same key to retry this write safely. Retries and idempotency.

Match^[A-Za-z0-9!#$%&'*+.^_`|~-]+$
Length1 <= length <= 255

Request Body

application/json
  1. body

Creates a group. name and members are required. overall_enabled defaults to true, routing_strategy to sticky, and metrics to an empty list. Maximum encoded body size is 262144 bytes.

name*string

Unique among the workspace's non-archived groups. Trimmed.

Length1 <= length <= 200
description?|
Lengthlength <= 2000
overall_enabled?boolean
Defaulttrue
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.

Default"sticky"
Value in"sticky""random""prefer_new"
members*array<>

1–10 distinct agents; at least one weight must be above 0. Array order sets position and the labels (A, B, …).

Items1 <= items <= 10
metrics?array<>|

Custom metrics. Null is accepted and stores an empty list.

Itemsitems <= 20

Response Body

The created group, including the (empty) used_by_detail lists.

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 POST 'https://api.kejue.co/v1/groups' \  -H 'Idempotency-Key: string' \  -H 'Content-Type: application/json' \  -d '{  "name": "Debt collection A/B",  "description": "Noura'\''s empathetic opener against Omar'\''s direct one.",  "overall_enabled": true,  "routing_strategy": "sticky",  "members": [    {      "agent_id": "11111111-1111-4111-8111-111111111111",      "weight": 50    },    {      "agent_id": "22222222-2222-4222-8222-222222222222",      "weight": 50    }  ],  "metrics": [    {      "name": "payment_promised",      "type": "boolean",      "description": "Did the customer promise to pay?"    },    {      "name": "sentiment",      "type": "enum",      "enum_values": [        "positive",        "neutral",        "negative"      ]    }  ]}'
Example Response
{  "id": "55555555-5555-4555-8555-555555555555",  "org_id": "44444444-4444-4444-8444-444444444444",  "name": "Debt collection A/B",  "description": "Noura's empathetic opener against Omar's direct one.",  "overall_enabled": true,  "routing_strategy": "sticky",  "members": [    {      "id": "66666666-6666-4666-8666-666666666666",      "agent_id": "11111111-1111-4111-8111-111111111111",      "agent_name": "Noura",      "agent_slug": "noura",      "label": "A",      "weight": 50,      "position": 0,      "share": 50,      "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": 50,      "position": 1,      "share": 50,      "dispatchable": true,      "created_at": "2026-10-20T09:00:00Z"    }  ],  "metrics": [    {      "name": "payment_promised",      "type": "boolean",      "description": "Did the customer promise to pay?"    },    {      "name": "sentiment",      "type": "enum",      "enum_values": [        "positive",        "neutral",        "negative"      ]    }  ],  "extraction_object_id": "88888888-8888-4888-8888-888888888888",  "used_by": {    "phone_numbers": 0,    "campaigns": 0  },  "used_by_detail": {    "phone_numbers": [],    "campaigns": []  },  "resource_version": 1,  "created_at": "2026-10-20T09:00:00Z",  "updated_at": "2026-10-20T09:00:00Z"}