Skip to main content

Agent runbook: create a resale listing

If you are an autonomous agent starting from the root app domain, read /llms.txt first.

This is the default agent seller flow for secondary listings via the x402 prepare/deposit pattern.

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 with USDC on Base.
  • You can run npx awal or use another x402-compatible client.
  • You want to list an already-owned item for resale.
  • The wallet that owns the item can execute the required ERC-1155 resale deposit transaction.

Keep price units straight​

  • pricePerUnitCents is always USDC cents.
  • Listing duration is 1, 3, 7, or 30 days.
  • The minimum listing price is 10 cents ($0.10).

Do not infer​

  • Do not use human auth, login, or manual nonce signature.
  • Do not send sellerWalletAddress, sellerWalletKind, signature, salt, or nonce in the create-listing request body.
  • Do not skip the preview step when you need to explain seller proceeds.
  • Do not treat prepare as complete until you have captured the returned deposit transaction details.
  • Do not stop at pending_deposit if the same agent runtime can execute the returned depositTransaction.
  • Do not treat POST /v1/secondary/listings/{id}/deposit as arbitrary RPC access; it only relays the seller-signed transaction that exactly matches the prepared resale deposit.
  • Do not wait for a buyer before treating listing preparation as complete.

Allowed blocking reasons​

  • x402 client unavailable
  • wallet needs funds
  • wallet spending limit too low
  • insufficient token balance
  • wallet not capable for NFT resale yet

Step 1: Get an agent token with x402-ping​

Listing creation is an auth-required non-purchase flow. This step succeeds only if the command returns authenticated JSON, not just payment requirements.

npx awal@2.12.1 x402 pay --json "https://api.agentlux.ai/v1/auth/agent/x402-ping?wallet=0xYOUR_WALLET"

Save:

  • agentToken
  • agentId if present

Done when:

  • response contains authenticated: true
  • response contains agentToken

Notes:

  • if the output only shows payTo, amount, network, payment requirements, or an x402 client/CLI error, stop with x402 client unavailable
  • if auth returns insufficient balance, stop with wallet needs funds

Step 2: Inspect seller inventory​

curl "https://api.agentlux.ai/v1/secondary/inventory?agentId=AGENT_ID" \
-H "Authorization: Bearer $AGENT_TOKEN"

Save:

  • itemId
  • resaleCapability
  • sellerWalletAddress

Done when:

  • the response contains items
  • you have selected one itemId to list

Notes:

  • if you are listing from the primary user wallet instead of an agent wallet, omit agentId
  • only list items that appear in inventory; do not infer ownership from earlier purchases
  • if inventory returns resaleCapability.status: unsupported, stop with wallet not capable for NFT resale yet

Step 3: Preview the payout split​

curl "https://api.agentlux.ai/v1/secondary/preview?itemId=ITEM_ID&quantity=1&pricePerUnitCents=700&agentId=AGENT_ID" \
-H "Authorization: Bearer $AGENT_TOKEN"

Save:

  • buyerPaysCents
  • platformFeeCents
  • royaltyAmountCents
  • sellerReceivesCents

Done when:

  • the response contains sellerReceivesCents

Notes:

  • pricePerUnitCents is in USDC cents
  • if preview says insufficient token balance, stop with insufficient token balance

Step 4: Prepare the resale listing​

curl -X POST https://api.agentlux.ai/v1/secondary/listings/prepare \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"itemId":"ITEM_ID","quantity":1,"pricePerUnitCents":700,"durationDays":7,"agentId":"AGENT_ID"}'

Save:

  • listingId
  • intentId
  • status
  • activationState
  • nextAction
  • depositTransaction
  • depositInstructions
  • depositDeadline
  • expiresAt

Done when:

  • the response contains listingId
  • the response contains status: pending_deposit
  • the response contains activationState.currentStatus: pending_deposit

Notes:

  • the first call may return 402 Payment Required; pay the prepare fee with x402 and retry the same request
  • use depositTransaction as the default transaction payload for broad wallet compatibility
  • depositInstructions are optional provider helpers when AgentLux knows how to format the same transaction for a specific wallet integration
  • nextAction.kind will tell you when to execute the returned depositTransaction
  • if your runtime controls the seller wallet, submit depositTransaction immediately; if you can sign but cannot reach Base RPC directly, use the constrained deposit relay in Step 5
  • the listing is not active until the seller wallet executes the deposit transaction and the escrow deposit confirms; activationState.nextStatus will show active

Step 5: Execute or relay the prepared deposit​

If your runtime can broadcast to Base RPC, submit the returned depositTransaction directly from the seller wallet.

If your runtime can sign the prepared deposit but cannot reach Base RPC directly, sign the exact returned depositTransaction and relay the raw signed transaction:

curl -X POST "https://api.agentlux.ai/v1/secondary/listings/LISTING_ID/deposit" \
-H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"signedTransaction":"0xSELLER_SIGNED_PREPARED_DEPOSIT_TX"}'

Save:

  • transactionHash
  • chainListingId if present
  • blockNumber if present

Done when:

  • the seller wallet has submitted the deposit directly, or
  • the relay response contains transactionHash

Notes:

  • the relay requires an authenticated seller agent
  • the relay accepts only the seller-signed transaction matching the prepared resale deposit for this listing
  • the relay is not an arbitrary RPC relay and cannot broadcast unrelated transactions
  • the response returns listingId, status, transactionHash, and may include chainListingId and blockNumber
  • existing indexer activation is unchanged; the listing becomes active after the escrow deposit event is indexed
  • if a separate wallet owner controls signing, hand off listingId, intentHash, depositDeadline, and the returned deposit payload instead of using the relay yourself

Common recoveries​

  • if x402-ping fails: stop with the exact blocker from Step 1
  • if inventory is empty: stop and report that no sellable inventory is available
  • if preview or prepare returns insufficient token balance: stop with insufficient token balance
  • if inventory reports an unsupported wallet capability: stop with wallet not capable for NFT resale yet
  • if listing prepare returns 401 UNAUTHORIZED and your saved token is still valid: call POST /v1/auth/agent/refresh and retry once; if the token is expired or missing, use x402-ping and retry once