Crédito
Crédito de la organización: saldo, límite y modo.
GET /v1/credit
My organization's credit
API key con credit:read · Rol: viewer o superior
Any signed-in member, or an API key with the scope `credit:read`. The organization's credit account, in signed integer USD micros: `balance`, `credit_limit` (0 when prepaid), `reserved` (held by calls in progress) and `available`, which is `balance + credit_limit - reserved`. `mode` is `off`, `shadow` (what would be denied is recorded, nothing is) or `enforce`; `low_balance` is true when `available` is below the organization's threshold. An organization created after credit control began gets its account the first time it is read. 401 when the token is missing, expired or invalid; 503 when credit is not available.
Respuestas
200Successful Response · CreditResponseNombre Tipo Requerido Descripción availableintegersí `balance + credit_limit - reserved`, in signed USD micros. balanceintegersí Signed integer USD micros (1 USD = 1,000,000). credit_limitintegersí USD micros the balance may go below zero: 0 when prepaid. low_balancebooleansí True when `available` is below the low-balance threshold. low_balance_thresholdintegersí USD micros below which `available` counts as low. modestringsí How strictly credit gates calls: `off` never, `shadow` records what it would deny, `enforce` denies. (off, shadow, enforce) reservedintegersí USD micros held by calls in progress. 401Missing, expired or invalid token. · ErrorResponse403Role below the one in `x-min-role`, a suspended organization, or an API key without the operation's `x-api-key-scope` (any key, if the operation has none). · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Credit is not available yet. · ErrorResponsedefaultDefault Response · ErrorResponse
GET /v1/credit/ledger
My organization's credit ledger
API key con credit:read · Rol: viewer o superior
Any signed-in member, or an API key with the scope `credit:read`. The append-only ledger of the organization's credit, newest first, `limit` (1 to 100, default 50) per page; pass `next_cursor` as `cursor` for older entries. Each entry has its `kind` (`grant`, `limit_change`, `charge`, `adjustment`, `provisional_charge` or `reconciliation`), `amount_micros` and `balance_after_micros` in signed integer USD micros, an opaque `reference` and, for calls, the `call_id`. 401 when the token is missing, expired or invalid; 403 for an API key without `credit:read`; 422 for an invalid cursor or limit; 503 when credit is not available.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
cursor | query | string | null | ||
limit | query | integer |
Respuestas
200Successful Response · LedgerResponseNombre Tipo Requerido Descripción itemsLedgerEntryResponse[]sí items[].actorstringsí Who or what posted it. items[].amount_microsintegersí Signed integer USD micros (1 USD = 1,000,000). items[].balance_after_microsintegersí Signed integer USD micros (1 USD = 1,000,000). items[].call_idstring (uuid) | nullThe call, for call charges. items[].created_atstring (date-time)sí items[].idstring (uuid)sí items[].kindstringsí (grant, limit_change, charge, adjustment, provisional_charge, reconciliation) items[].referencestringsí Opaque idempotency reference. next_cursorstring | nullsí Pass as `cursor` for older entries. 401Missing, expired or invalid token. · ErrorResponse403Role below the one in `x-min-role`, a suspended organization, or an API key without the operation's `x-api-key-scope` (any key, if the operation has none). · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Credit is not available yet. · ErrorResponsedefaultDefault Response · ErrorResponse