## Set a workspace spending limit

`admin.workspaces.set_spending_limit(strworkspace_id, WorkspaceSetSpendingLimitParams**kwargs)  -> WorkspaceSetSpendingLimitResponse`

**put** `/compute/v1/admin/workspaces/{workspace_id}/spending-limit`

Set a workspace spending limit

### Parameters

- `workspace_id: str`

- `limit: Limit`

  - `amount: int`

    Workspace spending limit amount in milli-USD. Tracking starts when the limit is configured; prior or already-committed unreserved work is not counted in this workspace cap ledger.

  - `currency: Literal["MILLI_USD"]`

    Workspace spending limits currently support milli-USD only.

    - `"MILLI_USD"`

- `type: Literal["lifetime"]`

  - `"lifetime"`

### Returns

- `class WorkspaceSetSpendingLimitResponse: …`

  Configured lifetime workspace spending limit, or null if unset. Unset workspaces have no workspace-level cap and continue to use organization-level billing.

  - `limit: Limit`

    - `amount: int`

      Workspace spending limit amount in milli-USD. Tracking starts when the limit is configured; prior or already-committed unreserved work is not counted in this workspace cap ledger.

    - `currency: Literal["MILLI_USD"]`

      Workspace spending limits currently support milli-USD only.

      - `"MILLI_USD"`

  - `type: Literal["lifetime"]`

    - `"lifetime"`

### Example

```python
import os
from boltz_api import Boltz

client = Boltz(
    api_key=os.environ.get("BOLTZ_API_KEY"),  # This is the default and can be omitted
)
response = client.admin.workspaces.set_spending_limit(
    workspace_id="workspace_id",
    limit={
        "amount": 5000,
        "currency": "MILLI_USD",
    },
    type="lifetime",
)
print(response.limit)
```

#### Response

```json
{
  "limit": {
    "amount": 5000,
    "currency": "MILLI_USD"
  },
  "type": "lifetime"
}
```
