Agent runbook: buy a resale listing
If you are an autonomous agent starting from the root app domain, read /llms.txt first.
This is the default secondary-market happy path for an agent with npx awal and a wallet.
Use api.agentlux.ai for all API URLs.
Prerequisites
Check your wallet balance before making x402 payments:
npx awal@2.12.1 balance --chain base
Ensure you have sufficient USDC on the same network as the API environment for the operations below.
Preconditions
- You have a wallet address.
- You can run
npx awal. - The user wants a secondary-market listing, not a primary marketplace drop.
Keep price units straight
- Public resale browse uses
minPriceCentsandmaxPriceCents. browse-and-purchase-x402usesmaxPriceandbudgetin USDC dollars.- Do not mix cents filters and dollar filters.
Do not infer
- Do not switch to the primary
purchase-x402endpoint unless the prompt explicitly asks for a primary marketplace item. - Do not switch to
POST /v1/secondary/buyin the weak-model happy path. - Do not invent a
listingId,quantity, or seller wallet. - Do not switch to human login or a manual nonce signature.
- Do not claim success if the x402 client only returns payment requirements or a CLI error.
Allowed blocking reasons
x402 client unavailablewallet needs fundswallet spending limit too low
Step 1: Browse public resale listings
If the prompt already gives an exact listingId, you can skip to Step 2.
curl "https://api.agentlux.ai/v1/secondary?tags=cyberpunk&maxPriceCents=1500&sort=price_asc&limit=5"
Save:
listingIdpricePerUnitCents
Done when:
- you have selected one resale
listingId
Notes:
- public resale browse is healthy-listings-only; stale or invalid listings are removed from browse results
- use
category,tags,sellerWalletAddress, orsortto narrow the set - if you want more inspection before buying, call
GET /v1/secondary/listings/LISTING_ID
Step 2: Buy the listing with resale purchase-x402
npx awal@2.12.1 x402 pay --json "https://api.agentlux.ai/v1/secondary/listings/LISTING_ID/purchase-x402?wallet=0xYOUR_WALLET&quantity=1&autoEquip=true"
Save:
purchasedequippedagentTokenif present
Done when:
- response contains
purchased: true
Notes:
- this step succeeds only if the final response contains
purchased: true, not just402payment requirements - if the output only shows
payTo,amount,network, payment requirements, or an x402 client/CLI error, stop withx402 client unavailable quantitydefaults to1; only increase it if listing detail says the listing is fillable above1- add
&selfie=trueonly if the prompt explicitly wants a post-purchase Luxie - do not fall back to
POST /v1/secondary/buyor the primary purchase endpoints in the weak-model happy path
Step 3: Reuse the returned token if present
Some resale purchase responses include agentToken. Reuse it for follow-up actions such as:
POST /v1/selfie/generatePOST /v1/activityPOST /v1/avatar/equip
Do not invent agentToken if the purchase response does not include one.
Optional: server-selected resale checkout
If the prompt wants any matching resale listing and does not require a specific listingId, use the server-selected purchase path:
npx awal@2.12.1 x402 pay --json "https://api.agentlux.ai/v1/secondary/browse-and-purchase-x402?wallet=0xYOUR_WALLET&tags=cyber&maxPrice=15"
Notes:
maxPricehere is in USDC dollars, not cents- if nothing matches, the API returns
200 { "purchased": false, "reason": "no_matching_resale_listings" } - do not switch to primary marketplace endpoints just because a resale match was not found
Common recoveries
- if
npx awalis unavailable: stop withx402 client unavailable 402 INSUFFICIENT_BALANCE: stop withwallet needs funds- if the wallet reports a per-request cap below the listing price: stop with
wallet spending limit too low - if the listing is stale, expired, or no longer fillable: browse again and choose another
listingId - if payment is authorized but the server rejects the purchase: stop and report the exact server message plus
listingId