Skip to content

Agent cards

An agent card lets an AI agent pay a business that takes cards (a domain registrar, a host, a software subscription) within limits a person set. It is a virtual Visa card in US dollars, attached to a card wallet that you fund and give the agent a key for. The agent never handles the card number: before each purchase it declares it, and a charge is approved only if a declaration and the wallet’s policy allow it.

A card wallet is an agent wallet with currency: "USD". It shares the key, funding, reclaim and disable endpoints, but spends differently:

Agent wallet Card wallet
Currency XOF, whole F CFA USD, integer cents (2500 = $25.00)
Funded from your merchant XOF balance a separate USD card-issuing balance — never your XOF balance, and nothing is converted
The agent spends by payouts to allowlisted Wave or Orange Money numbers card charges, checked against a declaration
Limits max_payout_amount, max_daily_amount, recipient list the card policy and each card’s own limits
Created with POST /v1/agent-wallets POST /v1/card-wallets

A card wallet cannot make payouts: POST /v1/agent/payouts with its key answers 422 unsupported.

With your sk_test_ key. Every write takes an Idempotency-Key; amounts are USD cents.

Step Call
1. Simulate a top-up of your test card-issuing balance POST /v1/test/issuing/fund {"amount": 50000}
2. Create the wallet and its policy POST /v1/card-wallets {"name", "max_intent_amount", "auto_daily_amount", "max_daily_amount", "no_intent_amount"}
3. Move money into it POST /v1/agent-wallets/{id}/fund {"amount": 20000} — taken from the balance of step 1
4. Create a card POST /v1/agent_cards {"wallet_id", "kind", "mcc_allowlist", "amount_cap"}
5. Issue the agent’s key POST /v1/agent-wallets/{id}/keys — ak_test_…, shown once
Terminal window
curl https://sandbox-api.xaalis.org/v1/card-wallets \
-H "Authorization: Bearer $XAALIS_API_KEY" -H "Idempotency-Key: infra-agent-wallet" \
-H "Content-Type: application/json" \
-d '{"name":"Infra agent","max_intent_amount":5000,"auto_daily_amount":10000,"max_daily_amount":30000,"no_intent_amount":0}'
curl https://sandbox-api.xaalis.org/v1/agent_cards \
-H "Authorization: Bearer $XAALIS_API_KEY" -H "Idempotency-Key: infra-agent-card-1" \
-H "Content-Type: application/json" \
-d '{"wallet_id":"aw_…","kind":"merchant_locked","mcc_allowlist":["5734"],"amount_cap":5000}'

The wallet comes back as an agent_wallet (aw_…, currency: "USD"), the card as a masked agent_card (card_…, brand: "visa", last4). GET /v1/agent-wallets/{id}/balance reads the wallet’s available cents; POST /v1/agent-wallets/{id}/reclaim takes unspent money back and …/disable stops new spending at once. A restricted key needs agent_wallets:read to read and agent_wallets:write to change any of this.

Field Meaning
kind merchant_locked: pinned to the first merchant whose charge is approved; a charge from any other merchant is declined (merchant_mismatch). single_use: cancelled after its first approved charge
mcc_allowlist 1–50 merchant category codes the card may be used at, e.g. 5734 (computer software stores)
amount_cap the most one charge — and one declaration — on this card may be, in cents

GET /v1/agent_cards?wallet_id=aw_… lists a wallet’s cards; remaining_today is what the daily cap still allows on that card, not a balance. POST /v1/agent_cards/{id}/freeze stops a card and …/cancel ends it for good; there is no unfreeze in this version, so issue a new card instead. A wallet holds as many cards as you need — one per merchant is the safest pattern.

Four amounts, in USD cents, counted per calendar day in Dakar time:

Field Meaning
max_intent_amount the largest declaration approved automatically
auto_daily_amount the total of automatically approved declarations in a day (each counts its full max_amount, even if the charge was smaller). Above it, declarations wait for the owner
max_daily_amount the hard ceiling on approved charges in a day, owner-approved ones included. A refund or release does not give the room back
no_intent_amount charges up to this amount need no declaration. Default 0; it can’t exceed max_intent_amount

