Set up credit
Revision checked credit operation. Secret and trusted tokens require the applicable resource permission. New writes require header idempotency. Immutable rates do not reprice existing agreements. Core validates exact conversion, current funding, prepared work and protected billing boundaries.
AuthorizationBearer <token>A secret, trusted or limited token. See Authentication.
id*stringResource identity owned by this account and mode.
Idempotency-Key*stringSame key and canonical body replay the saved result. A different body returns CreditRequestConflict; pending work returns CreditRequestPending.
^[ -~]+$1 <= length <= 128application/json- body
expected_revision*integer0 <= valuecredit_entitlement_id?stringExisting balance to link, if unambiguous.
metered_entitlement_ids*array<string>effective_from*stringWhole UTC hour. Volume, gauge and latest changes require the next regular boundary.
date-timeinitial_amount?stringExact invariant decimal string, at most six decimal places.
^(0|[1-9][0-9]*)(\.[0-9]{1,6})?$initial_credits?stringExact invariant decimal string, at most six decimal places.
^(0|[1-9][0-9]*)(\.[0-9]{1,6})?$description?stringMerchant note.
length <= 200at_zero?string"charge""stop"balance_alerts?Success.
application/json- response
command_id?stringcompleted?unknowncredit_revision?integer0 <= valueeffective_from?stringdate-timefunding_effective_from?stringdate-timeagreement_id?stringcredit_entitlement?A metered entitlement bills a metric on a pinned rate plan version. A credit entitlement holds prepaid credit. See https://docs.comecero.com/docs/usage-billing/entitlements
linked_entitlement_ids?array<string>old_entitlement_ids?array<string>replacement_entitlement_ids?array<string>balance?numbercredit_balance?string|nullcurl -X POST 'https://api.comecero.com/api/v1/usage/agreements/string/credit_setup' \ -H 'Idempotency-Key: string' \ -H 'Content-Type: application/json' \ -d '{ "expected_revision": 0, "metered_entitlement_ids": [], "effective_from": "2026-12-01T00:00:00Z", "initial_credits": "1000"}'{ "agreement_id": "agr_cust_8412", "credit_revision": 1, "credit_entitlement": { "object": "entitlement_grant", "entitlement_id": "credit_cust_8412", "kind": "credit", "billing_agreement_id": "agr_cust_8412", "metric_id": "met_ai_tokens", "rate_plan_id": "ai_tokens_standard", "rate_plan_version": 1, "funding_source_entitlement_id": "credit_cust_8412", "overage_policy": "allow", "drawdown_priority": 0, "capacity": null, "status": "active", "effective_from": "2026-11-01T00:00:00Z", "effective_to": null, "customer_id": "cust_8412", "billing_region": "us", "test": false }, "linked_entitlement_ids": [], "funding_effective_from": "2026-12-01T00:00:00Z", "balance": 10, "credit_balance": "1000", "command_id": "command_setup_1", "completed": true}