AI

Set individual user groups' AI credit limits

Changed on

Set individual standard user groups' AI credit limits in bulk. Each entry names a user group by its user group ID (userGroupId) and either sets an individual limit (creditLimit: a non-negative number, or null for unlimited) or removes one (useDefaultLimit: true) so the user group follows the org's user-group default (userGroupDefaultCredits). A group's limit applies to each member individually, not to the group's combined usage; a member of several groups gets the highest group cap, and an individual per-user or per-entity-group limit takes precedence over group caps. The per-user default (userDefaultCredits) still applies alongside a group cap; the lower of the two wins. Each userGroupId may appear at most once and must name a standard (non-embed) user group in the organization. All updates are applied in one transaction, so either every entry takes effect or none do — an unknown userGroupId fails the whole request with a 404 naming it. Requires the same add/remove-users permission as the group settings page and the user-group credit-limit feature flag.

patch/api/v1/ai/credit-controls/user-groups

Request

Request body

Example request

{
  "userGroups": [
    {
      "creditLimit": 50,
      "userGroupId": "abc123"
    }
  ]
}

Response

All entries applied. Returns each user group's effective limit, in request order.

Example response

{
  "userGroups": [
    {
      "creditLimit": 50,
      "name": "Sales",
      "userGroupId": "abc123"
    }
  ]
}

Changes