Read and change it with GET / PATCH /v1/card-wallets/{id}/policy. A PATCH sets the whole policy: send all four values, or no_intent_amount goes back to 0. The next declaration and the next charge use the new values.

Before paying, the agent declares the purchase with its wallet key:

POST /v1/agent/purchase_intents
Authorization: Bearer ak_test_…
Idempotency-Key: renew-example-com
{ "card_id": "card_…", "merchant_name": "Example Registrar", "max_amount": 1500,
"reason": "Renew example.com for one year", "action_id": "renew-example-com" }

It answers 201 with an agent_purchase_intent (pci_…) whose status is:

  • approved — within max_intent_amount and the day’s auto_daily_amount: the agent may pay now.
  • pending_owner — above the automatic limits: it waits for the owner.

It later becomes consumed (a charge used it), declined (the owner refused) or expired (30 minutes after it was created, unused). The agent reads it with GET /v1/agent/purchase_intents/{id}.

  • A declaration reserves nothing. The wallet’s balance is checked when the charge arrives.
  • merchant_name (1–100 characters) is display text for the owner. Xaalis never compares it with the merchant on the charge: the card’s merchant lock and category list decide where it can be used.
  • max_amount can’t exceed the card’s amount_cap (403 forbidden).
  • One charge consumes one declaration: the oldest approved, unexpired one on that card whose max_amount covers it.
  • A wallet holds at most 20 open declarations (422 limit_exceeded).
  • action_id comes from your application, not the model. Sending the same action_id and fields again returns the same declaration — even once it is declined or expired; the same action_id with different fields answers 409 idempotency_conflict. A new purchase needs a new action_id.

How the agent then pays: the card is saved as the payment method on the merchant’s account (revealing the card number is owner-only, in the dashboard), and the agent buys there. The sandbox has no real card numbers: you simulate the merchant’s charge instead.

When a declaration is pending_owner, Xaalis sends the agent_purchase_intent.approval_requested webhook and, if the owner linked WhatsApp, a WhatsApp message. The owner sees the declared merchant, the amount and the reason — in the dashboard or on WhatsApp — and declines, or approves and confirms with their 6-digit owner PIN on a Xaalis page (the link lasts 5 minutes). It is the same PIN as for agent payout approvals, and it is never typed in a chat.

The declaration then becomes approved or declined; the agent polls it and never sees the PIN link. Approval moves no money: the charge must still pass every check below, including max_daily_amount.

Each charge on a card gets an agent_card_authorization (cau_…) with approved and one reason from a closed list. The checks run in this order; the first that fails is the reason:

reason Meaning
card_inactive the card is not active (for example frozen, cancelled or expired)
wallet_inactive the wallet is disabled, or it is not a USD card wallet
merchant_unavailable your Xaalis account is suspended or closed — or, for a live charge, not yet active (still in review)
currency_unsupported the charge is not in USD
merchant_mismatch a merchant_locked card is already pinned to another merchant
mcc_not_allowed the merchant’s category is not in mcc_allowlist
card_limit_exceeded above the card’s amount_cap
intent_required no approved declaration covers it, and it is above no_intent_amount
processing_error Xaalis couldn’t decide safely (for example an earlier charge on the wallet is still being resolved)
daily_cap_exceeded it would take the day’s approved charges past max_daily_amount
insufficient_funds the wallet’s balance is too low
approved all checks passed
timeout no decision in time; the charge is declined

processing_error and timeout are declines too. A timeout is not stored as such: if the attempt had started, Xaalis resolves it in the background and records it as processing_error.

An approved charge holds its amount in the wallet. The merchant then captures it (the money is spent), or the hold is released (it returns to the wallet); a captured charge can be refunded to the wallet. The authorization’s settlement shows held, captured or released.

