> This page is for Developer Documentation.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.benchling.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.benchling.com/_mcp/server.

# Preview which users a proposed credit limit change would block

POST https://{tenant_name}.benchling.com/api/v3/credit-limit:preview-changes
Content-Type: application/json

Preview which users would be blocked by a proposed set of credit limit changes. **This is a dry run: no credit limits are created, updated, or deleted.**

Returns the users whose AI credit usage this month already meets or exceeds the effective limit they would have after the proposed changes. A user's effective limit is the maximum of the tenant-wide limit and the limits of every team and organization they belong to.

Proposed creates are checked for field constraints and conflicts with existing limits; a successful preview does not guarantee that the write will succeed.

## Notes

- Requires tenant admin permission.
- `creates` are validated with the same rules as the create endpoint.
- `updates` and `deletes` must reference existing credit limits by `id`.
- Users are returned in an unspecified but stable order.
- Results are paginated, with a default `pageSize` of 50: pass the returned `nextToken`, with the same `pageSize` and proposed changes, to get the next page. A page may contain fewer than `pageSize` users, or none, even when more pages follow.

Reference: https://docs.benchling.com/docs/api/benchling-api/credit-limit/previewchanges

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Headers

- `EARLY-ACCESS` (string, optional) — Set to true to access beta operations via /api/v3.

### Body (application/json)

This endpoint expects a PreviewCreditLimitChangesInput.

- `creates` (list of CreateCreditLimitInput, optional) — Proposed credit limits to create. Validated with the same rules as the create endpoint.
- `deletes` (list of DeleteCreditLimitInputWithPathParams, optional) — Existing credit limits proposed for deletion, identified by `id`.
- `nextToken` (string, optional) — Token from a previous response's `nextToken`, to continue from where that response ended. The `pageSize` and proposed changes must match the previous request.
- `pageSize` (integer, optional) — Maximum number of blocked users to return, from 1 to 100. Defaults to 50.
- `updates` (list of UpdateCreditLimitInputWithPathParams, optional) — Proposed changes to existing credit limits, identified by `id`.

## Response

### 200

OK

- `blockedUsers` (list of CreditLimitBlockedUser, optional) — Users blocked by the proposed change, in an unspecified but stable order.
- `nextToken` (string, optional, nullable) — Token for retrieving the next page of blocked users, or null if there are no more. Pass it in the next request as `nextToken`, with the same `pageSize` and proposed changes, to continue. A non-null token may be followed by an empty page.

## Errors

### 400 Bad Request Error

Bad Request

- `detail` (GeneralErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 403 Forbidden Error

Forbidden

- `detail` (GeneralErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 404 Not Found Error

Not Found

- `detail` (GeneralErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 409 Conflict Error

Conflict

- `detail` (GeneralErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 429 Too Many Requests Error

Too Many Requests

- `detail` (TooManyRequestsErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `invalidId` (string, optional)

### 500 Internal Server Error

Internal Server Error

- `detail` (InternalServerErrorDetail, required, nullable)
- `instance` (string, required)
- `status` (integer, required)
- `title` (string, required, nullable)
- `type` (string, required)
- `errorId` (string, optional)

## Types

### CreateCreditLimitInput

- `groupType` (enum, required) — The group scope the limit applies to: the whole tenant, a single team, or a single organization.
  - Allowed values: `TENANT`, `TEAM`, `ORGANIZATION`
- `monthlyLimit` (integer, required) — The maximum number of AI credits each user in the group may consume per month. Must be a positive integer.
- `organizationId` (string, optional) — The ID of the organization the limit applies to. Required when groupType is ORGANIZATION and must be omitted otherwise.
- `teamId` (string, optional) — The ID of the team the limit applies to. Required when groupType is TEAM and must be omitted otherwise.

### DeleteCreditLimitInputWithPathParams

- `id` (string, required)

### UpdateCreditLimitInputWithPathParams

- `id` (string, required)
- `monthlyLimit` (integer, required) — The new maximum number of AI credits each user in the group may consume per month. Must be a positive integer.

### CreditLimitBlockedUser

Information on one user blocked by a proposed change.

- `__typename` (string, optional)
- `creditsUsed` (double, optional)
- `user` (UserRef, optional)
- `userName` (string, optional) — The user's display name, provided as a convenience so callers don't need to fetch the user.

### GeneralErrorDetail

- string
- map from string to any

### TooManyRequestsErrorDetail

- string
- map from string to any

### InternalServerErrorDetail

- string
- map from string to any

### UserRef

- `__typename` (string, optional)
- `id` (string, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "blockedUsers": [
    {
      "__typename": "string",
      "creditsUsed": 1.1,
      "user": {
        "__typename": "string",
        "id": "string"
      },
      "userName": "string"
    }
  ],
  "nextToken": null
}
```

**SDK Code**

```python
import requests

url = "https://{tenant_name}.benchling.com/api/v3/credit-limit:preview-changes"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://{tenant_name}.benchling.com/api/v3/credit-limit:preview-changes';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```