Skip to main content

Create Your First Card

This guide walks you through the complete flow of issuing a virtual card.

Prerequisites

  • API key from the Dashboard
  • A user with approved KYC status
  • Funds deposited

The Flow

Step 1: Create a User

If you don’t have an approved user yet:
curl -X POST https://api.ledger.so/v1/applications/user/initiate \
  -H "Api-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]"
  }'
The user must complete KYC via the applicationCompletionLink.

Step 2: Check User Status

curl https://api.ledger.so/v1/users/$USER_ID \
  -H "Api-Key: $API_KEY"
Wait until applicationStatus is approved.

Step 3: Deposit Funds

Get the deposit address:
curl https://api.ledger.so/v1/users/$USER_ID/contracts \
  -H "Api-Key: $API_KEY"
Send USDC to the depositAddress on your preferred chain.

Step 4: Check Balance

curl https://api.ledger.so/v1/users/$USER_ID/balance \
  -H "Api-Key: $API_KEY"
Verify spendingPower is greater than 0.

Step 5: Create an Agent

curl -X POST https://api.ledger.so/v1/agents \
  -H "Api-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "'$USER_ID'",
    "name": "my-first-agent",
    "description": "Test agent"
  }'
Save the id as $AGENT_ID.

Step 6: Issue a Card

curl -X POST https://api.ledger.so/v1/agents/$AGENT_ID/cards \
  -H "Api-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "purpose": "Test purchase",
    "type": "single",
    "maxAmount": 5000
  }'
Save the id as $CARD_ID.

Step 7: Get Card Credentials

curl -X POST https://api.ledger.so/v1/cards/$CARD_ID/details \
  -H "Api-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "summary": "Test purchase",
    "expectedAmount": 1000
  }'
Use the returned credentials to make a purchase.

What’s Next?