reseller
POST /v1/reseller/ai/credits/clients/{org_id}
Give one of your clients AI credit, or take unspent credit back.
Упълномощаване
Изпратете API ключ като токен за носене. Ключът трябва да притежава разрешението 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, за да можете да видите действителния отговор. Отворете този крайpoint в 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_micros | integer | Да | Signed USD micros. Positive gives credit to the client, negative takes unspent credit back. Zero is refused — a ledger row that means nothing. |
reason | string | Да | 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_micros | integer | Да | — |
client_balance_micros | integer | Да | — |
typical_calls | integer | Да | Roughly how many AI questions the client's new balance buys. An **illustration** — a long article costs many times a short question. |
Грешки, които този крайpoint може да върне
401 · 403 · 404 · 422 · 429