Skip to content
Go to Boltz API

Set a workspace spending limit

client.Admin.Workspaces.SetSpendingLimit(ctx, workspaceID, body) (*AdminWorkspaceSetSpendingLimitResponse, error)
PUT/compute/v1/admin/workspaces/{workspace_id}/spending-limit

Create or replace the absolute lifetime spending ceiling for a workspace. Tracking starts when the limit is first configured. The new limit cannot be lower than accrued usage plus spend reserved by active work. Requires an admin API key.

ParametersExpand Collapse
workspaceID string
body AdminWorkspaceSetSpendingLimitParams
Amount int64

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. An amount of 9007199254740991 (2^53 - 1) is the unlimited sentinel: usage is tracked but never blocked, and amounts at or above half the sentinel are normalized to it.

minimum0
maximum9007199254740991
Currency MilliUsd

Workspace spending limits currently support milli-USD only.

Type param.Field[Lifetime]
const LifetimeLifetime Lifetime = "lifetime"
ReturnsExpand Collapse
type AdminWorkspaceSetSpendingLimitResponse struct{…}

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

AccruedUsage AdminWorkspaceSetSpendingLimitResponseAccruedUsage
Amount int64

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. An amount of 9007199254740991 (2^53 - 1) is the unlimited sentinel: usage is tracked but never blocked, and amounts at or above half the sentinel are normalized to it.

minimum0
maximum9007199254740991
Currency MilliUsd

Workspace spending limits currently support milli-USD only.

Limit AdminWorkspaceSetSpendingLimitResponseLimit
Amount int64

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. An amount of 9007199254740991 (2^53 - 1) is the unlimited sentinel: usage is tracked but never blocked, and amounts at or above half the sentinel are normalized to it.

minimum0
maximum9007199254740991
Currency MilliUsd

Workspace spending limits currently support milli-USD only.

Type Lifetime

Set a workspace spending limit

package main

import (
  "context"
  "fmt"

  "github.com/boltz-bio/boltz-api-go"
  "github.com/boltz-bio/boltz-api-go/option"
)

func main() {
  client := boltzapi.NewClient(
    option.WithBaseURL("https://api.boltz.bio"),
    option.WithAPIKey("My API Key"),
  )
  response, err := client.Admin.Workspaces.SetSpendingLimit(
    context.TODO(),
    "workspace_id",
    boltzapi.AdminWorkspaceSetSpendingLimitParams{
      Limit: boltzapi.AdminWorkspaceSetSpendingLimitParamsLimit{
        Amount: 5000,
      },
      Type: "lifetime",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.AccruedUsage)
}
{
  "accrued_usage": {
    "amount": 5000,
    "currency": "MILLI_USD"
  },
  "limit": {
    "amount": 5000,
    "currency": "MILLI_USD"
  },
  "type": "lifetime"
}
Returns Examples
{
  "accrued_usage": {
    "amount": 5000,
    "currency": "MILLI_USD"
  },
  "limit": {
    "amount": 5000,
    "currency": "MILLI_USD"
  },
  "type": "lifetime"
}