reseller

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

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

Všechny koncové body reseller

Autentizace

Zašlete API klíč jako nosný token (bearer token). Klíč musí mít oprávnění reseller.manage; klíč bez něj je odmítnut s kódem 403, nikoli 404.

Sem patří ID vaší organizace

Tento koncový bod přebírá ID vaší organizace přímo v URL jako org_id. Dosaďte jej do cesty – neexistuje žádná hlavička ani parametr dotazu, které by to udělaly místo toho.

ID vaší organizace najdete na obrazovce API klíčů ve vašem přehledu, hned vedle samotného klíče. Je to stále stejné ID v každém volání, které provedete.

Vyzvednout

Nahraďte cokoli v závorkách vlastními hodnotami a zástupný symbol klíče klíčem z vašeho řídicího panelu.

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> }'

Přihlášeni? Konzole API ve vašem dashboardu automaticky doplní vaše skutečné ID organizace i váš vlastní klíč a odešle požadavek na živé API, abyste viděli reálnou odpověď. Otevřete tento koncový bod v konzoli API

Podrobnosti

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`.

Parametry

NázevTypPožadovánoCo to je
org_id (path)UuidAnoThe client organization whose balance moves. Must be one of yours.
org_id (query)UuidNeWhich of YOUR organizations is acting. Not the client.

Tělo požadavku

NázevTypPožadovánoCo to je
delta_microsintegerAnoSigned USD micros. Positive gives credit to the client, negative takes unspent credit back. Zero is refused — a ledger row that means nothing.
reasonstringAnoWhy. 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.

Odpověď

NázevTypPožadovánoCo to je
pool_balance_microsintegerAno
client_balance_microsintegerAno
typical_callsintegerAnoRoughly how many AI questions the client's new balance buys. An **illustration** — a long article costs many times a short question.

Chyby, které může tento koncový bod vrátit

401 · 403 · 404 · 422 · 429