reseller
POST /v1/reseller/ai/credits/clients/{org_id}
Give one of your clients AI credit, or take unspent credit back.
Pengesahan
Hantar kunci API sebagai token pembawa. Kunci tersebut mesti membawa kebenaran reseller.manage; kunci yang tidak mempunyainya akan ditolak dengan 403, bukan 404.
Tempat ID organisasi anda diletakkan
Titik akhir ini mengambil ID organisasi anda dalam URL itu sendiri, sebagai org_id. Gantikannya ke dalam laluan — tiada pengepala atau parameter pertanyaan yang akan melakukan sebaliknya.
ID organisasi anda terletak pada skrin kekunci API dalam papan pemuka anda, di sebelah kekunci itu sendiri. Ia adalah ID yang sama dalam setiap panggilan yang anda buat.
Cuba
Gantikan apa sahaja di dalam kurungan sudut dengan nilai anda sendiri, dan pemegang tempat kunci dengan kunci dari papan pemuka anda.
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> }'Sudah log masuk? Konsol API dalam papan pemuka anda mengisi id organisasi sebenar dan kunci anda sendiri, serta menjalankan permintaan terhadap API langsung supaya anda boleh melihat respons sebenar. Buka penamat ini dalam konsol API
Butiran
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`.
Parameter
| Nama | Jenis | Diperlukan | Apakah ia |
|---|---|---|---|
org_id (path) | Uuid | Ya | The client organization whose balance moves. Must be one of yours. |
org_id (query) | Uuid | Tidak | Which of YOUR organizations is acting. Not the client. |
Badan permintaan
| Nama | Jenis | Diperlukan | Apakah ia |
|---|---|---|---|
delta_micros | integer | Ya | 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 | Ya | 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. |
Respons
| Nama | Jenis | Diperlukan | Apakah ia |
|---|---|---|---|
pool_balance_micros | integer | Ya | — |
client_balance_micros | integer | Ya | — |
typical_calls | integer | Ya | Roughly how many AI questions the client's new balance buys. An **illustration** — a long article costs many times a short question. |
Ralat yang boleh dikembalikan oleh titik akhir ini
401 · 403 · 404 · 422 · 429