Smart groups API
Read the smart groups the LLM Gateway uses, create virtual groups with a fixed member list, and set the rank that decides which group governs a person who is in several groups. The same groups appear in the Groups section of Govern > Policy Engine > LLM Gateway in the console.
The console Rank column is the API field priority: the number you edit, where a lower number wins. The console Strength column (#1 is the strongest) is the API field rank: a computed position you cannot set.
Try every operation with your own key in the Management API playground.
Rank and the governing group
Every group has a rank number, the priority field (console Rank). A lower number is stronger. When a person is in several enabled groups, the group with the lowest priority is their governing group; equal priorities are ordered by group name. Disabled groups never govern anyone.
rank(console Strength) is computed from that order: the group's 1-based position among enabled groups,1being the strongest. It isnullfor a disabled group. You never send it; changepriorityinstead.- Rank order decides:
- Per-group guardrails (
smart_group_policiesin app settings): the person's groups are tried in rank order, and the first one that has a policy applies. - Group budget sets that use the strongest group's budget: the best-ranked of the person's groups in that set governs, which need not be a group with
rank1. See group budget sets.
- Per-group guardrails (
- Rules that check membership (for example access rules on
user.smart_groups) match every group the person is in; rank does not matter there. - Lists are returned strongest first.
Synced and virtual groups
Rank override. A synced group's priority is set by the sync (by default the groups are ordered by name). Send PATCH {"priority": n} to override it. The override survives every later sync. Send {"priority": null} to reset to the synced value. Reads show both: priority is the value in effect, synced_priority is the sync's value and priority_override is your override (or null).
Group fields
Create and edit virtual groups
export API="$MANAGEMENT_URL/llmgateway/management/v1"
curl -X POST "$API/smart-groups" \
-H "Authorization: Bearer $MANAGEMENT_KEY" \
-H "Idempotency-Key: create-sales-leads" \
-H "Content-Type: application/json" \
-d '{"name": "sales leads", "display_name": "Sales leads", "emails": ["ana@example.com", "li@example.com"], "priority": 10}'
- Create takes
name(required),display_name(default: the name),emails,enabled(defaulttrue) andpriority(default100). The name is lowercased with spaces collapsed, up to 200 characters;priorityis reserved. The response (201) is{"smart_group": {...}}withgroup_name: "virtual:sales leads". - Edit with
PATCHchanges only the fields you send.emailsreplaces the whole list. Priorities are whole numbers from0to1000000. - Change members with
POST /smart-groups/{group_name}/membersand{"add": [...], "remove": [...]}(at least one email; an email cannot be in both). Emails already present or already absent are ignored. The response is{smart_group, added, removed}, whereaddedandremovedcount actual changes. - Delete answers
409 group_in_usewithreferences(up to 50) when the active policy, budgets, exemptions, API-managed controls or app settings still name the group. Remove the references, or send?force=trueto delete anyway; the response then lists them inforced_references. Drafts are not checked.
Emails match case-insensitively and are stored lowercase.
Preview a rank change
Before saving a priority, send the changes to POST /smart-groups/_priority-preview. Nothing is saved.
{"changes": [{"group_name": "executives", "priority": 1}, {"group_name": "virtual:sales leads", "priority": 20}]}
A person who moves counts against the new group's budget from then on; their earlier usage stays on the old group's budget and is not carried over (a per-person budget they never used starts at zero; a shared group budget keeps its running total). Send null as the priority to preview a reset to the synced value (synced groups only). Up to 1,000 changes per preview.
Writes and errors
POST /smart-groupsand the members call need anIdempotency-Key; a retry with the same key replays the first result.PATCHandDELETEneedIf-Matchwith the group'sversion(428without it,412 version_conflictwhen stale).If-Matchis optional on the members call.
Endpoints
/smart-groupsList smart groups
Smart groups that app access rules, budgets and group policies can reference, in effective priority order. Synced groups come from the directory sync; virtual groups are created here or in the console.
readPath, query & header parameters 2
limit (query)integeroptionalPage size.
cursor (query)stringoptionalOpaque cursor from the previous page's next_cursor.
No request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/smart-groups?limit=50' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/smart-groupsCreate a virtual smart group
Create an admin-managed group with a static member list. It is stored as virtual:<name>, is never changed by the directory sync and can be referenced like any other group. Enabled groups are ranked by priority number, lowest first (ties: group name). Per-group guardrail policies apply from the person's first ranked group that has one; strongest group budget sets charge the person's best-ranked group in the set; membership rules match every group. Requires an Idempotency-Key; 409 smart_group_exists when the name is taken.
config:writePath, query & header parameters 1
Idempotency-Key (header)stringrequiredUnique per logical write. A retry with the same key and body replays the original result; the same key with a different body is a 409.
Full request body specification application/json
display_namestringoptionalShown in the console. Default: name.
emailsarray<string>optionalMember email addresses (case-insensitive; stored lowercase, duplicates removed).
Array item specification
stringenabledbooleanoptionalnamestringrequiredName without the virtual: prefix (lowercased, spaces collapsed). The group is stored as virtual:<name>. The name priority is reserved.
priorityintegeroptionalLower number wins when a person is in several groups.
Unknown fields are rejected in this object.
curl --request POST \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/smart-groups' \
--header 'Authorization: Bearer <management-key>' \
--header 'Idempotency-Key: create-contractors-001' \
--header 'Content-Type: application/json' \
--data '{
"display_name": "Contractors",
"emails": [
"dana@example.com"
],
"name": "contractors",
"priority": 5
}'
Authentication, errors & retry rules Try it in the playground
/smart-groups/_priority-previewPreview priority changes
Who would change active group if these priorities were applied, plus the priority ties the change creates (a changed group lands on another enabled group's priority and they share members; existing ties are not listed), and budget_moves: people whose governing budget in a strongest group budget set would move to another group's budget (its own counter; usage is not carried over). Nothing is saved. Lists at most 500 people per list (truncated / budget_moves_truncated).
readFull request body specification application/json
changesarray<object>requiredArray item specification
group_namestringrequiredFull group name.
priorityinteger | nullrequiredProposed priority; null: reset a synced group's override.
Unknown fields are rejected in this object.
Unknown fields are rejected in this object.
curl --request POST \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/smart-groups/_priority-preview' \
--header 'Authorization: Bearer <management-key>' \
--header 'Content-Type: application/json' \
--data '{
"changes": [
{
"group_name": "virtual:contractors",
"priority": 1
}
]
}'
Authentication, errors & retry rules Try it in the playground
/smart-groups/{group_name}Delete a virtual smart group
Virtual groups only (synced: 409 synced_group_read_only). When the active policy, budgets, exemptions, managed controls or app settings name the group the response is 409 group_in_use with references; pass force=true to delete anyway. Requires the group's version in If-Match.
config:writePath, query & header parameters 3
group_name (path)stringrequiredIf-Match (header)stringrequiredQuoted version from the latest read of the group; 412 when it changed.
force (query)booleanoptionalDelete even when the group is referenced.
Full request body specification application/json
Unknown fields are rejected in this object.
curl --request DELETE \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/smart-groups/engineering' \
--header 'Authorization: Bearer <management-key>' \
--header 'If-Match: "9b2e4f0c7a1d"'
Authentication, errors & retry rules Try it in the playground
/smart-groups/{group_name}Read a smart group
One smart group (name matched case-insensitively).
readPath, query & header parameters 1
group_name (path)stringrequiredNo request body.
curl --request GET \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/smart-groups/engineering' \
--header 'Authorization: Bearer <management-key>'
Authentication, errors & retry rules Try it in the playground
/smart-groups/{group_name}Update a smart group or its priority
Virtual group: change display_name, emails, enabled or priority. Synced group: only priority, which sets an override the directory sync never replaces; null resets it to the synced priority (other fields: 409 synced_group_read_only). Enabled groups are ranked by priority number, lowest first (ties: group name). Per-group guardrail policies apply from the person's first ranked group that has one; strongest group budget sets charge the person's best-ranked group in the set; membership rules match every group. Requires the group's version in If-Match.
config:writePath, query & header parameters 2
group_name (path)stringrequiredIf-Match (header)stringrequiredQuoted version from the latest read of the group; 412 when it changed.
Full request body specification application/json
At least one field. Synced groups accept only priority.
display_namestringoptionalemailsarray<string>optionalReplaces the member list (virtual groups only).
Array item specification
stringenabledbooleanoptionalpriorityinteger | nulloptionalVirtual group: its priority (not null). Synced group: the priority override; null resets to the synced priority.
Unknown fields are rejected in this object.
curl --request PATCH \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/smart-groups/engineering' \
--header 'Authorization: Bearer <management-key>' \
--header 'If-Match: "9b2e4f0c7a1d"' \
--header 'Content-Type: application/json' \
--data '{
"priority": 1
}'
Authentication, errors & retry rules Try it in the playground
/smart-groups/{group_name}/membersAdd or remove smart group members
Virtual groups only (synced: 409 synced_group_read_only). Adds and removes members without replacing the list; already-present adds and absent removes are ignored (added/removed count actual changes). Requires an Idempotency-Key; If-Match (group version) is optional.
config:writePath, query & header parameters 3
group_name (path)stringrequiredIdempotency-Key (header)stringrequiredUnique per logical write. A retry with the same key and body replays the original result; the same key with a different body is a 409.
If-Match (header)stringoptionalQuoted version from the latest read of the group; 412 when it changed.
Full request body specification application/json
At least one email in add or remove; virtual groups only.
addarray<string>optionalEmails to add (already-present ones are ignored).
Array item specification
stringremovearray<string>optionalEmails to remove (absent ones are ignored).
Array item specification
stringUnknown fields are rejected in this object.
curl --request POST \
'https://guardrails-usa-1.quilr.ai/llmgateway/management/v1/smart-groups/engineering/members' \
--header 'Authorization: Bearer <management-key>' \
--header 'Idempotency-Key: create-contractors-001' \
--header 'If-Match: "9b2e4f0c7a1d"' \
--header 'Content-Type: application/json' \
--data '{
"add": [
"lee@example.com"
]
}'
Authentication, errors & retry rules Try it in the playground
Related
- Budgets API: group budget sets - per-group budgets that follow the rank.
- Rate, token and budget limits - how a person in several groups is charged.
- Smart Groups - the organization groups the gateway syncs.
- Management API - authentication, errors and retry rules for every endpoint.