@leash/registry-utils in TypeScript, every
endpoint here maps 1:1 to a prepare*/get* helper — so you can
mix-and-match: mint over HTTP today, switch to the SDK later, or
have a Python service mint while a Node worker submits, all hitting
the same Turso event store and showing up on the same explorer.
| Endpoint | What it does |
|---|---|
POST /v1/agents/prepare | Mint a brand-new agent. Returns an unsigned tx + asset addr. |
GET /v1/agents/{mint} | Identity, treasury PDA, and agent-token summary. |
GET /v1/agents/{mint}/treasury/balances | SOL + SPL balances on the treasury PDA. Auto-arms the indexer. |
- Prepare → Submit lifecycle — the contract every prepare endpoint follows.
- Treasury endpoints — provision ATAs, withdraw SPL/SOL.
- Explorer tracking — exact follow-ups to make events show up on the explorer.
Mint a new agent
prepareAgentMint:
under the hood the API calls the Metaplex Agents API
(POST https://api.metaplex.com/v1/agents/mint), which returns a
fully-built unsigned transaction with the asset address pre-derived.
The Leash API forwards that as a regular prepared
envelope and pre-arms
the indexer watchlist for the new asset + treasury
PDA, so the explorer surfaces the mint the moment the signed tx
lands.
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
wallet | base58 pubkey | ✅ | Owner of the resulting Core asset. Pays for the mint and signs the tx. |
name | string (≤ 64) | ✅ | Human-readable agent name; stored on-chain. |
uri | URL | ✅ | Off-chain JSON metadata URI (NFT-style). |
description | string (≤ 2048) | ✅ | Stored in the on-chain identity blob. |
services | AgentService[] | Public service endpoints. The API auto-injects a receipts entry pointing at /v1/receipts/{agent} unless you pass receipts_url: false. | |
registrations | array | Cross-registry registrations (agent_id + agent_registry). | |
supported_trust | string[] | Trust mechanisms (tee, zkp, attestation, …). | |
type | string | On-chain type field. Defaults to 'agent'. | |
receipts_url | URL or false | Override or disable the auto-injected receipts service entry. | |
client_reference | string (≤ 256) | Free-form caller reference echoed onto the event row. |
Response
asset_address is deterministically derived by Metaplex during the
mint API call, so you can persist it (next to event_id) before
the transaction is even broadcast.
Sign + submit
The mint transaction has a single required signer:wallet. Sign it
locally and POST to /v1/submit:
GET /v1/agents/$ASSET returns the freshly-minted
agent’s identity + treasury, and the explorer shows the mint at
https://explorer.leash.market/tx/<signature>.
What happens automatically:
- A
preparedevent of kindagent.createis created withagent_asset = asset_address. Visible in/v1/eventsand on the explorer’s “Recent activity” feed. - The asset + treasury PDA are added to the indexer watchlist so future on-chain activity for them surfaces without any extra API calls.
- After submit, the event progresses through
submitted → confirmedautomatically. The submit endpoint returns once the tx is broadcast; the background poller stamps the final state.
GET /v1/agents/{asset}/treasury/balances
once. It’s a free read-only call that registers every SPL ATA the
treasury owns on the indexer watchlist, so incoming SPL transfers
surface as agent.treasury.fund events on the explorer. See
Explorer tracking for the full per-event
matrix.Get an agent summary
lsh_test_* key looking up a mainnet-only mint
returns 404.

