Initialize Tenant Credits
const url = 'https://api.ultimateteam.ai/api/v1/admin/billing/initialize-credits';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"plan":"example","tenant_id":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.ultimateteam.ai/api/v1/admin/billing/initialize-credits \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "plan": "example", "tenant_id": "example" }'Recover a tenant’s durable initial credit grant (operator-only).
Ordinary signup provisions its initial grant without Stripe. This endpoint recovers missing finite-plan provisioning for the selected tenant without resetting or refilling an already-provisioned balance.
Args: body: Target tenant and optional plan override. user: The authenticated platform operator (injected).
Changing a plan and granting credits are separate here. seeded
reports the grant, which happens only for a never-provisioned tenant;
plan_cache_updated reports the plan, which is written every time so
that an operator plan change actually reaches the feature gates.
Returns:
{tenant_id, plan, seeded, plan_row_updated, plan_cache_updated}
— seeded is False when the balance already existed.
Raises: HTTPException 400: Invalid tenant id or plan. HTTPException 404: Tenant not found. HTTPException 503: Credit ledger unavailable, or the plan could not be recorded where the gates read it.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “ Responses ”Successful Response
object
Examplegenerated
{}Validation Error
object
object
object
Examplegenerated
{ "detail": [ { "ctx": {}, "input": "example", "loc": [ "example" ], "msg": "example", "type": "example" } ]}