CreditClawCreditClawDocs
    View as Markdown

    Wallets

    The wallet endpoints let your bot check its balance, view transaction history, retrieve spending guardrails, and request top-ups from the owner.

    All endpoints require bot authentication via the Authorization: Bearer cck_live_... header. See Authentication for details.


    Check Wallet Balance

    Returns the bot's current wallet status, balance, card status, and spending limits.

    MethodGET
    Path/api/v1/bot/wallet/check
    AuthBot API key required

    Request

    No request body or query parameters required.

    Response

    {
      "wallet_status": "active",
      "balance_usd": 50.00,
      "card_status": "active",
      "spending_limits": {
        "per_transaction_usd": 25.00,
        "monthly_usd": 500.00,
        "monthly_spent_usd": 120.50,
        "monthly_remaining_usd": 379.50
      },
      "pending_topups": 0
    }
    
    FieldTypeDescription
    wallet_statusstring"active", "empty", "pending", or "inactive"
    balance_usdnumberCurrent wallet balance in USD
    card_statusstringStatus of the linked card
    spending_limitsobjectCurrent spending limits and usage (present when wallet is active)
    spending_limits.per_transaction_usdnumberMaximum amount per single transaction
    spending_limits.monthly_usdnumberTotal monthly spending budget
    spending_limits.monthly_spent_usdnumberAmount already spent this month
    spending_limits.monthly_remaining_usdnumberRemaining monthly budget
    pending_topupsnumberNumber of pending top-up requests

    If the bot has not been claimed by an owner yet, the response will indicate "pending" status:

    {
      "wallet_status": "pending",
      "balance_usd": 0,
      "card_status": "inactive",
      "message": "Owner has not claimed this bot yet. Share your claim token with your human."
    }
    

    Example

    curl -X GET https://creditclaw.com/api/v1/bot/wallet/check \
      -H "Authorization: Bearer cck_live_abc123..."
    

    Get Transactions

    Returns the bot's recent transaction history.

    MethodGET
    Path/api/v1/bot/wallet/transactions
    AuthBot API key required

    Query Parameters

    ParameterTypeDefaultDescription
    limitinteger50Number of transactions to return (max 100)

    Response

    {
      "transactions": [
        {
          "id": 42,
          "type": "spend",
          "amount_usd": -12.99,
          "balance_after_usd": 37.01,
          "description": "Purchase at Amazon.com",
          "created_at": "2025-01-15T10:30:00.000Z"
        },
        {
          "id": 41,
          "type": "fund",
          "amount_usd": 50.00,
          "balance_after_usd": 50.00,
          "description": "Wallet funded by owner",
          "created_at": "2025-01-14T08:00:00.000Z"
        }
      ]
    }
    
    FieldTypeDescription
    transactionsarrayList of transaction records
    transactions[].idintegerTransaction ID
    transactions[].typestringTransaction type (e.g. "spend", "fund", "refund")
    transactions[].amount_usdnumberTransaction amount in USD (negative for debits)
    transactions[].balance_after_usdnumber | nullWallet balance after this transaction
    transactions[].descriptionstringHuman-readable description
    transactions[].created_atstringISO 8601 timestamp

    Error Responses

    StatusBodyCondition
    403{ "error": "wallet_not_active", "message": "Wallet not yet activated." }Bot has not been claimed by an owner

    Example

    curl -X GET "https://creditclaw.com/api/v1/bot/wallet/transactions?limit=10" \
      -H "Authorization: Bearer cck_live_abc123..."
    

    Request Top-Up

    Sends a top-up request to the bot's owner via email, asking them to add funds to the wallet.

    MethodPOST
    Path/api/v1/bot/wallet/topup-request
    AuthBot API key required

    Request Body

    {
      "amount_usd": 100.00,
      "reason": "Running low on funds for scheduled purchases"
    }
    
    FieldTypeRequiredDescription
    amount_usdnumberYesRequested top-up amount in USD
    reasonstringNoExplanation for the top-up request

    Response

    {
      "topup_request_id": 7,
      "status": "sent",
      "amount_usd": 100.00,
      "owner_notified": true,
      "message": "Your owner has been emailed a top-up request."
    }
    
    FieldTypeDescription
    topup_request_idintegerID of the created top-up request
    statusstringRequest status ("sent")
    amount_usdnumberRequested amount
    owner_notifiedbooleanWhether the owner was notified via email
    messagestringConfirmation message

    Error Responses

    StatusBodyCondition
    400{ "error": "invalid_json", "message": "Request body must be valid JSON" }Malformed JSON body
    400{ "error": "validation_error", "message": "Invalid request body", "details": {...} }Missing or invalid fields
    403{ "error": "wallet_not_active", "message": "Wallet not yet activated. Owner must claim this bot first." }Bot has not been claimed

    Example

    curl -X POST https://creditclaw.com/api/v1/bot/wallet/topup-request \
      -H "Authorization: Bearer cck_live_abc123..." \
      -H "Content-Type: application/json" \
      -d '{
        "amount_usd": 100.00,
        "reason": "Need funds for weekly supply order"
      }'
    

    Get Spending Guardrails

    Returns the bot's current spending guardrails including approval mode (from master guardrails), limits, and procurement controls.

    MethodGET
    Path/api/v1/bot/wallet/spending
    AuthBot API key required

    Request

    No request body or query parameters required.

    Response

    {
      "approval_mode": "ask_for_everything",
      "limits": {
        "per_transaction_usd": 25.00,
        "daily_usd": 100.00,
        "monthly_usd": 500.00,
        "ask_approval_above_usd": 5.00
      },
      "recurring_allowed": false,
      "notes": "Only purchase office supplies",
      "updated_at": "2025-01-10T12:00:00.000Z",
      "approved_categories": ["office_supplies", "software"],
      "blocked_categories": ["gambling", "adult", "crypto"]
    }
    
    FieldTypeDescription
    approval_modestring"ask_for_everything", "auto_approve_under_threshold", or "auto_approve_by_category" — set at the account level via master guardrails
    limits.per_transaction_usdnumberMaximum per-transaction spend
    limits.daily_usdnumberDaily spending budget
    limits.monthly_usdnumberMonthly spending budget
    limits.ask_approval_above_usdnumber | nullPurchases above this amount require human approval (from master guardrails; null if not set)
    recurring_allowedbooleanWhether recurring/subscription purchases are allowed
    notesstring | nullOwner-provided instructions for the bot
    updated_atstringISO 8601 timestamp of last guardrail update
    approved_categoriesarrayList of explicitly approved procurement categories
    blocked_categoriesarrayList of blocked procurement categories

    Error Responses

    StatusBodyCondition
    403{ "error": "wallet_not_active", "message": "Wallet not yet activated. Owner must claim this bot first." }Bot has not been claimed

    Example

    curl -X GET https://creditclaw.com/api/v1/bot/wallet/spending \
      -H "Authorization: Bearer cck_live_abc123..."
    

    Related

    • Authentication — how to authenticate API requests
    • Bots — bot registration and purchase endpoints
    • Webhook Events — listen for wallet.topup.completed, wallet.balance.low, and other wallet events
    • Quick Start — end-to-end guide including wallet funding