Skip to main content
Here’s the full card creation flow at a glance:
Card creation flow

Step 1: Install the admin CLI and log in

The agent-cards-admin CLI is how you manage organizations, API keys, and members. Install it and log in with your email — you’ll receive a magic link to verify:
npm install -g agent-cards-admin
agent-cards-admin login

Step 2: Create an organization

Organizations are the billing unit — all cards, API keys, and cardholders are scoped to an org.
agent-cards-admin orgs create
The CLI will walk you through naming your org and setting a billing email. At the end, it will offer to create an API key for you — say yes. If you skipped that step or need another key later, you can always run:
agent-cards-admin keys create
Save the key that’s returned — it starts with sk_test_ and won’t be shown again.
export AGENTCARD_API_KEY="sk_test_..."

Step 3: Create a cardholder

Cardholders represent the end-users who will hold cards. Create one via the API:
curl -X POST https://api.agentcard.sh/api/v1/cardholders \
  -H "Authorization: Bearer $AGENTCARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"firstName": "Alice", "lastName": "Smith", "dateOfBirth": "1990-01-15", "email": "alice@example.com"}'
Response
{
  "id": "ch_abc123",
  "firstName": "Alice",
  "lastName": "Smith",
  "email": "alice@example.com",
  "dateOfBirth": "1990-01-15T00:00:00.000Z",
  "phoneNumber": null,
  "stripeCardholderId": "ich_1abc123",
  "createdAt": "2026-03-10T12:00:00.000Z",
  "updatedAt": "2026-03-10T12:00:00.000Z"
}

Step 4: Attach a payment method

Set up a payment method for the cardholder via Stripe Checkout:
curl -X POST https://api.agentcard.sh/api/v1/cardholders/ch_abc123/payment-method/setup \
  -H "Authorization: Bearer $AGENTCARD_API_KEY"
Response
{
  "checkoutUrl": "https://checkout.stripe.com/c/pay/cs_test_...",
  "stripeSessionId": "cs_test_abc123"
}
Open the checkoutUrl in a browser to attach a payment method. Then verify it’s attached:
curl https://api.agentcard.sh/api/v1/cardholders/ch_abc123/payment-method/status \
  -H "Authorization: Bearer $AGENTCARD_API_KEY"
Response
{
  "hasPaymentMethod": true,
  "paymentMethodId": "pm_abc123"
}

Step 5: Create your first card

Choose how you want to interact with AgentCard:

Create a card via API

curl -X POST https://api.agentcard.sh/api/v1/cards \
  -H "Authorization: Bearer $AGENTCARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amountCents": 1000, "cardholderId": "ch_abc123"}'
Response
{
  "id": "cm3abc123",
  "cardholderId": "ch_abc123",
  "last4": "4242",
  "expiry": "03/28",
  "spendLimitCents": 1000,
  "balanceCents": 1000,
  "status": "OPEN",
  "createdAt": "2026-03-10T12:00:00.000Z"
}

Get card details

Retrieve the full card number and CVV for your agent to use:
curl https://api.agentcard.sh/api/v1/cards/cm3abc123/details \
  -H "Authorization: Bearer $AGENTCARD_API_KEY"
Response
{
  "id": "cm3abc123",
  "pan": "4242424242424242",
  "cvv": "123",
  "expiry": "03/28",
  "last4": "4242",
  "balanceCents": 1000,
  "spendLimitCents": 1000,
  "status": "OPEN"
}

List cards

curl https://api.agentcard.sh/api/v1/cards \
  -H "Authorization: Bearer $AGENTCARD_API_KEY"

Close a card

curl -X DELETE https://api.agentcard.sh/api/v1/cards/cm3abc123 \
  -H "Authorization: Bearer $AGENTCARD_API_KEY"
See the full API Reference for all endpoints.

Next steps