Raise a customer's spending limit with their consent
Accepts a raise quoted with POST .../spend_limit/quotes (operation raise): the limit becomes the quote's amount, and the customer's consent (the quote's consent_text, when and from where) is kept in the change log as evidence. Only from the customer's own login, before the quote's expires_at (10 minutes, never past the end of the billing period it was made in), in that same period, and only while the limit and the shop's settings are as they were quoted. The same quote sent again answers what the first request answered and changes nothing more. An Idempotency-Key header is required, new for each change, so a retry after a timeout answers the first answer (for a day) even if the change was made but its answer was lost; the key with another body is refused. The customer gets an email confirming it (notification subscription:spend_limit_changed, when it is on) and you get the usage:spend_limit_changed webhook. A plain PUT still sets, lowers or clears the limit.
AuthorizationBearer <token>A secret, trusted or limited token. See Authentication.
customer_id*stringThe Comecero customer id, or me.
subscription_id*stringThe customer's subscription.
Idempotency-Key*stringRequired. Names one change: the same request again with the same key (after a timeout, say) changes nothing more and answers as the first one did, for a day. 1 to 128 printable ASCII characters, sent once; missing or empty is refused (400, reference UbV150). Use a new random key, such as a UUID, for each change you mean to make. The same key with another body is refused (409, reference UbV151).
^[ -~]{1,128}$1 <= length <= 128application/json- body
A raise the customer accepted: the quote's amount and quote_id, with their consent. These are the only fields; anything else is refused (400, reference UbV145).
amount*stringThe quote's amount, the new limit (400, reference UbV174, when it is not).
quote_id*stringThe quote, from POST .../spend_limit/quotes with operation raise.
length <= 64consent_accepted*booleanMust be true: the customer accepted the quote's consent_text. Only the customer's own login can give it (400, reference UbV174).
expected_revision*integerThe revision read with GET (409, reference UbV153, when it changed since).
0 <= valueThe spending limit now (without changes).
application/json- response
A customer's spending limit on one subscription's usage, in the usage plan's currency. The limit covers usage charges only, before tax: not the plan's regular price, and not tax, which is added on the invoice as usual. Usage paid with prepaid credit counts toward it too, and usage past it in a period is neither billed nor drawn from credit: the limit is shared out across the usage first, and only that share is paid with credit or cash. A limit of 0 means no usage spend. A change applies at once to usage not billed yet; what this period's bills already committed still counts, so a limit below it means no more usage spend this period. The customer gets a warning email at 50 and 80% and an email at 100%; at 100% you get the usage:spend_limit_reached webhook, once per period and limit (again after a change). While your shop uses spending limits, a period that has ended, and its late usage, is billed under the limit in force at its end: the customer's own limit and your allow_spend_limit and default_spend_limit as they were then. While it uses none (allow_spend_limit false and default_spend_limit null), an ended period whose first bill runs then has no limit, and late usage for a period billed under a limit keeps the limit that bill used. Amounts are decimal strings.
object?stringsubscription_id?stringcurrency?stringThe currency of the subscription's usage plans, which every amount is in.
amount?|The customer's own limit. Null when they set none, when the shop does not let customers set one (customer_can_set false), or when it was set for a plan in another currency.
default?|The shop's limit for customers who set none (default_spend_limit). Null when there is none.
effective?|The limit now, amount or else default. Null when there is none.
source?|Where effective comes from, customer (their own) or default (the shop's). Null when there is no limit.
"customer""default"nullspent?stringThe usage spend this period so far, before tax: what the period's bills already took (committed) and the usage not billed yet, credit paid and cash, every usage plan of the subscription.
committed?stringThe part of spent that bills of this period already charged.
remaining?|What is left of this period's limit, before tax, never below 0, with this period's one-time extra (burst) while it is in force. Null when there is no limit.
reset_at?|When the period ends and spent starts again from 0. Null when not known.
date-timecustomer_can_set?booleanWhether the shop lets customers set their own limit (allow_spend_limit).
revision?integerGoes up by one with every change; 0 before any. Send it back as expected_revision to change the limit only if nobody changed it since.
0 <= valuechanges?array<>Every change, newest first (the last 500), as evidence for a dispute. Secret and trusted tokens only: left out for a shopper's token.
burst_offered?booleanWhether the customer can ask for a one-time extra this period now (POST .../spend_limit/quotes with operation burst): the shop offers one, the limit in force is above 0, and this period has had none. Left out when the shop never set spend_limit_burst.
burst?This period's one-time extra, in any status. Left out when the period has none.
effective_limit_amount?stringThe most this period's usage may be charged, before tax: the limit in force (effective) plus the one-time extra while it is in force, never below what this period's bills already committed. After the extra is taken back, the limit, or what was committed if that is more. Left out when the period has no extra (the most is then effective).
curl -X PATCH 'https://api.comecero.com/api/v1/customers/string/usage/string/spend_limit' \ -H 'Idempotency-Key: 3f2b6c1e-9d4a-4e8b-a1f7-5c0d2e9b8a64' \ -H 'Content-Type: application/json' \ -d '{ "amount": "80", "quote_id": "usq_5b7d9f1a3c5e4b6d8f0a2c4e6b8d0f1a", "consent_accepted": true, "expected_revision": 3}'{ "object": "usage_spend_limit", "subscription_id": "SB0123456789", "currency": "USD", "amount": "80", "default": null, "effective": "80", "source": "customer", "spent": "41.5", "committed": "0", "remaining": "38.5", "reset_at": "2026-12-01T00:00:00Z", "customer_can_set": true, "revision": 4}Get a customer's spending limit GET
The spending limit on one subscription's usage: the customer's own, the shop's default and the one in force, with the `revision` to send back when you change it, and this period's one-time extra (`burst`, `burst_offered`). Secret and trusted tokens also get every change made to it (`changes`). A shopper's token reads only its own customer (`me` works). Here `customer_id` is the Comecero customer id, not your own id.
Set a customer's spending limit PUT
Sets or clears the customer's own spending limit on one subscription's usage. The limit covers usage charges only, before tax (not the plan's regular price); 0 means no usage spend. Usage past it is neither billed nor drawn from prepaid credit. The shop must let customers set one (`allow_spend_limit` in `usage_customer_settings`); this holds for your own tokens too. Every change is logged with who made it, when and from where. Raising the limit may bill usage already recorded this period that the old limit held back. A new limit applies at once to usage not billed yet; what this period's bills already committed still counts, so a limit below it means no more usage spend this period. `expected_revision` is required, so a change made since you read it is never overwritten. Send an `Idempotency-Key` header so a retry is harmless: for a day, the same key with the same `amount` and `expected_revision` changes nothing and answers what the first request answered (the limit and `revision` as that change left them), even after a later change; the key with another body is refused. The key is noted before the change is made, so a retry of a request that never answered never makes the change twice. An empty header counts as none. Setting the same amount again changes nothing. A shopper's token sets only its own customer's (`me` works). To raise a limit with the customer's recorded consent, quote it (`POST .../spend_limit/quotes`) and accept it with `PATCH`.