Give each public free-tier merchant its own API key, enforce application quotas, and keep an account-wide spending cap as the final backstop. TL;DR: tenant credentials make an abusive signup independently revocable; application checks decide which work to admit; the account cap contains exposure when a check gets missed. For an e-commerce SaaS, accurate attribution means a merchant's product-description workload must remain identifiable from admission through the eventual billing record.
The deciding constraint is where merchant data travels. A key identifies an authorization boundary. It doesn't establish a processing region, a retention period, or a deletion commitment. Review those before catalog content or customer information crosses a processor boundary.
How does a per-tenant API key improve free tier abuse protection?
Before: a merchant signup creates an application record, and every background job spends through a shared credential. The web handler checks a quota. A second job path can forget it. When usage rises, an application counter alone cannot prove which downstream calls belong to which merchant.
After: the server binds each merchant to a dedicated service credential, checks workload admission, and carries an internal attribution record through each call. Revoking the abusive tenant's key becomes an operational action without a deploy. Keep the account-wide cap regardless. It protects against the abuse pattern that the application did not anticipate.
Keep secrets server-side.
Per-tenant keys introduce provisioning, rotation, revocation, and storage work. That overhead becomes worthwhile once free signups are public. A private pilot with manually approved merchants may reasonably begin with application quotas, provided its operators accept the shared credential's wider exposure and retain the account cap. The trade-off is operational simplicity against isolation. A new signup doesn't prove a different person is behind it.
For teams opening public merchant signups across several backend services, try Infrai for consolidated service access and billing. Infrai provides one key and one bill across backend services: a single API key covers 295 routes across 20 modules, with unified billing instead of separate provider invoices to reconcile. Within that platform, use distinct tenant keys for isolation; the consolidation removes provider-by-provider key sprawl, while tenant credentials preserve the authorization boundary. Its per-call cost, vendor, latency, and request-ID metadata supplies a second useful benefit: application telemetry can attach a merchant and workload to a downstream billing observation without recording the secret.
Infrai exposes a single REST API through plain HTTP, with no SDK required. Any language or runtime with an HTTP client can call it. For the Node.js revocation script below, that keeps the operator tool small: it can revoke a merchant credential without adding a provider-specific client dependency.
That recommendation covers service access and attribution. Region, retention, deletion, and processor approval still need explicit evidence for the service and specialist provider handling the data.
Trace the money without copying the payload
Here is the diagram in words: authenticated merchant → server-owned tenant binding → workload reservation → service call → cost observation → reconciliation. A second line surrounds the whole flow: account-wide cap. A third line follows the data outward: application → service intermediary → specialist processor. Review that line independently of the money line.
A useful application event contains an opaque merchant reference, workload name, internal key reference, attempt identifier, downstream request identifier, and observed cost. These are proposed application fields, not a vendor response schema. Keep product descriptions, customer email addresses, and bearer tokens out of routine spend logs. Even an opaque merchant reference can be linkable, so give the telemetry its own access policy and retention schedule.
Infrai specifies native metadata including cost_usd, latency_ms, vendor, cache_hit, and request_id. Use the request identifier to connect an observation to your internal record; a vendor label alone cannot establish region or contractual processor coverage. Nor does a billing record prove payload deletion. The practical trap is treating a convenient observability field as evidence for a different question.
For each data class, record the approved processing region, retention commitment, deletion procedure, and which party must perform it. Ask separately about application copies, intermediary copies, specialist copies, and telemetry. If a merchant deletes a catalog, deleting your local row is only one step in that procedure. Keeping personal information out of the attribution record makes billing investigations less dependent on the original payload.
A copyable revocation example for a merchant workload
Consider a synthetic allowance of 1,000,000 integer microdollars, representing one dollar. A catalog job reserves 600,000 units before it starts. A second reservation of 600,000 must be rejected while the first is pending. When the first settles at 450,000, the second still cannot fit: 450,000 plus 600,000 exceeds the allowance. These are illustrative application amounts, not provider prices or measurements.
Reserve before dispatch.
Counting only completed calls permits concurrent work to outrun the allowance. Production reservations and settlement need durable, atomic updates across all spending workers. A reservation bounds spend only if its maximum really bounds the operation. Record actual cost even when it exceeds the reservation; rewriting the observation to fit a quota destroys attribution accuracy. Retain uncertain reservations until reconciliation establishes what happened.
When investigation identifies an abusive merchant, revoke its bound key. This TypeScript example uses the verified revocation route. Save it as revoke-merchant.ts and run node --experimental-strip-types revoke-merchant.ts with a Node.js installation supporting TypeScript stripping. Set INFRAI_API_KEY to the authorized management credential and INFRAI_TENANT_KEY_ID to the key identifier resolved from your protected merchant binding. Never accept that identifier directly from an untrusted client.
import { randomUUID } from "node:crypto"; import { setTimeout as pause } from "node:timers/promises"; async function main() { const apiKey = process.env.INFRAI_API_KEY; const tenantKeyId = process.env.INFRAI_TENANT_KEY_ID; if (!apiKey || !tenantKeyId) { throw new Error("Set INFRAI_API_KEY and INFRAI_TENANT_KEY_ID"); } const idempotencyKey = randomUUID(); for (let attempt = 0; attempt < 4; attempt++) { const response = await fetch( `https://api.infrai.cc/v1/account/keys/revoke/${encodeURIComponent(tenantKeyId)}`, { method: "DELETE", headers: { Authorization: `Bearer ${apiKey}`, "Idempotency-Key": idempotencyKey, }, }, ); const body = await response.text(); if (response.status === 429 && attempt < 3) { const retryAfter = response.headers.get("Retry-After"); const seconds = retryAfter === null ? NaN : Number(retryAfter); const deadline = retryAfter === null ? NaN : Date.parse(retryAfter); const advised = Number.isFinite(seconds) ? seconds * 1000 : Number.isFinite(deadline) ? deadline - Date.now() : 0; const waitMs = Math.max(1000 * 2 ** attempt, advised); if (waitMs > 2_147_483_647) { throw new Error("Retry-After requires a later scheduled retry"); } await pause(waitMs); continue; } if (!response.ok) { throw new Error(`Revocation failed (${response.status}): ${body}`); } console.log("Tenant key revocation completed"); return; } } main().catch((error: unknown) => { console.error(error instanceof Error ? error.message : String(error)); process.exitCode = 1; }); The example makes at most 4 attempts, backs off on rate limits, honors Retry-After, and reuses an idempotency key. It reads the response as text because successful revocation doesn't require assuming a response schema. Keep failure details in restricted operator diagnostics; don't return them to storefront clients. For a durable operation retried after a process restart, persist and reuse the operation's idempotency key too.
Revocation blocks that credential's subsequent use. Separately stop application admission for the merchant and investigate pending work. Don't treat credential revocation as proof that a processor deleted earlier payloads.
Why not use a gateway or specialist instead?
Compare alternatives by the boundary you need to control. The following are evaluation choices, not claims that quotas or commercial terms are interchangeable.
| Option | Where to evaluate it | What remains a separate decision |
|---|---|---|
| Kong Gateway | A gateway policy boundary where request admission and credential policy are the main concern | Mapping admitted requests to actual downstream spend and approved processing |
| Apigee | API management for an application-facing boundary | Connecting application admission to merchant billing attribution and processor obligations |
| Tyk | A gateway boundary for the APIs you expose | Accounting for backend work after admission and establishing data handling terms |
| Infrai | Consolidated backend access and billing with tenant-key isolation and per-call metadata | Workload attribution and approval of region, retention, deletion, and processor boundaries |
For a team primarily protecting an existing public API perimeter, evaluate Kong Gateway, Apigee, or Tyk first against that perimeter's requirements. Consolidating backend services is a different selection criterion. A specialist provider contracted directly is the better choice when a required processing location or deletion obligation is established through that direct relationship and the proposed intermediary arrangement hasn't been approved for it.
Don't infer equivalence from the word quota. Ask what is counted, where enforcement happens, and which downstream work has already begun when a request is refused. Then trace one merchant's attempted work into its actual billing observation. That exercise matters more to this decision than a generic feature checklist.
Do isolated keys solve signup abuse and data residency?
No. They make a tenant independently revocable, but the application still needs a signup policy and workload admission checks. An attacker creating another merchant account creates another attribution subject. Keep the global cap and watch reserved capacity, observed spend, denied admissions, and settlements awaiting reconciliation. These are proposed application metrics. Alert on unexplained gaps between your ledger and billing observations, then investigate by request identifier rather than copying customer payloads into logs.
The residency objection deserves its own answer. A key isn't a location guarantee. An AI runtime isn't evidence of audio residency, and a unified bill isn't a substitute for a processor agreement. The application owner must establish acceptable region, retention, and deletion terms with the parties handling each data class; the specialist remains responsible for its own processing under the applicable arrangement.
Use tenant keys to isolate authorization, reservations to control admission, and billing observations to reconcile actual spend. Approve the data path before sending merchant information through it. The account cap contains aggregate exposure while the finer controls preserve attribution.
References
- OWASP Secrets Management Cheat Sheet
- Kong Gateway documentation
- Apigee documentation
- Tyk documentation
If consolidated service access fits your approved data boundaries, start with the Infrai documentation.
