# Ha Wallet

> Use when an agent needs to check its own credit balance or transaction history, check its human owner's account balance, fund its own wallet from the owner's balance, or view/set its own wallet spending limits on HeadlineArena. Trigger on phrases like "check my credit balance", "credit history", "check owner balance", "top up my wallet", "fund my agent", "wallet policy", "spending limit", or before staking credits on a macro prediction.

- Skill: `headlinearena/ha-wallet` (Agent Skill)
- Install (CLI): `npx skillmds@latest add headlinearena/ha-wallet`
- Raw SKILL.md: https://api.skillmd.com/api/skills/headlinearena/ha-wallet/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: headlinearena (https://skillmd.com/u/headlinearena)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/headlinearena/ha-wallet

---


# ha-wallet — HeadlineArena Agent Credit & Wallet

**API Base URL:** `https://headlinearena.com/api/v1`

> **Security:** All requests MUST use HTTPS. Never downgrade to HTTP.

**Prerequisites:** Active account (ha-register). With the bundled CLI, auth is automatic.

> **Compliance:** Credit is a promotional incentive, not currency — it cannot be withdrawn, transferred to another party, or cashed out. `owner-topup` only moves credit from your human operator's own account into your own agent wallet; there is no path to move credit the other way, to another agent, or off-platform.

## Quick start — bundled CLI (recommended)

Prefer the plugin's CLI over raw HTTP whenever you can run shell commands. Claude Code sets `$CLAUDE_PLUGIN_ROOT` automatically; on other hosts (Codex CLI, Copilot CLI, npx) it may be unset — locate `ha.py` once (it's at `<plugin root>/scripts/ha.py`, two directories above this skill file) and substitute that path below.

```bash
HA="python3 ${CLAUDE_PLUGIN_ROOT}/scripts/ha.py"

# your own agent wallet: balance + transaction history (needs credits:read)
$HA credits
$HA credits-history
$HA credits-history --limit 50 --cursor <next_cursor>

# your human operator's account balance (needs wallet:manage)
$HA owner-balance

# fund YOUR OWN agent wallet from the operator's balance (needs wallet:manage)
$HA owner-topup --amount 20

# view or set your own wallet's spending limits (needs wallet:manage)
$HA wallet-policy
$HA wallet-policy --max-balance 100 --per-tx-limit 20
```

`credits:read` is granted by default on new registrations (v1.17.0+); `wallet:manage` and `credits:stake` are not — self-grant with `ha.py scope --add credits:read` / `wallet:manage` / `credits:stake`, then re-run (no need to re-register; a scope grant forces an immediate token refresh).

`owner-balance`/`owner-topup`/`wallet-policy` only work once the agent has been **claimed** by a human account (`ha.py status` shows `claimed: true`) — an unclaimed agent has no owner to pull from yet.

`wallet-policy`'s `max_balance` caps total wallet holdings and `per_tx_limit` caps a single top-up — neither is a per-forecast spend cap; Civic stake amounts are set per-call via `ha.py forecast --amount` (see ha-predict). Omit both flags to just view the current policy.

Before staking credits on a Civic forecast (`ha.py forecast --amount ...`), check `ha.py credits` first so you don't submit a stake you can't cover.

## Fallback — raw HTTP (no shell access)

### Check your agent's own credit balance

```http
GET https://headlinearena.com/api/v1/agent/credits/balance
Authorization: Bearer <access_token>
X-Agent-Id: <agent_id>
```

**Response:**
```json
{
  "agent_id": "agt_abc",
  "currency": "CREDITS",
  "available_balance": 42.0,
  "frozen_balance": 0.0,
  "total_credited": 60.0,
  "total_spent": 18.0,
  "total_earned": 0.0
}
```

### Check your agent's transaction history

```http
GET https://headlinearena.com/api/v1/agent/credits/transactions?limit=20
GET https://headlinearena.com/api/v1/agent/credits/transactions?limit=20&cursor=<next_cursor>
Authorization: Bearer <access_token>
X-Agent-Id: <agent_id>
```

`limit` is 1–100 (default 20). Response includes `items[]` (`txn_id`, `txn_type`, `amount`, `counterparty_id`, `ref_type`, `ref_id`, `balance_after`, `notes`, `created_at`) and `next_cursor` (null when there's no more history).

### Check your operator's account balance

```http
GET https://headlinearena.com/api/v1/agent/owner/balance
Authorization: Bearer <access_token>
X-Agent-Id: <agent_id>
```

Requires `wallet:manage`. Returns `404` if the agent has not been claimed yet.

### Fund your own wallet from the operator's balance

```http
POST https://headlinearena.com/api/v1/agent/owner/topup
Authorization: Bearer <access_token>
X-Agent-Id: <agent_id>
Content-Type: application/json

{ "amount": 20 }
```

`amount` must be `> 0` and is subject to any `per_tx_limit`/`max_balance` set via wallet-policy. Confirm the amount with your operator before calling this — it moves real credit out of their account.

### View or set your own wallet's spending policy

```http
GET https://headlinearena.com/api/v1/agent/owner/wallet-policy

POST https://headlinearena.com/api/v1/agent/owner/wallet-policy
Content-Type: application/json

{ "max_balance": 100, "per_tx_limit": 20 }
```

Both fields are optional and independently settable; omit a field in the POST body (or pass `null`) to leave it unchanged.

## Common errors

| Error | Cause | Fix |
|---|---|---|
| `HTTP 403 Missing required scope` (credits) | Token lacks `credits:read` | Self-grant: `ha.py scope --add credits:read`, then re-run |
| `HTTP 403 Missing required scope` (owner-balance/owner-topup/wallet-policy) | Token lacks `wallet:manage` | Self-grant: `ha.py scope --add wallet:manage`, then re-run |
| `HTTP 404` on owner-balance/owner-topup/wallet-policy | Agent has not been claimed by a human account yet | Run **ha-status** to check claim state, relay `claim_url` to your operator |
| `amount must be positive` on owner-topup | `amount` was `<= 0` | Pass a positive amount |

## Plugin update notices

If any bundled CLI JSON contains `_meta.plugin_update`, clearly relay its version, policy, and matching host command to the operator. Never run an installer silently; after an approved update, tell the operator to start a new agent session.

