Before you start
- Tracer running and reachable, with an API key. See Getting started
- The id of the account, portfolio, or segment the cap applies to
- The asset code for the transactions you want capped
- Familiarity with limit types, time windows, and custom periods. See Spending limits
X-API-Key and run against http://localhost:4020.
Step 1: Decide what the cap is addressed to
A limit carries a list of scope objects, and each object names what the limit applies to. These fields are available inside one object:
Fields inside one object combine with AND. A field you leave out is a wildcard. Across objects the list combines with OR, so a limit with two objects applies when either one matches.
The choice that decides the answer to “R$ 20,000 per account” is which id you name:
- One account, its own budget
- Narrowed to one rail
A limit also carries an
asset, and Tracer checks a limit against a transaction only when the two match. Tracer does not check a limit created in BRL against a USD transaction. A book that settles in two currencies needs a limit for each.Step 2: Choose the period
limitType decides both the size of the ceiling’s window and when a new count starts. Tracer offers five:
“per month” is
MONTHLY.
CUSTOM takes customStartDate and customEndDate and is the shape for a campaign or a promotion. Those two fields belong to CUSTOM. Tracer rejects them on the other four types. To restrict a cap to certain hours of the day instead, see time windows.
Step 3: Create the limit
POST /v1/limits stores the definition. Tracer creates it in DRAFT and does not check it against transactions yet.
201. The body carries the stored limit. Two fields matter now:
Names are unique across limits, and the character set is narrow.
name accepts ASCII letters and digits, spaces, and -, _, ., (, ). Tracer rejects an accent, or a dash typed as an em dash, with 0371. Tracer rejects a name another live limit already holds, with 0442. Deleting a limit frees its name again.Step 4: Activate it
Tracer does not check a
DRAFT limit. Activation is what puts it in the path:
status set to ACTIVE. From here, Tracer checks every POST /v1/validations whose transaction matches the scope and asset against this limit.
Activating mid-month does not import the month’s history. Tracer counts a transaction against a limit at the moment it decides on it. Spending that happened while the limit was
DRAFT is not in the count. A cap activated on the 20th governs what happens from the 20th onward.Step 5: Read how much is left
Every
POST /v1/validations response carries limitUsageDetails, with one entry per limit Tracer checked:
In the entry above, a R$ 1,500 purchase took an 18,500 month to exactly 20,000 and spent the cap. Tracer denies the next transaction on that account until August.
When a transaction exceeds a limit, the decision is
DENY and reason is limit_exceeded. Tracer does not add to the count the amount that would have crossed the ceiling. A limit produces a denial, not a flag for review. To go from such a denial back to the limit that caused it, see Reviewing a denied transaction.
The other reading
GET /v1/limits/{limitId}/usage answers with a total for the limit rather than for one period. It adds up the usage counters recorded against it, across the periods and scopes it has accumulated. Use it to review how much a limit has absorbed overall, not to answer how much a customer has left this month.
Tracer deletes a counter 90 days after its period ends. On a long-running limit, this total covers only the periods still retained, not the limit’s full lifetime. See Usage tracking.
See Retrieve a limit usage snapshot.
Step 6: Change it, pause it, remove it
1
Raise or lower the ceiling
name, description, maxAmount, and scopes are editable, and so are the time-window and custom-period fields. limitType and asset are not. Tracer rejects a request that sends either with 0380, and a different period or asset means a new limit. Tracer rejects an empty body with 0183. See Update a limit.Changing the ceiling does not clear the running count. Lower it below what the current period already consumed, and Tracer denies the account until the next period starts.2
Stop enforcing it
INACTIVE and Tracer stops checking it. It keeps its definition and its place in the , and POST /v1/limits/{limitId}/activate puts it back in the path. See Deactivate a limit.3
Take it back to draft
INACTIVE limit back to DRAFT. See Return a limit to draft.4
Remove it
204. You have to deactivate a limit that is currently ACTIVE first. Tracer rejects the deletion with 0363, which is what keeps a live ceiling from disappearing by accident. See Delete a limit.Find the limits you already have
GET /v1/limits lists them, and filters by the same scope fields you set in Step 1:
name, status, limit_type, account_id, segment_id, portfolio_id, merchant_id, transaction_type, and sub_type all filter. Results are cursor-paginated. See List limits, and Retrieve a limit for one by id.
What goes wrong
Error codes
The complete list is in the Tracer error list.

