reseller

POST /v1/reseller/ai/credits/clients/{org_id}

Give one of your clients AI credit, or take unspent credit back.

Усі кінцеві точки reseller

Автентифікація

Надішліть ключ API як маркер носія (bearer token). Ключ повинен мати дозвіл reseller.manage; ключ без нього відхиляється з кодом 403, а не 404.

Де вказується ідентифікатор вашої організації

Ця кінцева точка приймає ідентифікатор вашої організації безпосередньо в URL як org_id. Підставте його в шлях — немає заголовка чи параметра запиту, які б замінили це.

Ідентифікатор вашої організації знаходиться на екрані API-ключів у вашій панелі керування, поруч із самим ключем. Це той самий ідентифікатор у кожному вашому запиті.

Спробувати

Замініть усе в кутових дужках власними значеннями, а заповнювач ключа — ключем із вашої панелі керування.

curl -X POST https://api.zinndigital.com/v1/reseller/ai/credits/clients/{org_id} \
  -H "Authorization: Bearer zdk_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "delta_micros": <integer>, "reason": <string> }'

Увійшли в систему? Консоль API у вашій панелі керування автоматично підставляє ваш реальний ідентифікатор організації та ваш власний ключ, а також виконує запит до робочого API, щоб ви могли побачити справжню відповідь. Відкрийте цю кінцеву точку в консолі API

Деталі

Moves credit between your pool and one client's balance in one transaction: a positive `delta_micros` gives, a negative one takes back. A client who has already **spent** the credit cannot be taken below zero — the request is refused and names what is left. A client that is not yours is refused with the same code and message as one that does not exist, so this cannot be used to discover whether an organization id is real. This is the manual route, for a trial, a goodwill gesture, or a bundle sold offline. The self-serve route is your client buying a pack from you, which draws on the same pool. Requires `reseller.manage`.

Параметри

НазваТипОбов'язковеЩо це таке
org_id (path)UuidТакThe client organization whose balance moves. Must be one of yours.
org_id (query)UuidНіWhich of YOUR organizations is acting. Not the client.

Тіло запиту

НазваТипОбов'язковеЩо це таке
delta_microsintegerТакSigned USD micros. Positive gives credit to the client, negative takes unspent credit back. Zero is refused — a ledger row that means nothing.
reasonstringТакWhy. Required, for the same reason a staff adjustment requires one: a movement of somebody's money with no stated cause is unanswerable three months later.

Відповідь

НазваТипОбов'язковеЩо це таке
pool_balance_microsintegerТак
client_balance_microsintegerТак
typical_callsintegerТакRoughly how many AI questions the client's new balance buys. An **illustration** — a long article costs many times a short question.

Помилки, які може повертати ця кінцева точка

401 · 403 · 404 · 422 · 429