SPB Git

Repository Public

create.md 5.0 KB 214 lines markdown

1---2title: Set Spend Limit3url: https://platform.claude.com/docs/en/api/beta/organization/spend_limits/create4---56# Set Spend Limit78**POST** `/v1/organizations/spend_limits`910Set a spend limit.1112Upsert keyed on (scope, period): setting a limit that already exists13overwrites it in place. A Claude Enterprise organization sets `user`14limits. Its seat-tier, group, and organization-level defaults are configured15in claude.ai. A Claude Console organization sets `organization` and16`workspace` limits, which are monthly and always carry an amount. Setting those17limits is in an early access preview. To request access, contact your18Anthropic account team.1920## Body parameters2122- `amount: string or null`2324  Limit amount as a non-negative integer decimal string in the minor unit of the organization's billing currency (cents for USD): "50000" is $500.00. `null` sets an explicit no-limit override for this scope and `period` only — each period resolves independently, so caps for other periods still apply.2526- `scope: User or Organization or Workspace`2728  What the limit applies to. Claude Enterprise organizations set `user` limits. Claude Console organizations set `organization` and `workspace` limits. Any other combination returns 400. Setting `organization` and `workspace` limits through the API is in an early access preview. To request access, contact your Anthropic account team.2930  - `User object`3132    Scope selecting a single member of the organization.3334    - `type: "user"`3536      Scope type. Always `user` for this scope.3738      default: user3940    - `user_id: string`4142      Tagged ID of the member the spend limit applies to.4344  - `Organization object`4546    - `type: "organization"`4748      default: organization4950  - `Workspace object`5152    Scope selecting one workspace of a Claude Console organization.5354    - `type: "workspace"`5556      Scope type. Always `workspace` for this scope.5758      default: workspace5960    - `workspace_id: string`6162      Tagged ID of the workspace the spend limit applies to.6364- `period: optional "daily" or "monthly" or "weekly"`6566  - `"daily"`6768  - `"monthly"`6970  - `"weekly"`7172## Returns7374- `BetaSpendLimit object`7576  A configured spend limit: a cap on metered spend for one scope and period.7778  - `type: "spend_limit"`7980    Object type. Always `spend_limit`.8182    default: spend_limit8384  - `id: string`8586    Unique tagged ID of the spend limit (`spl_...`).8788  - `amount: string or null`8990    Limit amount as a non-negative integer decimal string in the minor unit of `currency` (cents for USD): "50000" is $500.00. `null` means no numeric cap is configured at this scope — see the effective report for whether a limit applies.9192  - `created_at: string`9394    RFC 3339 datetime at which the spend limit was created.9596    format: date-time9798  - `currency: string`99100    ISO 4217 code of the organization's billing currency; the unit for `amount`.101102  - `period: "daily" or "monthly" or "weekly"`103104    Length of the window the limit resets over. `amount` caps spend within each period.105106    - `"daily"`107108    - `"monthly"`109110    - `"weekly"`111112  - `scope: User or SeatTier or RBACGroup or 3 more`113114    What the limit applies to. A tagged union on `type`; each variant carries the identifier for its scope.115116    - `User object`117118      Scope selecting a single member of the organization.119120      - `type: "user"`121122        Scope type. Always `user` for this scope.123124        default: user125126      - `user_id: string`127128        Tagged ID of the member the spend limit applies to.129130    - `SeatTier object`131132      - `type: "seat_tier"`133134        default: seat_tier135136      - `seat_tier: string`137138    - `RBACGroup object`139140      - `type: "rbac_group"`141142        default: rbac_group143144      - `rbac_group_id: string`145146    - `OrganizationService object`147148      - `type: "organization_service"`149150        default: organization_service151152      - `service: string`153154    - `Organization object`155156      - `type: "organization"`157158        default: organization159160    - `Workspace object`161162      Scope selecting one workspace of a Claude Console organization.163164      - `type: "workspace"`165166        Scope type. Always `workspace` for this scope.167168        default: workspace169170      - `workspace_id: string`171172        Tagged ID of the workspace the spend limit applies to.173174  - `updated_at: string`175176    RFC 3339 datetime at which the spend limit was last modified.177178    format: date-time179180## Example181182```bash183curl https://api.anthropic.com/v1/organizations/spend_limits \184    -H 'Content-Type: application/json' \185    -H 'anthropic-version: 2023-06-01' \186    -H "X-Api-Key: $ANTHROPIC_API_KEY" \187    -d '{188          "amount": "50000",189          "scope": {190            "type": "user",191            "user_id": "user_01WCz1FkmYMm4gnmykNKUu3Q"192          },193          "period": "monthly"194        }'195```196197### Response (200)198199```json200{201  "id": "id",202  "amount": "50000",203  "created_at": "2019-12-27T18:11:19.117Z",204  "currency": "USD",205  "period": "monthly",206  "scope": {207    "type": "user",208    "user_id": "user_01WCz1FkmYMm4gnmykNKUu3Q"209  },210  "type": "spend_limit",211  "updated_at": "2019-12-27T18:11:19.117Z"212}213```214
Files main
Menu

Theme