/api/orgs/{org_id}/budgets/{budget_id}/keysReplace a shared budget's keys
Keys named here move to this budget (a key draws from at most one shared budget); keys it held that are not named are detached. Shared budgets (scope_kind: keys) only. Org admin or the provisioning key.
Authentication: Bearer API key in the Authorization header
Path parameters
org_idstringrequiredYour organization id (uuid).
GET /api/whoamireturns it.budget_idstringrequiredBudget id.
Request body
api_key_idsarray<string>requiredEvery key the budget should hold.
Responses
200The budget with its new keys.
Response
budget_idstringrequiredperiodstringrequiredYYYY-MM, or*for recurring.scope_kindenumrequiredkeysis a shared budget;keyis an older per-key budget.api_key_idstring | nullrequiredidentity_idstring | nullrequiredalias_idstring | nullrequiredpool_idstring | nullrequireddeployment_idstring | nullrequiredlimit_nano_usdintegerrequiredThe cap, integer nano-USD. 0 is a hard zero cap.
reserved_nano_usdintegerrequiredIn flight, integer nano-USD.
settled_nano_usdintegerrequiredSpent this month, integer nano-USD.
remaining_nano_usdintegerrequiredInteger nano-USD.
created_by_kindenumrequiredcreated_by_api_key_idstring | nullrequiredThe authoring key, when a key wrote the row.
namestring | nullShared budgets only.
reset_periodenumShared budgets only.
api_key_idsarray | nullShared budgets only: the keys drawing from it.
401Missing, unknown or revoked API key.
Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
403The key is not a provisioning key (inference keys are refused, reads included), or it is a customer-plan key.
Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
404Unknown organization, budget or key.
Response
errorstringrequiredHuman-readable message.
codestringStable machine reason, when the route defines one (for example
pro_required).actionstringStable remediation action, when the route defines one.
detailsobjectCustomer-safe string facts the caller needs to act (for example a suggested identifier).
422Not a shared budget, or body validation failed.
Request
curl -X PUT 'https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/budgets/c4a2e8f1-7b3d-4e9a-8c15-3f0d6b2a9e71/keys' \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"api_key_ids": [
"6d1f8a2b-4c3e-4f5a-9b7c-2e8d0a1f3b4c",
"0b9d4f6e-2a1c-4e8b-9f37-5c6d2e1a8b40"
]
}'Response
{
"budget_id": "c4a2e8f1-7b3d-4e9a-8c15-3f0d6b2a9e71",
"period": "*",
"scope_kind": "keys",
"api_key_id": null,
"identity_id": null,
"alias_id": null,
"pool_id": null,
"deployment_id": null,
"limit_nano_usd": 200000000000,
"reserved_nano_usd": 0,
"settled_nano_usd": 41200000000,
"remaining_nano_usd": 158800000000,
"created_by_kind": "api_key",
"created_by_api_key_id": "6b1d2f4e-3c8a-4f0e-9a21-7e5c0d9b4a33",
"name": "Interns",
"reset_period": "monthly",
"api_key_ids": [
"6d1f8a2b-4c3e-4f5a-9b7c-2e8d0a1f3b4c",
"0b9d4f6e-2a1c-4e8b-9f37-5c6d2e1a8b40"
]
}https://api.experientiallabs.ai/api/orgs/3f6c2a1e-8b7d-4c2a-9e51-6a0d4b2f7c10/budgets/c4a2e8f1-7b3d-4e9a-8c15-3f0d6b2a9e71/keys