احراز هویت
یک کلید API را به عنوان یک توکن حامل ارسال کنید. این کلید باید دارای مجوز billing.payment.manage باشد؛ کلیدی که فاقد آن باشد با خطای 403 رد میشود، نه 404.
این نقطه پایانی هیچ شناسه سازمانی را دریافت نمیکند. کلید شما در حال حاضر سازمان مربوطه را مشخص میکند و پاسخ در همان محدوده ارائه میشود.
امتحان کنید
هر چیزی را که داخل براکتهای زاویهدار قرار دارد با مقادیر خودتان جایگزین کنید، و نگهدارنده کلید را با کلیدی از داشبورد خود جایگزین نمایید.
curl -X PUT https://api.zinndigital.com/v1/ai/credits/settings \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "auto_topup_enabled": <boolean> }'وارد شدهاید؟ کنسول API در داشبورد شما شناسه سازمان واقعی و کلید خودتان را پر میکند و درخواست را روی API زنده اجرا میکند تا بتوانید پاسخ واقعی را ببینید. این نقطه پایانی را در کنسول API باز کنید
جزئیات
Automatic top-up is **off by default** and only the customer can turn it on. When it is on, running below the threshold buys the chosen pack once, with an hour between attempts so a declining card cannot be retried in a loop. Requires `billing.payment.manage` — turning this on is a decision to let us charge a saved card, which is the same audience as managing a provider key.
بدنه درخواست
| نام | نوع | الزامی | چیست |
|---|---|---|---|
auto_topup_enabled | boolean | بله | — |
auto_topup_pack_code | string | خیر | — |
auto_topup_threshold_micros | integer | خیر | `0` keeps the shared low-balance threshold. Any other value below `min_threshold_micros` is a `422` — but **only when `auto_topup_enabled` is true**: refusing to let somebody sw… |
auto_topup_monthly_cap_micros | integer | خیر | `0` uses the computed default. A ceiling smaller than one top-up is a `422`: it is not a strict setting, it is an off switch wearing one — every attempt would exceed it and noth… |
پاسخ
| نام | نوع | الزامی | چیست |
|---|---|---|---|
state | AiCreditState | بله | — |
packs | AiCreditPack[] | بله | — |
settings | AiCreditSettings | بله | The customer's standing instruction about topping up, and what has become of it. Owner, 2026-08-24, reading `/ai` on production: *"The auto top section doesnt allow you to selec… |
history | AiCreditHistoryLine[] | بله | The 25 most recent movements, newest first. |
funding_routes | AiProviderFunding[] | بله | Who pays for the next call, per provider. Read on the SAME request as the balance, so a screen cannot render a funding claim from one moment beside a balance from another. |
spends | AiCreditSpend[] | بله | Everything this credit buys — the metered surfaces derived from the engine's own meter, the credit-only spends that write no usage row, and the fixed-price AI products. |
خطاهایی که این نقطه پایانی میتواند برگرداند
401 · 403 · 422 · 429