---
title: "Set individual users' AI credit limits"
method: PATCH
path: "/api/v1/ai/credit-controls/users"
tags: ["AI"]
---

# Set individual users' AI credit limits

`PATCH /api/v1/ai/credit-controls/users`

Set individual users' AI credit limits in bulk. Each entry names a user (`userId`) and either sets an individual limit (`creditLimit`: a non-negative number, or `null` for unlimited) or removes one (`useDefaultLimit: true`) so the user follows the org default. Each userId may appear at most once and must be a member of the organization. All updates are applied in one transaction, so either every entry takes effect or none do — an invalid userId fails the whole request with a 404 naming it. Requires the same manage-user-attributes permission as the AI credit limit settings pages.

## Request body

- AiUserCreditLimitsUpdateBody
  - `users` AiUserCreditLimitEntry[], required — Users to update, at most 1000 per request. Each entry has a `userId` plus exactly one of `creditLimit` (number or `null`) or `useDefaultLimit: true`.
    - `creditLimit` number, nullable — The user's individual AI credit limit for the billing period, or `null` for unlimited. Either way this overrides the org default. Mutually exclusive with `useDefaultLimit`.
    - `useDefaultLimit` true — Removes the user's individual limit so they follow the org default. Mutually exclusive with `creditLimit`.
    - `userId` string, uuid, required — The user's id within this organization.

## Response `200`

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

- AiUserCreditLimitsResponse
  - `users` object[], required
    - `creditLimit` number, nullable, required — The user's effective AI credit limit, or `null` for unlimited.
    - `userId` string, uuid, required — The user's id within this organization.
    - `usesDefaultLimit` boolean, required — True when the user has no individual limit and follows the org default.

## Other responses

- `400` — Invalid request. Common causes: an empty users array, more than 1000 entries, an entry with both creditLimit and useDefaultLimit (or neither), a negative creditLimit, or a duplicated userId.
- `401` — Missing or invalid API key.
- `403` — Insufficient permissions, per-user AI credit limits are not enabled, or credit controls editing is disabled for the organization.
- `404` — A userId is not a member of the organization; the response names the first invalid id. No limits are changed.

---

[API](https://skmtc.net/omniapp/apis/omni-api.md) · [All operations](https://skmtc.net/omniapp/apis/omni-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/omniapp/omni-api/versions/de7cac8b5983/schema)
