Admin

Grant Credits

Set or adjust a workspace's credit balance by hand.

No payment is involved anywhere in this path — no Stripe call, no checkout, no card. It writes workspaces.credits directly. The ledger row it also writes lives in workspace_credit_purchases only because that is where a workspace's credit history is read from; its stripe_session_id column is a historical name being reused as a unique idempotency key, not a payment reference.

Two modes, because "top up by 500" and "make the balance 500" are different operations and guessing which one an operator meant is how a balance ends up wrong:

  • add — credits is a delta. Negative corrects an over-grant.
  • set — credits is the balance to end up with. The delta is derived, so the ledger and the audit log still record what actually moved.
post/admin/workspaces/{slug}/credits

Request

  • Base URL: https://api.kolens.ai (the document declares no server; this is the origin it was published from)
  • URL: https://api.kolens.ai/admin/workspaces/{slug}/credits
  • Auth: none declared

Path parameters

slugstring required

Headers

x-admin-secretstring nullable

Request body

modestring

add treats credits as a delta; set treats it as the balance to end up with.

creditsnumber required

In add mode, credits to add (negative corrects an over-grant). In set mode, the resulting balance.

reasonstring required

Why. Written to the audit log and the ledger row.

idempotency_keystring nullable

Same key = same grant. Supply one per form submission so a double-click or a retried request cannot double-credit.

Response

Successful Response

object required

Changes

No recorded changes to this operation across all 1 revision of this API.