History — you: GET /v1/card-wallets/{id}/authorizations · …/transactions · …/intents. The agent: GET /v1/agent/card_authorizations · GET /v1/agent/card_transactions. Lists are newest first, with limit and starting_after.

Your sk_test_ key plays the card network:

Terminal window
curl https://sandbox-api.xaalis.org/v1/test/agent_cards/card_…/authorizations \
-H "Authorization: Bearer $XAALIS_API_KEY" -H "Idempotency-Key: charge-1" \
-H "Content-Type: application/json" \
-d '{"amount":1500,"network_merchant_id":"registrar-001","merchant_name":"Example Registrar","mcc":"5734"}'
  • POST /v1/test/agent_cards/{id}/authorizations {amount, currency?, network_merchant_id, merchant_name?, mcc} runs a charge through the same decision as a real one and answers 200 with the authorization — a decline is approved: false, not an error. currency defaults to USD. Reusing the Idempotency-Key returns the same authorization.

  • POST /v1/test/agent_cards/{id}/events {transaction_id, authorization_id, operation, amount} settles it, and answers 202 once the event is queued:

    • capture — up to the authorized amount, once; in the sandbox the unused rest returns to the wallet;
    • release — the whole hold of an uncaptured charge;
    • refund — after a capture, up to the captured amount.

    authorization_id is the one returned by the authorization (mock_…); pick your own transaction_id. The event is checked when it is processed, so read the outcome in GET /v1/card-wallets/{id}/transactions and in the authorization’s settlement.

Test cards always show last4: "4242" and have no card number. A quick run: declare $15 with the agent key (status approved), charge 1500 (approved, the declaration becomes consumed), charge 1500 again (intent_required), then declare $80 to see pending_owner.

A wallet key (ak_test_…) for a card wallet can:

  • read its wallet and balance: GET /v1/agent/wallet, GET /v1/agent/balance (USD cents);
  • list its masked cards: GET /v1/agent/cards (last4, kind, mcc_allowlist, the pinned merchant, amount_cap, remaining_today);
  • declare and read purchases: POST /v1/agent/purchase_intents, GET /v1/agent/purchase_intents/{id};
  • read its card history: GET /v1/agent/card_authorizations, GET /v1/agent/card_transactions.

It can’t create, freeze or cancel cards, change the policy, fund or reclaim the wallet, approve its own declarations, simulate charges, or make payouts. No API returns a card number, expiry date or CVC — to an agent or to you: revealing a card number is owner-only, in the dashboard.

The MCP server and the @xaalis/ai-tools catalog list these tools for the matching key:

Tool Key Does
xaalis_agent_list_cards ak_ the wallet’s masked cards
xaalis_agent_declare_purchase ak_ declare a purchase; the Idempotency-Key is derived from action_id, and the answer says what to do next
xaalis_agent_get_purchase ak_ a declaration’s status, with next
xaalis_agent_list_card_charges ak_ recent authorizations with their reason
xaalis_simulate_card_charge sk_test_ a mock merchant charge on a card (sandbox)

Card wallets and cards are created with the API or in the dashboard; the xaalis CLI has no card commands yet.

Event When
agent_purchase_intent.approval_requested a declaration is above the automatic limits and waits for the owner
agent_card.authorization.approved a charge on an agent card was approved and its amount held
agent_card.authorization.declined a charge was declined; reason says why

Payloads, the reason list and the merchant-name fields are in Webhooks.

Live card issuing is limited and not generally available. When it is enabled for an account:

  • the account is verified (go-live checklist) and Xaalis has switched cards on for it;
  • a signed-in owner does everything in the dashboard — wallets, cards, policy, funding, keys and purchase decisions. Live API keys can’t manage cards (403), so an agent holding your sk_live_ key can’t give itself a card;
  • the USD card-issuing balance is funded separately: XOF is never converted into it;
  • an agent’s ak_live_ key can declare purchases and read its masked cards and history, as in the sandbox.

See also: External agent cards (Mercury) · Agent wallets · AI agents and MCP · Webhooks · Idempotency