Skip to content

Initialize Tenant Credits

POST
/api/v1/admin/billing/initialize-credits
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.

Media typeapplication/json
InitializeCreditsRequest

Request body for operator credit initialization.

object
plan
Any of:
string
tenant_id
required
Tenant Id

Tenant UUID to initialize.

string
Examplegenerated
{
"plan": "example",
"tenant_id": "example"
}

Successful Response

Media typeapplication/json
Response Initialize Tenant Credits Api V1 Admin Billing Initialize Credits Post
object
key
additional properties
any
Examplegenerated
{}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{
"detail": [
{
"ctx": {},
"input": "example",
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}