Skip to main content
PATCH
Update an agent budget in USD
Read and update monthly agent budgets in US dollars. Use the bring-your-own-keys prefix for this workspace mode. The calls use the workspace API key’s BILLING_API scope. Writes run as the key’s service account owner.

Base URL

Dedicated deploymentsReplace api.langdock.com with <your-deployment-url>/api/public in all requests.

Prerequisites

  • API key with the BILLING_API scope
  • The key owner is a service account that has not been deleted and has an active Admin membership

Update a budget

PATCH /agents/{agentId} accepts budget, budgetMode, or both. Send at least one.
budget is a monthly amount:
  • { "type": "limited", "amount": 40 } sets a cap. The amount must be greater than zero.
  • { "type": "unlimited" } keeps a separate budget with no numeric cap. Spend can still be reported. This is different from none.
  • { "type": "none" } removes the separate agent budget. The agent then follows workspace and member limits.
budgetMode chooses when that budget is used:
  • always (Always) counts usage against the agent budget immediately, including API calls, and does not consume the member’s allowance.
  • on_limit_hit (After user limits) counts usage against the member’s limits first. After the member reaches a personal limit, usage counts against the agent budget.
An active agent budget still follows the workspace limit and the workspace agent limit behavior from Billing Workspace Settings. Removing a budget does not turn those controls off. The response is the agent object with budgetPeriodSpend set to null. Read the agent again to get spend.
Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on API Key Best Practices.

Authorizations

Authorization
string
header
required

API key as Bearer token. Format "Bearer YOUR_API_KEY"

Path Parameters

agentId
string<uuid>
required

Body

application/json
budget
object

Monthly budget in the mode currency. none follows workspace/member limits; unlimited keeps a separate budget without a numeric cap.

budgetMode
enum<string>
Available options:
always,
on_limit_hit

Response

Updated resource. Spending is null; GET retrieves spending.

Monthly budget in mode currency, subject to workspace enforcement. always uses agent allowance; on_limit_hit uses it after the member allowance. Spend is null when user-level usage is hidden and always null on PATCH.

id
string<uuid>
required
name
string | null
required
budget
object
required

Monthly budget in the mode currency. none follows workspace/member limits; unlimited keeps a separate budget without a numeric cap.

budgetMode
enum<string>
required
Available options:
always,
on_limit_hit
budgetPeriodSpend
number | null
required
Required range: x >= 0