# How to sell accounts and API keys to AI agents

Identity and access · How-to · Published 2026-09-15. Canonical page: https://zeroclick.ai/resources/sell-accounts-and-api-keys

A purchase should leave the buyer with access it can actually use. For an API subscription, that means an account, the right entitlement and a working key - not just a payment receipt.

ZeroClick's stateful seller integration handles the purchase and asks your backend to provision that access. Your service owns the account and generates the key. After provisioning, the buyer uses your API directly. The important design problem is making this account behave like the rest of your product through renewals, retries, refunds and later human sign-in.

## Use a standing account only when the product needs one

A single lookup often needs no durable account. A hosted database, recurring research subscription or prepaid API balance usually does. Start with the [integration chooser](/resources/choose-a-zeroclick-integration) if that distinction is unclear.

The [stateful integration](https://docs.zeroclick.ai/integrate/stateful-sellers) is a storefront-level designation configured with ZeroClick. It uses subscription, subscription-with-usage, credit or free-trial plans, not pay-as-you-go. Arrange that setup before promising this purchase path to customers.

## Keep account identity separate from caller identity

Use `accessId` as the durable handle for the account provisioned through ZeroClick. It persists across renewals, top-ups and plan changes. Store its association with your own account ID.

`agentId` describes the caller. `buyerId`, when available, identifies the owner behind one or more agents. Neither replaces `accessId` as the stateful account key. If a person buys through one agent and returns through another, creating accounts by agent ID would fragment access they already own.

Treat verified email as an account-linking input, not permission to merge arbitrary workspaces. A match may identify a user in your system; that user still needs your normal authority to join a company tenant or administer shared data. See the [identity guide](/resources/identity-and-access-for-agents).

## Apply account updates once, even when they arrive twice

The account write describes the complete desired state. It carries a `stateVersion` and cumulative credit information. Apply a newer version and ignore a duplicate or older version. Make the version check, entitlement update and credit adjustment one transaction.

Consider an illustrative prepaid account:

| Arrival | Stored position before arrival | Correct effect |
| --- | --- | --- |
| Version 1, lifetime grant $20 | No account | Create the account and apply the $20 grant |
| Version 1 again | Version 1 already stored | No additional credit |
| Version 3, lifetime grant $35 | Version 1, lifetime grant $20 | Apply the additional $15, using the current full state |
| Version 2 arrives late | Version 3 already stored | Ignore it; do not revert the plan or balance |

After the first $20 grant, suppose the buyer spends $8. Its remaining balance is $12. Version 3 adds $15, bringing the balance to $27 - not $35. If a later update reports the first $5 reversal, the balance becomes $22. Replaying that update changes nothing.

Refunds and disputes increase the cumulative reversal total. Apply the net grant/reversal change and clamp the spendable balance at zero, using the helpers in the [stateful access reference](https://docs.zeroclick.ai/resources/stateful-access-reference). Keep the recorded lifetime totals even when a new billing period starts.

## Say ready only when the account works

Creating a database row does not mean an index is warm, a tenant is provisioned or a license is usable. The stateful contract allows a `provisioning` response with a retry hint while setup continues. ZeroClick repeats the account write until the account is active.

Provisioning must itself tolerate retries. Use the same durable account record to find the resource already being created; do not launch a new tenant for every callback. Return active only after a key issued for that account will reach a usable service.

Track usable access separately from payment state. The [failure contract](https://docs.zeroclick.ai/resources/stateful-access-reference#retries-timeouts-and-failures) covers both reserved and already-captured payments: permanent delivery failure releases the reservation or triggers a refund. A received callback is not yet a usable account.

## Mint a key; do not put a secret in the account record

The key request is separate from the account write. Generate the key in your own system, retain its hash and return the plaintext key once. ZeroClick passes it to the buyer without storing the key.

Choose a remint policy deliberately. Rotating replaces the previous key; additive creates another. Rotation is simpler for a single consumer but can break an existing integration if the buyer retrieves a replacement without coordinating its deployment. Explain the behavior in the offer and account UI.

Verify account callbacks using the stateful verifier, not the ordinary paid-request guard: the signatures have different purposes. Preserve raw request bytes and the original path for verification. A parsed and reserialized body is not an equivalent signed message.

## Let a human recover the purchase

With verified-email policy `requested`, purchase can proceed without an email. If the person later claims the agent credential, a newer account write supplies the verified email. Your handler should accept that update without provisioning another account or granting the same credit again.

Use `required` only when the service genuinely cannot be delivered without the email. It blocks the purchase until the buyer completes the claim. The [plan documentation](https://docs.zeroclick.ai/concepts/plans-and-pricing) describes the tradeoff.

## Review the lifecycle, not only the first purchase

Before release, exercise duplicate and out-of-order writes, top-ups after spending, plan switches, delayed provisioning, revocation, key reminting and a late-arriving verified email. Also test your own authorization after access expires; direct API calls no longer pass through the ZeroClick proxy.

ZeroClick's own verification, run from the dashboard, writes a test account whose id starts with `zacc_verify_` and whose plan slug is `zeroclick-verification` (a $0 subscription for 24 hours), then mints a key for it. Accept that plan like any other, and ignore or delete the account afterwards; a handler that rejects unknown plan slugs fails the check.

Use [failure and retry design](/resources/handle-agent-purchase-failures) for the recovery cases and the [pilot guide](/resources/measure-an-agent-commerce-pilot) to measure purchase-to-usable-access time. A successful integration preserves one customer history across the whole sequence.

## Keep reading

- [How to choose an integration for selling your API to AI agents](/resources/choose-a-zeroclick-integration)
- [How to verify AI agents and control what they can access](/resources/identity-and-access-for-agents)
- [How to handle failed AI agent purchases and retries](/resources/handle-agent-purchase-failures)
- [How to measure an AI agent commerce pilot](/resources/measure-an-agent-commerce-pilot)
- [ZeroClick docs: integrate / stateful sellers](https://docs.zeroclick.ai/integrate/stateful-sellers)
