> 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.

# Create CreditLimit

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

Create a per-user monthly AI credit limit for the whole tenant, a team, or an organization.

A user's effective limit is the **maximum** of the tenant-wide limit and the limits of every team and organization they belong to.

## Fields by group type

| `groupType` | `teamId` | `organizationId` |
| --- | --- | --- |
| `TENANT` | Omit | Omit |
| `TEAM` | **Required** (`team_XXXXXXXX`) | Omit |
| `ORGANIZATION` | Omit | **Required** (`ent_XXXXXXXX`) |

## Notes

- Requires tenant admin permission.
- `monthlyLimit` must be a positive integer.
- Each group may have at most one limit. Creating a second limit for the same group returns a `400`; update the existing limit instead.
- The organization ID is the organization's `ent_` ID.
- Returns `403` if credit limits are not enabled for the tenant. Team- and organization-scoped limits require group credit limits to be enabled as well.
- The change is recorded in the audit log. Affected users' effective limits are recomputed asynchronously, so the new limit may take a short time to apply.

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

## 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 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.

## Response

### 201

Created

- `__typename` (string, optional)
- `createdAt` (string, optional)
- `groupType` (enum, optional)
  - Allowed values: `TENANT`, `TEAM`, `ORGANIZATION`
- `id` (string, optional)
- `modifiedAt` (string, optional)
- `monthlyLimit` (integer, optional)
- `organization` (OrganizationRef, optional, nullable)
- `team` (TeamRef, optional, nullable)

## 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

### OrganizationRef

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

### TeamRef

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

### GeneralErrorDetail

- string
- map from string to any

### TooManyRequestsErrorDetail

- string
- map from string to any

### InternalServerErrorDetail

- string
- map from string to any

## Examples

**Request**

```json
{
  "groupType": "TEAM",
  "monthlyLimit": 500,
  "teamId": "team_Xb7Qm2Lc"
}
```

**Response**

```json
{
  "__typename": "string",
  "createdAt": "string",
  "groupType": "TENANT",
  "id": "string",
  "modifiedAt": "string",
  "monthlyLimit": 1,
  "organization": {
    "__typename": "string",
    "id": "string"
  },
  "team": {
    "__typename": "string",
    "id": "string"
  }
}
```

**SDK Code**

```python
import requests

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

payload = {
    "groupType": "TEAM",
    "monthlyLimit": 500,
    "teamId": "team_Xb7Qm2Lc"
}
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';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"groupType":"TEAM","monthlyLimit":500,"teamId":"team_Xb7Qm2Lc"}'
};

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