{"openapi":"3.1.0","info":{"title":"Leash API","version":"0.1.0","description":"Public Leash API. Mirrors @leash/registry-utils over HTTP using a prepare/send split. Network is selected by API key prefix (`lsh_test_*` => devnet, `lsh_live_*` => mainnet)."},"tags":[{"name":"health","description":"Liveness + version probes (unauthenticated)."},{"name":"agents","description":"Agent identity, treasury, token reads."},{"name":"identity","description":"Agent identity registration prepares."},{"name":"executive","description":"Executive registration + delegation prepares."},{"name":"delegation","description":"SPL spend-delegation prepares."},{"name":"treasury","description":"Treasury provision/withdraw prepares."},{"name":"token","description":"Agent → token association prepares."},{"name":"submit","description":"Signed-transaction broadcast and tracking."},{"name":"events","description":"Event lifecycle reads."},{"name":"receipts","description":"x402 receipt ingestion + reads."},{"name":"indexer","description":"Indexer status (watchlist + cursor health)."},{"name":"webhooks","description":"Outbound webhook subscriptions and deliveries."},{"name":"metrics","description":"Per-key usage and event rollups."},{"name":"payment-links","description":"Hosted x402 payment links served by `/x/{id}` (the \"Stripe Payment Links\" of x402). Network-scoped via the API key."},{"name":"seller-utils","description":"Read-only seller-kit helpers (`networks`, `facilitator`, `parse-price`, `pay-to`). Mirrors the `@leash/seller-kit` exports for polyglot SDKs and UI dropdowns."},{"name":"buyer","description":"Buyer-kit endpoints — quote, policy gate, payment prepare/execute, receipt finalize/verify, and network/currency catalogs. Full HTTP parity with `@leash/buyer-kit` for polyglot SDKs."},{"name":"admin","description":"Operator-only API key issuance. Requires the operator secret in `Authorize → AdminSecret` (or `Authorization: Bearer <secret>` / `X-Admin-Secret`). Returns 503 if `LEASH_API_ADMIN_SECRET` is not configured on this server."}],"components":{"securitySchemes":{"ApiKey":{"type":"http","scheme":"bearer","description":"Per-customer key. `lsh_test_*` => devnet, `lsh_live_*` => mainnet. Send as `Authorization: Bearer <key>` or `X-Api-Key: <key>`."},"AdminSecret":{"type":"http","scheme":"bearer","description":"Operator secret for `/v1/admin/*`. Send as `Authorization: Bearer <secret>` or `X-Admin-Secret: <secret>`. Never expose this to end users."}},"schemas":{"ProtocolFeeBlock":{"type":"object","properties":{"bps":{"type":"integer","minimum":0,"maximum":10000},"pct":{"type":"string"},"authorities":{"type":"object","properties":{"solana-mainnet":{"type":"string"},"solana-devnet":{"type":"string"}},"required":["solana-mainnet","solana-devnet"]}},"required":["bps","pct","authorities"]},"HealthResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"ts":{"type":"string"},"protocol_fee":{"$ref":"#/components/schemas/ProtocolFeeBlock"}},"required":["ok","ts","protocol_fee"]},"AdminApiKeyRecord":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"]},"prefix":{"type":"string"},"last4":{"type":"string"},"created_at":{"type":"string"},"disabled_at":{"type":"string","nullable":true}},"required":["id","label","network","prefix","last4","created_at","disabled_at"]},"AdminCreateApiKeyResponse":{"type":"object","properties":{"key":{"$ref":"#/components/schemas/AdminApiKeyRecord"},"plaintext":{"type":"string","description":"Raw key value. Returned ONCE; the server never stores it."}},"required":["key","plaintext"]},"ApiError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"detail":{"nullable":true}},"required":["error","message"]},"AdminCreateApiKeyBody":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"]}},"required":["label","network"]},"PreparedTransaction":{"type":"object","properties":{"base64":{"type":"string"},"message_base64":{"type":"string"},"recent_blockhash":{"type":"string"},"last_valid_block_height":{"type":"integer"},"fee_payer":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"signers":{"type":"array","items":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}},"required":["base64","message_base64","recent_blockhash","fee_payer","signers"]},"CreateAgentEcho":{"type":"object","properties":{"asset_address":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"treasury":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"blockhash":{"type":"string"},"last_valid_block_height":{"type":"integer"}},"required":["asset_address","treasury","blockhash"]},"AgentService":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64},"endpoint":{"type":"string","format":"uri"}},"required":["name","endpoint"]},"AgentRegistration":{"type":"object","properties":{"agent_id":{"type":"string","minLength":1},"agent_registry":{"type":"string","minLength":1}},"required":["agent_id","agent_registry"]},"CreateAgentBody":{"type":"object","properties":{"wallet":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Owner pubkey. Pays for the mint and is the authority on the resulting Core asset.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"name":{"type":"string","minLength":1,"maxLength":64},"uri":{"type":"string","format":"uri","description":"NFT-style metadata URI stored on-chain. Typically a JSON file describing the agent."},"description":{"type":"string","minLength":1,"maxLength":2048},"services":{"type":"array","items":{"$ref":"#/components/schemas/AgentService"}},"registrations":{"type":"array","items":{"$ref":"#/components/schemas/AgentRegistration"}},"supported_trust":{"type":"array","items":{"type":"string"}},"type":{"type":"string","minLength":1,"maxLength":64,"description":"On-chain `type` field; defaults to 'agent'."},"receipts_url":{"anyOf":[{"type":"string","format":"uri"},{"type":"boolean","enum":[false]}],"description":"Override the auto-injected `services[name='receipts']` entry. Pass `false` to skip injection entirely (self-hosters that don't run the Leash API)."},"client_reference":{"type":"string","maxLength":256}},"required":["wallet","name","uri","description"]},"Receipt":{"type":"object","properties":{"receipt_hash":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"agent":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"nonce":{"type":"integer","minimum":0},"decision":{"type":"string"},"kind":{"type":"string"},"tx_sig":{"type":"string","nullable":true},"payment_requirements_hash":{"type":"string","nullable":true},"ingested_at":{"type":"string"},"raw":{"type":"object","properties":{"v":{"type":"string","enum":["0.1"]},"kind":{"type":"string","enum":["spend","earn"],"default":"spend"},"agent":{"type":"string"},"nonce":{"type":"integer","minimum":0},"ts":{"type":"string"},"policy_v":{"type":"string"},"request":{"type":"object","properties":{"method":{"type":"string"},"url":{"type":"string"},"body_hash":{"type":"string","nullable":true},"headers_hash":{"type":"string","nullable":true}},"required":["method","url","body_hash"]},"decision":{"type":"string","enum":["allow","deny","rejected"]},"reason":{"type":"string","nullable":true},"price":{"type":"object","nullable":true,"properties":{"amount":{"type":"string"},"currency":{"type":"string"},"network":{"type":"string"},"asset":{"type":"string"},"fee":{"type":"string","nullable":true},"gross":{"type":"string","nullable":true},"feeBps":{"type":"integer","nullable":true},"feeAuthority":{"type":"string","nullable":true}},"required":["amount","currency"]},"facilitator":{"anyOf":[{"type":"string","enum":["payai","corbits","svmacc","self","local"]},{"type":"string","format":"uri"},{"nullable":true}]},"tx_sig":{"type":"string","nullable":true},"payment_requirements_hash":{"type":"string","nullable":true},"response":{"type":"object","nullable":true,"properties":{"status":{"type":"integer"},"body_hash":{"type":"string","nullable":true}},"required":["status"]},"prev_receipt_hash":{"type":"string","nullable":true},"receipt_hash":{"type":"string"}},"required":["v","agent","nonce","ts","policy_v","request","decision","reason","price","facilitator","tx_sig","response","prev_receipt_hash","receipt_hash"]}},"required":["receipt_hash","network","agent","nonce","decision","kind","tx_sig","payment_requirements_hash","ingested_at","raw"]},"Webhook":{"type":"object","properties":{"id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","enum":["agent.create","agent.identity.register","agent.executive.register","agent.executive.delegate","agent.delegation.set","agent.delegation.revoke","agent.treasury.provision","agent.treasury.withdraw","agent.treasury.withdraw_sol","agent.treasury.fund","agent.treasury.fund_sol","agent.token.set","submit.raw","receipt.published","receipt.pulled","payment_link.created","payment_link.updated","payment_link.deleted","payment_link.served","payment_link.settled","buyer.payment.prepare","protocol.fee.collected"]}},"disabled_at":{"type":"string","nullable":true},"created_at":{"type":"string"}},"required":["id","network","url","events","disabled_at","created_at"]},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string"},"webhook_id":{"type":"string"},"event_id":{"type":"string"},"attempts":{"type":"integer","minimum":0},"delivered":{"type":"boolean"},"next_attempt_at":{"type":"string"},"last_status":{"type":"integer","nullable":true},"last_error":{"type":"string","nullable":true},"last_attempt_at":{"type":"string","nullable":true},"created_at":{"type":"string"}},"required":["id","webhook_id","event_id","attempts","delivered","next_attempt_at","last_status","last_error","last_attempt_at","created_at"]},"PaymentLinkResponseTemplate":{"type":"object","properties":{"status":{"type":"integer","minimum":100,"maximum":599,"default":200},"mimeType":{"type":"string","default":"application/json"},"body":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{"nullable":true}}]}},"required":["body"]},"LeashFeeExtra":{"type":"object","properties":{"v":{"type":"string","enum":["1"]},"bps":{"type":"integer","minimum":0,"maximum":10000},"feeAuthority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}},"required":["v","bps","feeAuthority"],"description":"Wire shape stamped onto x402 `paymentRequirements.extra['leash.fee']`. Buyers and facilitators derive the destination ATA from `(feeAuthority, asset, tokenProgram)`."},"PaymentLinkAcceptsEntry":{"type":"object","properties":{"scheme":{"type":"string","enum":["exact"]},"network":{"type":"string"},"pay_to":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"asset":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"amount":{"type":"string","description":"Net (seller-quoted) atomic amount. The buyer actually signs for `gross_amount = amount + fee_amount`."},"currency":{"type":"string","enum":["USDC","USDT","USDG"]},"fee_amount":{"type":"string","description":"Leash protocol fee in atomic units of `asset`."},"gross_amount":{"type":"string","description":"Total atomic amount the buyer signs (`amount + fee_amount`)."},"fee_bps":{"type":"integer","minimum":0,"maximum":10000},"fee_authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Treasury wallet that owns the destination fee ATA.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"leash_fee":{"$ref":"#/components/schemas/LeashFeeExtra"}},"required":["scheme","network","pay_to","asset","amount","currency","fee_amount","gross_amount","fee_bps","fee_authority","leash_fee"]},"PaymentLink":{"type":"object","properties":{"id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"label":{"type":"string"},"description":{"type":"string","nullable":true},"owner_agent":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"owner_wallet":{"type":"string","nullable":true,"minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"pay_to":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Asset Signer PDA derived from `owner_agent`. The on-chain `payTo`.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"method":{"type":"string","enum":["GET","POST"]},"path":{"type":"string"},"price":{"type":"string"},"currency":{"type":"string","enum":["USDC","USDT","USDG"]},"accepts_currencies":{"type":"array","items":{"type":"string","enum":["USDC","USDT","USDG"]}},"response":{"$ref":"#/components/schemas/PaymentLinkResponseTemplate"},"webhook_url":{"type":"string","nullable":true,"format":"uri"},"wrap_receipt":{"type":"boolean"},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"facilitator":{"type":"string","format":"uri"},"share_url":{"type":"string","format":"uri","description":"Public paywall URL — share this. Resolves to `/x/{id}` on the API."},"accepts":{"type":"array","items":{"$ref":"#/components/schemas/PaymentLinkAcceptsEntry"}},"counters":{"type":"object","properties":{"call_count":{"type":"integer","minimum":0},"settled_count":{"type":"integer","minimum":0},"last_called_at":{"type":"string","nullable":true},"last_settled_at":{"type":"string","nullable":true},"last_tx_sig":{"type":"string","nullable":true},"last_settled_amount_atomic":{"type":"string","nullable":true},"last_settled_currency":{"type":"string","nullable":true}},"required":["call_count","settled_count","last_called_at","last_settled_at","last_tx_sig","last_settled_amount_atomic","last_settled_currency"]},"disabled_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","network","label","description","owner_agent","owner_wallet","pay_to","method","path","price","currency","accepts_currencies","response","webhook_url","wrap_receipt","metadata","facilitator","share_url","accepts","counters","disabled_at","created_at","updated_at"]},"PaymentLinkCreateBody":{"type":"object","properties":{"id":{"type":"string","minLength":4,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9-]*[a-z0-9]$"},"label":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"owner_agent":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"owner_wallet":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"method":{"type":"string","enum":["GET","POST"],"default":"GET"},"price":{"type":"string","minLength":1,"description":"Display price string (e.g. `\"$0.001\"`, `\"0.01 USDC\"`, `\"0.5\"`). Parsed at advertise/settle time via the same `parsePrice` rules `@leash/seller-kit` uses, so atomic units always match."},"currency":{"type":"string","enum":["USDC","USDT","USDG"],"default":"USDC"},"accepts_currencies":{"type":"array","items":{"type":"string","enum":["USDC","USDT","USDG"]},"maxItems":3,"default":[]},"response":{"$ref":"#/components/schemas/PaymentLinkResponseTemplate"},"webhook_url":{"type":"string","format":"uri"},"wrap_receipt":{"type":"boolean","default":false},"metadata":{"type":"object","additionalProperties":{"nullable":true}}},"required":["label","owner_agent","price","response"]},"PaymentLinkPatchBody":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","nullable":true,"maxLength":500},"price":{"type":"string","minLength":1},"currency":{"type":"string","enum":["USDC","USDT","USDG"]},"accepts_currencies":{"type":"array","items":{"type":"string","enum":["USDC","USDT","USDG"]},"maxItems":3},"response":{"$ref":"#/components/schemas/PaymentLinkResponseTemplate"},"webhook_url":{"type":"string","nullable":true,"format":"uri"},"wrap_receipt":{"type":"boolean"},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"disabled":{"type":"boolean"}}},"SellerTokenInfo":{"type":"object","properties":{"mint":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"symbol":{"type":"string"},"name":{"type":"string"},"decimals":{"type":"integer","minimum":0,"maximum":255},"program":{"type":"string","enum":["spl-token","spl-token-2022"]},"stable":{"type":"boolean"}},"required":["mint","symbol","name","decimals","program","stable"]},"SellerNetworkInfo":{"type":"object","properties":{"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"caip2":{"type":"string"},"facilitator":{"type":"string","format":"uri"},"accepts":{"type":"array","items":{"type":"string","enum":["USDC","USDT","USDG"]}},"tokens":{"type":"array","items":{"$ref":"#/components/schemas/SellerTokenInfo"}}},"required":["network","caip2","facilitator","accepts","tokens"]},"SellerNetworksResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/SellerNetworkInfo"}},"current":{"$ref":"#/components/schemas/SellerNetworkInfo"}},"required":["items","current"]},"SellerFacilitatorResponse":{"type":"object","properties":{"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"facilitator":{"type":"string","format":"uri"},"source":{"type":"string","enum":["config","default"]}},"required":["network","facilitator","source"]},"ParsePriceResponse":{"type":"object","properties":{"amount":{"type":"string"},"currency":{"type":"string","enum":["USDC","USDT","USDG"]},"asset":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"equivalents":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string","enum":["USDC","USDT","USDG"]},"amount":{"type":"string"},"asset":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}},"required":["currency","amount","asset"]}}},"required":["amount","currency","asset","network","equivalents"]},"ParsePriceBody":{"type":"object","properties":{"price":{"type":"string","minLength":1,"example":"$0.001"},"currency":{"type":"string","enum":["USDC","USDT","USDG"],"description":"Default currency to use for `$x` / bare numeric strings. Defaults to USDC."}},"required":["price"]},"PayToResponse":{"type":"object","properties":{"agent_asset":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"pay_to":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}},"required":["agent_asset","network","pay_to"]},"PaymentRequirements":{"type":"object","properties":{"scheme":{"type":"string"},"network":{"type":"string"},"asset":{"type":"string"},"payTo":{"type":"string"},"amount":{"type":"string"},"description":{"type":"string"},"mimeType":{"type":"string"},"maxTimeoutSeconds":{"type":"integer"},"resource":{"type":"string"},"extra":{"type":"object","additionalProperties":{"nullable":true}}},"required":["scheme","network","asset","payTo","amount"]},"Price":{"type":"object","nullable":true,"properties":{"amount":{"type":"string"},"currency":{"type":"string"},"network":{"type":"string"},"asset":{"type":"string"},"fee":{"type":"string"},"gross":{"type":"string"},"fee_bps":{"type":"integer","minimum":0,"maximum":10000},"fee_authority":{"type":"string"}},"required":["amount","currency"]},"BuyerQuoteResponse":{"type":"object","properties":{"status":{"type":"integer"},"accepts":{"type":"array","items":{"$ref":"#/components/schemas/PaymentRequirements"}},"chosen":{"allOf":[{"$ref":"#/components/schemas/PaymentRequirements"},{"nullable":true}]},"price":{"$ref":"#/components/schemas/Price"},"requirements_hash":{"type":"string","nullable":true},"payment_required_header":{"type":"string","nullable":true},"seller_error":{"type":"string","nullable":true}},"required":["status","accepts","chosen","price","requirements_hash","payment_required_header","seller_error"]},"BuyerQuoteBody":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"body":{"type":"string","nullable":true},"preferred_currency":{"type":"string","enum":["USDC","USDT","USDG"]}},"required":["url"]},"PolicyEvaluateResponse":{"type":"object","properties":{"decision":{"type":"string","enum":["allow","deny"]},"reason":{"type":"string","nullable":true},"request_hash":{"type":"string"}},"required":["decision","reason","request_hash"]},"PolicyEvaluateBody":{"type":"object","properties":{"request":{"type":"object","properties":{"method":{"type":"string"},"url":{"type":"string","format":"uri"},"body":{"type":"string","nullable":true},"estimated_price":{"type":"string"}},"required":["method","url"]},"rules":{"type":"object","properties":{"v":{"type":"string","enum":["0.1"]},"budget":{"type":"object","properties":{"daily":{"type":"string"},"perCall":{"type":"string"},"currency":{"type":"string","enum":["USDC"]}},"required":["daily","perCall","currency"]},"hosts":{"type":"object","properties":{"allow":{"type":"array","items":{"type":"string"}},"deny":{"type":"array","items":{"type":"string"}}}},"priceCeiling":{"type":"string"},"triggers":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["cron"]},"expression":{"type":"string"}},"required":["type","expression"]},{"type":"object","properties":{"type":{"type":"string","enum":["webhook"]},"path":{"type":"string"}},"required":["type","path"]},{"type":"object","properties":{"type":{"type":"string","enum":["interval"]},"seconds":{"type":"integer","minimum":0,"exclusiveMinimum":true}},"required":["type","seconds"]}]}},"stopOn":{"type":"array","items":{"type":"object","properties":{"reason":{"type":"string"},"when":{"type":"string","enum":["budget_exceeded","manual","error_streak"]}},"required":["reason","when"]}}},"required":["v","budget","hosts","triggers"]},"state":{"type":"object","properties":{"spent_today":{"type":"string","default":"0"},"recent_request_hashes":{"type":"array","items":{"type":"string"},"default":[]}},"default":{"spent_today":"0","recent_request_hashes":[]}}},"required":["request","rules"]},"BuyerPaymentPrepareEcho":{"type":"object","properties":{"source_token_account":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"destination_token_account":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"mint":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"amount":{"type":"string"},"decimals":{"type":"integer","minimum":0,"maximum":255},"token_program":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}},"required":["source_token_account","destination_token_account","mint","amount","decimals","token_program"]},"BuyerPaymentPrepareBody":{"type":"object","properties":{"payer":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Public key of the rent + fee payer.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Asset owner / authority signer. Defaults to `payer`.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"client_reference":{"type":"string","maxLength":256,"description":"Free-form caller reference echoed onto the event row."},"spl_mint":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"destination":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"amount":{"type":"string","pattern":"^\\d+$"},"token_program":{"type":"string","enum":["spl","token-2022"],"description":"Which SPL token program owns the mint. Defaults to classic SPL."},"source_token_account":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"decimals":{"type":"integer","minimum":0,"maximum":255}},"required":["payer","spl_mint","destination","amount","decimals"]},"BuyerPaymentExecuteResponse":{"type":"object","properties":{"settled":{"type":"boolean"},"response":{"type":"object","properties":{"status":{"type":"integer"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"body_text":{"type":"string","nullable":true}},"required":["status","headers","body_text"]},"tx_sig":{"type":"string","nullable":true},"receipt":{"type":"object","properties":{"v":{"type":"string","enum":["0.1"]},"kind":{"type":"string","enum":["spend","earn"],"default":"spend"},"agent":{"type":"string"},"nonce":{"type":"integer","minimum":0},"ts":{"type":"string"},"policy_v":{"type":"string"},"request":{"type":"object","properties":{"method":{"type":"string"},"url":{"type":"string"},"body_hash":{"type":"string","nullable":true},"headers_hash":{"type":"string","nullable":true}},"required":["method","url","body_hash"]},"decision":{"type":"string","enum":["allow","deny","rejected"]},"reason":{"type":"string","nullable":true},"price":{"type":"object","nullable":true,"properties":{"amount":{"type":"string"},"currency":{"type":"string"},"network":{"type":"string"},"asset":{"type":"string"},"fee":{"type":"string","nullable":true},"gross":{"type":"string","nullable":true},"feeBps":{"type":"integer","nullable":true},"feeAuthority":{"type":"string","nullable":true}},"required":["amount","currency"]},"facilitator":{"anyOf":[{"type":"string","enum":["payai","corbits","svmacc","self","local"]},{"type":"string","format":"uri"},{"nullable":true}]},"tx_sig":{"type":"string","nullable":true},"payment_requirements_hash":{"type":"string","nullable":true},"response":{"type":"object","nullable":true,"properties":{"status":{"type":"integer"},"body_hash":{"type":"string","nullable":true}},"required":["status"]},"prev_receipt_hash":{"type":"string","nullable":true},"receipt_hash":{"type":"string"}},"required":["v","agent","nonce","ts","policy_v","request","decision","reason","price","facilitator","tx_sig","response","prev_receipt_hash","receipt_hash"]},"receipt_event_id":{"type":"string","nullable":true},"failure_reason":{"type":"string","nullable":true}},"required":["settled","response","tx_sig","receipt","receipt_event_id","failure_reason"]},"BuyerPaymentExecuteBody":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"],"default":"GET"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"body":{"type":"string","nullable":true},"x_payment":{"type":"string"},"agent":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"nonce":{"type":"integer","minimum":0},"prev_receipt_hash":{"type":"string","nullable":true},"policy_v":{"type":"string","default":"0.1"},"expected_payment":{"$ref":"#/components/schemas/PaymentRequirements"},"facilitator":{"type":"string","format":"uri"}},"required":["url","x_payment","agent","nonce"]},"ReceiptFinalizeResponse":{"type":"object","properties":{"receipt_hash":{"type":"string"},"receipt":{"type":"object","properties":{"v":{"type":"string","enum":["0.1"]},"kind":{"type":"string","enum":["spend","earn"],"default":"spend"},"agent":{"type":"string"},"nonce":{"type":"integer","minimum":0},"ts":{"type":"string"},"policy_v":{"type":"string"},"request":{"type":"object","properties":{"method":{"type":"string"},"url":{"type":"string"},"body_hash":{"type":"string","nullable":true},"headers_hash":{"type":"string","nullable":true}},"required":["method","url","body_hash"]},"decision":{"type":"string","enum":["allow","deny","rejected"]},"reason":{"type":"string","nullable":true},"price":{"type":"object","nullable":true,"properties":{"amount":{"type":"string"},"currency":{"type":"string"},"network":{"type":"string"},"asset":{"type":"string"},"fee":{"type":"string","nullable":true},"gross":{"type":"string","nullable":true},"feeBps":{"type":"integer","nullable":true},"feeAuthority":{"type":"string","nullable":true}},"required":["amount","currency"]},"facilitator":{"anyOf":[{"type":"string","enum":["payai","corbits","svmacc","self","local"]},{"type":"string","format":"uri"},{"nullable":true}]},"tx_sig":{"type":"string","nullable":true},"payment_requirements_hash":{"type":"string","nullable":true},"response":{"type":"object","nullable":true,"properties":{"status":{"type":"integer"},"body_hash":{"type":"string","nullable":true}},"required":["status"]},"prev_receipt_hash":{"type":"string","nullable":true},"receipt_hash":{"type":"string"}},"required":["v","agent","nonce","ts","policy_v","request","decision","reason","price","facilitator","tx_sig","response","prev_receipt_hash","receipt_hash"]}},"required":["receipt_hash","receipt"]},"ReceiptDraft":{"type":"object","properties":{"v":{"type":"string","enum":["0.1"]},"kind":{"type":"string","enum":["spend","earn"],"default":"spend"},"agent":{"type":"string"},"nonce":{"type":"integer","minimum":0},"ts":{"type":"string"},"policy_v":{"type":"string"},"request":{"type":"object","properties":{"method":{"type":"string"},"url":{"type":"string"},"body_hash":{"type":"string","nullable":true},"headers_hash":{"type":"string","nullable":true}},"required":["method","url","body_hash"]},"decision":{"type":"string","enum":["allow","deny","rejected"]},"reason":{"type":"string","nullable":true},"price":{"type":"object","nullable":true,"properties":{"amount":{"type":"string"},"currency":{"type":"string"},"network":{"type":"string"},"asset":{"type":"string"},"fee":{"type":"string","nullable":true},"gross":{"type":"string","nullable":true},"feeBps":{"type":"integer","nullable":true},"feeAuthority":{"type":"string","nullable":true}},"required":["amount","currency"]},"facilitator":{"anyOf":[{"type":"string","enum":["payai","corbits","svmacc","self","local"]},{"type":"string","format":"uri"},{"nullable":true}]},"tx_sig":{"type":"string","nullable":true},"payment_requirements_hash":{"type":"string","nullable":true},"response":{"type":"object","nullable":true,"properties":{"status":{"type":"integer"},"body_hash":{"type":"string","nullable":true}},"required":["status"]},"prev_receipt_hash":{"type":"string","nullable":true}},"required":["v","agent","nonce","ts","policy_v","request","decision","reason","price","facilitator","tx_sig","response","prev_receipt_hash"]},"ReceiptVerifyResponse":{"anyOf":[{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"count":{"type":"integer","minimum":0}},"required":["ok","count"]},{"type":"object","properties":{"ok":{"type":"boolean","enum":[false]},"nonce":{"type":"integer","minimum":0},"reason":{"type":"string"}},"required":["ok","nonce","reason"]}]},"ReceiptVerifyBody":{"anyOf":[{"type":"object","properties":{"chain":{"type":"array","items":{"type":"object","properties":{"v":{"type":"string","enum":["0.1"]},"kind":{"type":"string","enum":["spend","earn"],"default":"spend"},"agent":{"type":"string"},"nonce":{"type":"integer","minimum":0},"ts":{"type":"string"},"policy_v":{"type":"string"},"request":{"type":"object","properties":{"method":{"type":"string"},"url":{"type":"string"},"body_hash":{"type":"string","nullable":true},"headers_hash":{"type":"string","nullable":true}},"required":["method","url","body_hash"]},"decision":{"type":"string","enum":["allow","deny","rejected"]},"reason":{"type":"string","nullable":true},"price":{"type":"object","nullable":true,"properties":{"amount":{"type":"string"},"currency":{"type":"string"},"network":{"type":"string"},"asset":{"type":"string"},"fee":{"type":"string","nullable":true},"gross":{"type":"string","nullable":true},"feeBps":{"type":"integer","nullable":true},"feeAuthority":{"type":"string","nullable":true}},"required":["amount","currency"]},"facilitator":{"anyOf":[{"type":"string","enum":["payai","corbits","svmacc","self","local"]},{"type":"string","format":"uri"},{"nullable":true}]},"tx_sig":{"type":"string","nullable":true},"payment_requirements_hash":{"type":"string","nullable":true},"response":{"type":"object","nullable":true,"properties":{"status":{"type":"integer"},"body_hash":{"type":"string","nullable":true}},"required":["status"]},"prev_receipt_hash":{"type":"string","nullable":true},"receipt_hash":{"type":"string"}},"required":["v","agent","nonce","ts","policy_v","request","decision","reason","price","facilitator","tx_sig","response","prev_receipt_hash","receipt_hash"]},"minItems":1}},"required":["chain"]},{"type":"object","properties":{"jsonl":{"type":"string","minLength":1}},"required":["jsonl"]}]},"BuyerCurrency":{"type":"object","properties":{"symbol":{"type":"string","enum":["USDC","USDT","USDG"]},"name":{"type":"string"},"mint":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"decimals":{"type":"integer","minimum":0,"maximum":255},"program":{"type":"string","enum":["spl-token","spl-token-2022"]}},"required":["symbol","name","mint","decimals","program"]},"BuyerNetworkInfo":{"type":"object","properties":{"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"caip2":{"type":"string"},"facilitator":{"type":"string","format":"uri"},"accepts":{"type":"array","items":{"type":"string","enum":["USDC","USDT","USDG"]}},"currencies":{"type":"array","items":{"$ref":"#/components/schemas/BuyerCurrency"}}},"required":["network","caip2","facilitator","accepts","currencies"]},"BuyerNetworksResponse":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/BuyerNetworkInfo"}},"current":{"$ref":"#/components/schemas/BuyerNetworkInfo"}},"required":["items","current"]},"BuyerCurrencyResponse":{"type":"object","properties":{"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"items":{"type":"array","items":{"$ref":"#/components/schemas/BuyerCurrency"}}},"required":["network","items"]}},"parameters":{}},"paths":{"/v1/health":{"get":{"tags":["health"],"summary":"Liveness probe","responses":{"200":{"description":"Server is up.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/v1/version":{"get":{"tags":["health"],"summary":"API version","responses":{"200":{"description":"Public API version + supported networks.","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"string"},"networks":{"type":"array","items":{"type":"string","enum":["solana-devnet","solana-mainnet"]}}},"required":["version","networks"]}}}}}}},"/v1/admin/api-keys":{"post":{"tags":["admin"],"summary":"Issue a new API key","security":[{"AdminSecret":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCreateApiKeyBody"}}}},"responses":{"200":{"description":"Key created. `plaintext` is returned only here.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCreateApiKeyResponse"}}}},"401":{"description":"Missing or invalid admin secret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"get":{"tags":["admin"],"summary":"List issued API keys (no plaintext)","security":[{"AdminSecret":[]}],"parameters":[{"schema":{"type":"string","enum":["solana-devnet","solana-mainnet"]},"required":false,"name":"network","in":"query"},{"schema":{"type":"string","enum":["true","false"],"description":"Default false."},"required":false,"name":"include_disabled","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Issued keys, newest first.","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AdminApiKeyRecord"}}},"required":["items"]}}}},"401":{"description":"Missing or invalid admin secret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/admin/api-keys/{id}/disable":{"post":{"tags":["admin"],"summary":"Disable (revoke) an API key","security":[{"AdminSecret":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Disabled. Future requests with this key return 401.","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"$ref":"#/components/schemas/AdminApiKeyRecord"}},"required":["key"]}}}},"401":{"description":"Missing or invalid admin secret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/prepare":{"post":{"tags":["agents"],"summary":"Mint a new agent (HTTP twin of registry-utils `prepareAgentMint`).","description":"Calls the Metaplex Agents API under the hood, hands back an unsigned transaction the wallet signs and submits via `POST /v1/submit`, and pre-registers the asset + treasury PDA on the indexer watchlist so the explorer shows the new agent the moment the tx lands.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentBody"}}}},"responses":{"200":{"description":"Prepared agent-mint transaction.","content":{"application/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"$ref":"#/components/schemas/PreparedTransaction"},"echo":{"$ref":"#/components/schemas/CreateAgentEcho"}},"required":["event_id","network","transaction","echo"]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"Upstream Metaplex API error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}":{"get":{"tags":["agents"],"summary":"Identity, treasury, and token-association summary.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"responses":{"200":{"description":"Agent summary.","content":{"application/json":{"schema":{"type":"object","properties":{"agent_asset":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"treasury":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"has_identity":{"type":"boolean"},"identity":{"type":"object","nullable":true,"properties":{"source":{"type":"string","enum":["v1","v2"]},"asset":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}},"required":["source","asset"]},"token":{"type":"object","properties":{"has_token":{"type":"boolean"},"mint":{"type":"string","nullable":true,"minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"source":{"type":"string","enum":["v1","v2","none"]}},"required":["has_token","mint","source"]}},"required":["agent_asset","network","treasury","has_identity","identity","token"]}}}},"502":{"description":"RPC error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}/treasury/balances":{"get":{"tags":["agents","treasury"],"summary":"Native SOL + SPL token balances on the agent treasury PDA.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"responses":{"200":{"description":"Treasury balance snapshot.","content":{"application/json":{"schema":{"type":"object","properties":{"agent_asset":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"treasury":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"sol":{"type":"object","properties":{"lamports":{"type":"string"},"sol":{"type":"number"},"spendable_lamports":{"type":"string"},"spendable_sol":{"type":"number"}},"required":["lamports","sol","spendable_lamports","spendable_sol"]},"spl":{"type":"array","items":{"type":"object","properties":{"mint":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"symbol":{"type":"string","nullable":true},"ata":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"token_program":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"amount":{"type":"string"},"decimals":{"type":"integer","minimum":0,"maximum":255},"ui_amount":{"type":"number"}},"required":["mint","symbol","ata","token_program","amount","decimals","ui_amount"]}}},"required":["agent_asset","network","treasury","sol","spl"]}}}}}}},"/v1/agents/{mint}/identity/prepare":{"post":{"tags":["agents","identity"],"summary":"Build an unsigned `registerIdentityV1` transaction.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payer":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Public key of the rent + fee payer.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Asset owner / authority signer. Defaults to `payer`.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"client_reference":{"type":"string","maxLength":256,"description":"Free-form caller reference echoed onto the event row."},"collection":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"agent_registration_uri":{"type":"string","format":"uri"}},"required":["payer","collection","agent_registration_uri"]}}}},"responses":{"200":{"description":"Prepared transaction.","content":{"application/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"$ref":"#/components/schemas/PreparedTransaction"},"echo":{"type":"object","properties":{"asset":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"collection":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"agent_registration_uri":{"type":"string"}},"required":["asset","collection","agent_registration_uri"]}},"required":["event_id","network","transaction","echo"]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}/executive/register/prepare":{"post":{"tags":["agents","executive"],"summary":"Build an unsigned `registerExecutiveV1` transaction.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payer":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Public key of the rent + fee payer.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Asset owner / authority signer. Defaults to `payer`.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"client_reference":{"type":"string","maxLength":256,"description":"Free-form caller reference echoed onto the event row."}},"required":["payer"]}}}},"responses":{"200":{"description":"Prepared transaction.","content":{"application/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"$ref":"#/components/schemas/PreparedTransaction"},"echo":{"type":"object","properties":{"profile":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}},"required":["profile"]}},"required":["event_id","network","transaction","echo"]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}/executive/delegate/prepare":{"post":{"tags":["agents","executive"],"summary":"Build an unsigned `delegateExecutionV1` transaction.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payer":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Public key of the rent + fee payer.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Asset owner / authority signer. Defaults to `payer`.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"client_reference":{"type":"string","maxLength":256,"description":"Free-form caller reference echoed onto the event row."},"executive_authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}},"required":["payer","executive_authority"]}}}},"responses":{"200":{"description":"Prepared transaction.","content":{"application/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"$ref":"#/components/schemas/PreparedTransaction"},"echo":{"type":"object","properties":{"delegate_record":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"agent_asset":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"agent_identity":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"executive_profile":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}},"required":["delegate_record","agent_asset","agent_identity","executive_profile"]}},"required":["event_id","network","transaction","echo"]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}/delegation/prepare":{"post":{"tags":["agents","delegation"],"summary":"Build an unsigned SPL `Approve` (spend delegation) transaction.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payer":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Public key of the rent + fee payer.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Asset owner / authority signer. Defaults to `payer`.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"client_reference":{"type":"string","maxLength":256,"description":"Free-form caller reference echoed onto the event row."},"spl_mint":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"executive":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"amount":{"type":"string","pattern":"^\\d+$"},"token_program":{"type":"string","enum":["spl","token-2022"],"description":"Which SPL token program owns the mint. Defaults to classic SPL."},"pad_for_protocol_fee":{"type":"boolean"}},"required":["payer","spl_mint","executive","amount"]}}}},"responses":{"200":{"description":"Prepared transaction.","content":{"application/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"$ref":"#/components/schemas/PreparedTransaction"},"echo":{"type":"object","properties":{"treasury":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"source_token_account":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"delegated_amount":{"type":"string"},"fee_padding_atoms":{"type":"string"},"delegate":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"will_create_ata":{"type":"boolean"}},"required":["treasury","source_token_account","delegated_amount","fee_padding_atoms","delegate","will_create_ata"]}},"required":["event_id","network","transaction","echo"]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}/delegation/revoke/prepare":{"post":{"tags":["agents","delegation"],"summary":"Build an unsigned SPL `Revoke` transaction.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payer":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Public key of the rent + fee payer.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Asset owner / authority signer. Defaults to `payer`.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"client_reference":{"type":"string","maxLength":256,"description":"Free-form caller reference echoed onto the event row."},"spl_mint":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"token_program":{"type":"string","enum":["spl","token-2022"],"description":"Which SPL token program owns the mint. Defaults to classic SPL."}},"required":["payer","spl_mint"]}}}},"responses":{"200":{"description":"Prepared transaction.","content":{"application/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"$ref":"#/components/schemas/PreparedTransaction"},"echo":{"type":"object","properties":{"treasury":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"source_token_account":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}},"required":["treasury","source_token_account"]}},"required":["event_id","network","transaction","echo"]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}/treasury/provision/prepare":{"post":{"tags":["agents","treasury"],"summary":"Build an unsigned `CreateIdempotent` bundle for missing ATAs.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payer":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Public key of the rent + fee payer.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Asset owner / authority signer. Defaults to `payer`.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"client_reference":{"type":"string","maxLength":256,"description":"Free-form caller reference echoed onto the event row."},"mints":{"type":"array","items":{"type":"object","properties":{"mint":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"symbol":{"type":"string"},"token_program":{"type":"string","enum":["spl","token-2022"],"description":"Which SPL token program owns the mint. Defaults to classic SPL."}},"required":["mint"]}}},"required":["payer"]}}}},"responses":{"200":{"description":"Prepared transaction (or `no_op: true` when every ATA already exists).","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"event_id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"$ref":"#/components/schemas/PreparedTransaction"},"echo":{"type":"object","properties":{"treasury":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"atas":{"type":"array","items":{"type":"object","properties":{"mint":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"symbol":{"type":"string"},"address":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"token_program":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"created":{"type":"boolean"}},"required":["mint","address","token_program","created"]}}},"required":["treasury","atas"]}},"required":["event_id","network","transaction","echo"]},{"type":"object","properties":{"event_id":{"nullable":true},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"nullable":true},"echo":{"type":"object","properties":{"treasury":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"atas":{"type":"array","items":{"type":"object","properties":{"mint":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"symbol":{"type":"string"},"address":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"token_program":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"created":{"type":"boolean"}},"required":["mint","address","token_program","created"]}}},"required":["treasury","atas"]},"no_op":{"type":"boolean","enum":[true]}},"required":["event_id","network","transaction","echo","no_op"]}]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}/treasury/withdraw/prepare":{"post":{"tags":["agents","treasury"],"summary":"Build an unsigned `TransferChecked` (SPL withdraw) transaction.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payer":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Public key of the rent + fee payer.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Asset owner / authority signer. Defaults to `payer`.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"client_reference":{"type":"string","maxLength":256,"description":"Free-form caller reference echoed onto the event row."},"spl_mint":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"destination":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"amount":{"type":"string","pattern":"^\\d+$"},"token_program":{"type":"string","enum":["spl","token-2022"],"description":"Which SPL token program owns the mint. Defaults to classic SPL."},"create_destination_ata_if_missing":{"type":"boolean"},"decimals":{"type":"integer","minimum":0,"maximum":255}},"required":["payer","spl_mint","destination","amount"]}}}},"responses":{"200":{"description":"Prepared transaction.","content":{"application/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"$ref":"#/components/schemas/PreparedTransaction"},"echo":{"type":"object","properties":{"treasury":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"source_token_account":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"destination_token_account":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"amount":{"type":"string"},"destination":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"will_create_destination_ata":{"type":"boolean"},"decimals":{"type":"integer","minimum":0,"maximum":255}},"required":["treasury","source_token_account","destination_token_account","amount","destination","will_create_destination_ata","decimals"]}},"required":["event_id","network","transaction","echo"]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}/treasury/withdraw-all/prepare":{"post":{"tags":["agents","treasury"],"summary":"Build an unsigned SPL \"withdraw everything\" transaction. Returns `no_op` when balance is zero.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payer":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Public key of the rent + fee payer.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Asset owner / authority signer. Defaults to `payer`.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"client_reference":{"type":"string","maxLength":256,"description":"Free-form caller reference echoed onto the event row."},"spl_mint":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"destination":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"token_program":{"type":"string","enum":["spl","token-2022"],"description":"Which SPL token program owns the mint. Defaults to classic SPL."},"create_destination_ata_if_missing":{"type":"boolean"},"decimals":{"type":"integer","minimum":0,"maximum":255}},"required":["payer","spl_mint","destination"]}}}},"responses":{"200":{"description":"Prepared transaction or `no_op`.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"event_id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"$ref":"#/components/schemas/PreparedTransaction"},"echo":{"type":"object","properties":{"treasury":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"source_token_account":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"destination_token_account":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"amount":{"type":"string"},"destination":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"will_create_destination_ata":{"type":"boolean"},"decimals":{"type":"integer","minimum":0,"maximum":255}},"required":["treasury","source_token_account","destination_token_account","amount","destination","will_create_destination_ata","decimals"]}},"required":["event_id","network","transaction","echo"]},{"type":"object","properties":{"event_id":{"nullable":true},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"nullable":true},"echo":{"type":"object","properties":{"treasury":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}},"no_op":{"type":"boolean","enum":[true]}},"required":["event_id","network","transaction","echo","no_op"]}]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}/treasury/withdraw-sol/prepare":{"post":{"tags":["agents","treasury"],"summary":"Build an unsigned SOL withdraw transaction.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payer":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Public key of the rent + fee payer.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Asset owner / authority signer. Defaults to `payer`.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"client_reference":{"type":"string","maxLength":256,"description":"Free-form caller reference echoed onto the event row."},"destination":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"lamports":{"type":"string","pattern":"^\\d+$"}},"required":["payer","destination","lamports"]}}}},"responses":{"200":{"description":"Prepared transaction.","content":{"application/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"$ref":"#/components/schemas/PreparedTransaction"},"echo":{"type":"object","properties":{"treasury":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"destination":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"lamports":{"type":"string"}},"required":["treasury","destination","lamports"]}},"required":["event_id","network","transaction","echo"]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}/treasury/withdraw-sol-all/prepare":{"post":{"tags":["agents","treasury"],"summary":"Build an unsigned \"withdraw all SOL\" transaction. Returns `no_op` when balance is at the safety reserve.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payer":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Public key of the rent + fee payer.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Asset owner / authority signer. Defaults to `payer`.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"client_reference":{"type":"string","maxLength":256,"description":"Free-form caller reference echoed onto the event row."},"destination":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"reserve_lamports":{"type":"string","pattern":"^\\d+$"}},"required":["payer","destination"]}}}},"responses":{"200":{"description":"Prepared transaction or `no_op`.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"event_id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"$ref":"#/components/schemas/PreparedTransaction"},"echo":{"type":"object","properties":{"treasury":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"destination":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"lamports":{"type":"string"}},"required":["treasury","destination","lamports"]}},"required":["event_id","network","transaction","echo"]},{"type":"object","properties":{"event_id":{"nullable":true},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"nullable":true},"echo":{"type":"object","properties":{}},"no_op":{"type":"boolean","enum":[true]}},"required":["event_id","network","transaction","echo","no_op"]}]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}/token/set/prepare":{"post":{"tags":["agents","token"],"summary":"Build an unsigned `mpl-core::Execute(setAgentTokenV1)` transaction. Irreversible once submitted.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payer":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Public key of the rent + fee payer.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"authority":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","description":"Asset owner / authority signer. Defaults to `payer`.","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"client_reference":{"type":"string","maxLength":256,"description":"Free-form caller reference echoed onto the event row."},"genesis_account":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"collection":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}},"required":["payer","genesis_account"]}}}},"responses":{"200":{"description":"Prepared transaction.","content":{"application/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"$ref":"#/components/schemas/PreparedTransaction"},"echo":{"type":"object","properties":{"agent_asset":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"genesis_account":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}},"required":["agent_asset","genesis_account"]}},"required":["event_id","network","transaction","echo"]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/submit":{"post":{"tags":["submit"],"summary":"Broadcast a signed transaction and track its lifecycle.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"transaction_base64":{"type":"string","minLength":1},"event_id":{"type":"string"},"client_reference":{"type":"string","maxLength":256}},"required":["transaction_base64"]}}}},"responses":{"200":{"description":"Transaction broadcast.","content":{"application/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string"},"signature":{"type":"string"},"phase":{"type":"string","enum":["submitted"]},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."}},"required":["event_id","signature","phase","network"]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"502":{"description":"RPC error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events/{id}":{"get":{"tags":["events"],"summary":"Look up a single event by id.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Event row.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"ts":{"type":"string"},"kind":{"type":"string","enum":["agent.create","agent.identity.register","agent.executive.register","agent.executive.delegate","agent.delegation.set","agent.delegation.revoke","agent.treasury.provision","agent.treasury.withdraw","agent.treasury.withdraw_sol","agent.treasury.fund","agent.treasury.fund_sol","agent.token.set","submit.raw","receipt.published","receipt.pulled","payment_link.created","payment_link.updated","payment_link.deleted","payment_link.served","payment_link.settled","buyer.payment.prepare","protocol.fee.collected"]},"phase":{"type":"string","enum":["prepared","submitted","confirmed","failed"]},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"client_reference":{"type":"string","nullable":true},"agent_asset":{"type":"string","nullable":true,"minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"signature":{"type":"string","nullable":true},"mint":{"type":"string","nullable":true,"minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"amount_atomic":{"type":"string","nullable":true},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"error_code":{"type":"string","nullable":true},"error_message":{"type":"string","nullable":true},"confirmed_at":{"type":"string","nullable":true},"failed_at":{"type":"string","nullable":true}},"required":["id","ts","kind","phase","network","client_reference","agent_asset","signature","mint","amount_atomic","metadata","error_code","error_message","confirmed_at","failed_at"]}}}},"404":{"description":"Not found (or wrong network).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/events":{"get":{"tags":["events"],"summary":"Filterable event feed (network is bound to the caller's key).","parameters":[{"schema":{"type":"string","enum":["agent.create","agent.identity.register","agent.executive.register","agent.executive.delegate","agent.delegation.set","agent.delegation.revoke","agent.treasury.provision","agent.treasury.withdraw","agent.treasury.withdraw_sol","agent.treasury.fund","agent.treasury.fund_sol","agent.token.set","submit.raw","receipt.published","receipt.pulled","payment_link.created","payment_link.updated","payment_link.deleted","payment_link.served","payment_link.settled","buyer.payment.prepare","protocol.fee.collected"]},"required":false,"name":"kind","in":"query"},{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":false,"name":"agent","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Page of events.","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ts":{"type":"string"},"kind":{"type":"string","enum":["agent.create","agent.identity.register","agent.executive.register","agent.executive.delegate","agent.delegation.set","agent.delegation.revoke","agent.treasury.provision","agent.treasury.withdraw","agent.treasury.withdraw_sol","agent.treasury.fund","agent.treasury.fund_sol","agent.token.set","submit.raw","receipt.published","receipt.pulled","payment_link.created","payment_link.updated","payment_link.deleted","payment_link.served","payment_link.settled","buyer.payment.prepare","protocol.fee.collected"]},"phase":{"type":"string","enum":["prepared","submitted","confirmed","failed"]},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"client_reference":{"type":"string","nullable":true},"agent_asset":{"type":"string","nullable":true,"minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"signature":{"type":"string","nullable":true},"mint":{"type":"string","nullable":true,"minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"amount_atomic":{"type":"string","nullable":true},"metadata":{"type":"object","additionalProperties":{"nullable":true}},"error_code":{"type":"string","nullable":true},"error_message":{"type":"string","nullable":true},"confirmed_at":{"type":"string","nullable":true},"failed_at":{"type":"string","nullable":true}},"required":["id","ts","kind","phase","network","client_reference","agent_asset","signature","mint","amount_atomic","metadata","error_code","error_message","confirmed_at","failed_at"]}},"next_cursor":{"type":"string","nullable":true}},"required":["items","next_cursor"]}}}}}}},"/v1/receipts/{agent}":{"post":{"tags":["receipts"],"summary":"Ingest a `ReceiptV1`. Idempotent on `receipt_hash`.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"agent","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"v":{"type":"string","enum":["0.1"]},"kind":{"type":"string","enum":["spend","earn"],"default":"spend"},"agent":{"type":"string"},"nonce":{"type":"integer","minimum":0},"ts":{"type":"string"},"policy_v":{"type":"string"},"request":{"type":"object","properties":{"method":{"type":"string"},"url":{"type":"string"},"body_hash":{"type":"string","nullable":true},"headers_hash":{"type":"string","nullable":true}},"required":["method","url","body_hash"]},"decision":{"type":"string","enum":["allow","deny","rejected"]},"reason":{"type":"string","nullable":true},"price":{"type":"object","nullable":true,"properties":{"amount":{"type":"string"},"currency":{"type":"string"},"network":{"type":"string"},"asset":{"type":"string"},"fee":{"type":"string","nullable":true},"gross":{"type":"string","nullable":true},"feeBps":{"type":"integer","nullable":true},"feeAuthority":{"type":"string","nullable":true}},"required":["amount","currency"]},"facilitator":{"anyOf":[{"type":"string","enum":["payai","corbits","svmacc","self","local"]},{"type":"string","format":"uri"},{"nullable":true}]},"tx_sig":{"type":"string","nullable":true},"payment_requirements_hash":{"type":"string","nullable":true},"response":{"type":"object","nullable":true,"properties":{"status":{"type":"integer"},"body_hash":{"type":"string","nullable":true}},"required":["status"]},"prev_receipt_hash":{"type":"string","nullable":true},"receipt_hash":{"type":"string"}},"required":["v","agent","nonce","ts","policy_v","request","decision","reason","price","facilitator","tx_sig","response","prev_receipt_hash","receipt_hash"]}}}},"responses":{"200":{"description":"Receipt accepted (or duplicate).","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"receipt_hash":{"type":"string"},"duplicate":{"type":"boolean"},"event_id":{"type":"string","nullable":true}},"required":["ok","receipt_hash","duplicate","event_id"]}}}},"422":{"description":"Receipt failed validation or did not match path agent.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"get":{"tags":["receipts"],"summary":"List receipts for an agent (newest first), network-scoped.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"agent","in":"path"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["spend","earn"]},"required":false,"name":"kind","in":"query"}],"responses":{"200":{"description":"Paged receipts feed.","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Receipt"}},"next_cursor":{"type":"string","nullable":true}},"required":["items","next_cursor"]}}}}}}},"/v1/receipts/by-hash/{hash}":{"get":{"tags":["receipts"],"summary":"Look up a receipt by its `receipt_hash` on the caller network.","parameters":[{"schema":{"type":"string","minLength":8,"maxLength":128},"required":true,"name":"hash","in":"path"}],"responses":{"200":{"description":"Receipt row.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Receipt"}}}},"404":{"description":"Not found in caller network.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}/pull-target":{"post":{"tags":["receipts"],"summary":"Register a `services.receipts` URL that the API will poll on a cadence to pull receipts for the agent (networks isolated).","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"Either an absolute receipts URL or a `{agent}` template the worker substitutes."}},"required":["url"]}}}},"responses":{"200":{"description":"All registered targets (after upsert) for this agent on the caller network.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"pull_targets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"agent":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"url":{"type":"string"},"last_polled_at":{"type":"string","nullable":true},"last_cursor":{"type":"string","nullable":true}},"required":["id","network","agent","url","last_polled_at","last_cursor"]}}},"required":["ok","pull_targets"]}}}}}}},"/v1/indexer/status":{"get":{"tags":["indexer"],"summary":"Indexer health on the caller network.","responses":{"200":{"description":"Watchlist + cursor + recent activity counters.","content":{"application/json":{"schema":{"type":"object","properties":{"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"watchlist_size":{"type":"integer","minimum":0},"cursors":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"last_run_at":{"type":"string","nullable":true}},"required":["total","last_run_at"]},"events_last_hour":{"type":"object","additionalProperties":{"type":"integer","minimum":0}}},"required":["network","watchlist_size","cursors","events_last_hour"]}}}}}}},"/v1/webhooks":{"post":{"tags":["webhooks"],"summary":"Create or upsert an outbound webhook subscription.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"Receiver URL. Must be HTTPS in production."},"events":{"type":"array","items":{"type":"string","enum":["agent.create","agent.identity.register","agent.executive.register","agent.executive.delegate","agent.delegation.set","agent.delegation.revoke","agent.treasury.provision","agent.treasury.withdraw","agent.treasury.withdraw_sol","agent.treasury.fund","agent.treasury.fund_sol","agent.token.set","submit.raw","receipt.published","receipt.pulled","payment_link.created","payment_link.updated","payment_link.deleted","payment_link.served","payment_link.settled","buyer.payment.prepare","protocol.fee.collected"]},"description":"Subscribe to specific event kinds. Empty/omitted = all kinds."}},"required":["url"]}}}},"responses":{"200":{"description":"Subscription created (or updated, same id + secret).","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Webhook"},{"type":"object","properties":{"secret":{"type":"string","description":"HMAC-SHA256 signing secret. Returned ONCE on create — store it now."}},"required":["secret"]}]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"get":{"tags":["webhooks"],"summary":"List subscriptions on the caller key.","responses":{"200":{"description":"Subscriptions (secret omitted).","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}},"required":["items"]}}}}}}},"/v1/webhooks/{id}":{"get":{"tags":["webhooks"],"summary":"Fetch a subscription by id (must belong to caller key).","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Subscription.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["webhooks"],"summary":"Delete a subscription and purge its delivery history.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/webhooks/{id}/deliveries":{"get":{"tags":["webhooks"],"summary":"Recent delivery attempts for a subscription.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":200},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Recent attempts (newest first).","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}}},"required":["items"]}}}},"404":{"description":"Subscription not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/metrics/usage":{"get":{"tags":["metrics"],"summary":"Per-day API request rollups for the caller key.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":30},"required":false,"name":"days","in":"query"}],"responses":{"200":{"description":"Usage rollups + endpoint breakdown.","content":{"application/json":{"schema":{"type":"object","properties":{"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"api_key_id":{"type":"string"},"window_days":{"type":"integer","minimum":0,"exclusiveMinimum":true},"totals":{"type":"object","properties":{"requests":{"type":"integer","minimum":0},"errors":{"type":"integer","minimum":0},"avg_latency_ms":{"type":"number","minimum":0}},"required":["requests","errors","avg_latency_ms"]},"by_day":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"requests":{"type":"integer","minimum":0},"errors":{"type":"integer","minimum":0},"avg_latency_ms":{"type":"number","minimum":0},"p95_latency_ms":{"type":"number","minimum":0}},"required":["date","requests","errors","avg_latency_ms","p95_latency_ms"]}},"by_endpoint":{"type":"array","items":{"type":"object","properties":{"method":{"type":"string"},"path":{"type":"string"},"requests":{"type":"integer","minimum":0},"errors":{"type":"integer","minimum":0}},"required":["method","path","requests","errors"]}}},"required":["network","api_key_id","window_days","totals","by_day","by_endpoint"]}}}}}}},"/v1/metrics/events":{"get":{"tags":["metrics"],"summary":"Event counters by phase + kind for the caller network.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":168},"required":false,"name":"hours","in":"query"}],"responses":{"200":{"description":"Event rollups in the requested window.","content":{"application/json":{"schema":{"type":"object","properties":{"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"window_hours":{"type":"integer","minimum":0,"exclusiveMinimum":true},"by_phase":{"type":"object","additionalProperties":{"type":"integer","minimum":0}},"by_kind":{"type":"object","additionalProperties":{"type":"integer","minimum":0}},"failure_rate":{"type":"number","minimum":0,"maximum":1}},"required":["network","window_hours","by_phase","by_kind","failure_rate"]}}}}}}},"/v1/payment-links":{"post":{"tags":["payment-links"],"summary":"Create a hosted x402 payment link.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLinkCreateBody"}}}},"responses":{"200":{"description":"Payment link created. `share_url` is the public paywall.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLink"}}}},"409":{"description":"A payment link with this id already exists on the caller network.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid body (price unparseable, currency unsupported, etc).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"get":{"tags":["payment-links"],"summary":"List payment links owned by the caller (newest first).","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":false,"name":"owner_agent","in":"query"},{"schema":{"type":"string","enum":["true","false"],"description":"Default false."},"required":false,"name":"include_disabled","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Paged links.","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/PaymentLink"}},"next_cursor":{"type":"string","nullable":true}},"required":["items","next_cursor"]}}}}}}},"/v1/payment-links/{id}":{"get":{"tags":["payment-links"],"summary":"Fetch a payment link by slug (must belong to caller).","parameters":[{"schema":{"type":"string","minLength":4,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9-]*[a-z0-9]$"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Payment link record.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLink"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"tags":["payment-links"],"summary":"Update a payment link. Send only the fields you want to change.","parameters":[{"schema":{"type":"string","minLength":4,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9-]*[a-z0-9]$"},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLinkPatchBody"}}}},"responses":{"200":{"description":"Updated payment link.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLink"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Invalid patch (price unparseable, currency unsupported, etc).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"tags":["payment-links"],"summary":"Delete a payment link. The public paywall stops responding immediately.","parameters":[{"schema":{"type":"string","minLength":4,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9-]*[a-z0-9]$"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/payment-links/preview":{"post":{"tags":["payment-links"],"summary":"Preview the discovery payload for a draft payment link (no persist).","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLinkCreateBody"}}}},"responses":{"200":{"description":"Discovery payload that would be advertised on the paywall.","content":{"application/json":{"schema":{"type":"object","properties":{"pay_to":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"facilitator":{"type":"string","format":"uri"},"share_url":{"type":"string","format":"uri"},"accepts":{"type":"array","items":{"$ref":"#/components/schemas/PaymentLinkAcceptsEntry"}}},"required":["pay_to","facilitator","share_url","accepts"]}}}},"422":{"description":"Invalid draft (price unparseable, currency unsupported, etc).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/seller/networks":{"get":{"tags":["seller-utils"],"summary":"Enumerate every settlement network + accepted stablecoin set.","responses":{"200":{"description":"Network catalog with the caller-scoped network surfaced as `current`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SellerNetworksResponse"}}}}}}},"/v1/seller/facilitator":{"get":{"tags":["seller-utils"],"summary":"Resolve the facilitator URL the caller-scoped network settles through.","responses":{"200":{"description":"Facilitator URL + provenance (config vs default).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SellerFacilitatorResponse"}}}}}}},"/v1/seller/parse-price":{"post":{"tags":["seller-utils"],"summary":"Parse a `price` string into atomic units + show equivalents.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParsePriceBody"}}}},"responses":{"200":{"description":"Parsed price + per-stablecoin equivalents.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParsePriceResponse"}}}},"422":{"description":"Could not parse the `price` for the given currency on this network.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/agents/{mint}/pay-to":{"get":{"tags":["seller-utils","agents"],"summary":"Resolve the on-chain `payTo` (Asset Signer PDA) for an agent.","parameters":[{"schema":{"type":"string","minLength":32,"maxLength":44,"pattern":"^[1-9A-HJ-NP-Za-km-z]+$","example":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},"required":true,"name":"mint","in":"path"}],"responses":{"200":{"description":"Asset Signer PDA on the caller-scoped network.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayToResponse"}}}}}}},"/v1/buyer/quote":{"post":{"tags":["buyer"],"summary":"Probe a URL for an x402 402 + decode the `payment-required` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuyerQuoteBody"}}}},"responses":{"200":{"description":"Quote envelope with raw `accepts[]` + caller-network pick.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuyerQuoteResponse"}}}},"502":{"description":"The probe fetch failed (DNS, TLS, timeout, etc.).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/buyer/policy/evaluate":{"post":{"tags":["buyer"],"summary":"Pure RulesV1 gate. No IO, no DB writes.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyEvaluateBody"}}}},"responses":{"200":{"description":"Decision + diagnostic fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolicyEvaluateResponse"}}}}}}},"/v1/buyer/payment/prepare":{"post":{"tags":["buyer"],"summary":"Build an unsigned SPL TransferChecked from buyer ATA → seller payTo ATA.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuyerPaymentPrepareBody"}}}},"responses":{"200":{"description":"Prepared transaction + echo of the resolved ATAs.","content":{"application/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string"},"network":{"type":"string","enum":["solana-devnet","solana-mainnet"],"description":"Network slug. Always equals the API key prefix."},"transaction":{"$ref":"#/components/schemas/PreparedTransaction"},"echo":{"$ref":"#/components/schemas/BuyerPaymentPrepareEcho"}},"required":["event_id","network","transaction","echo"]}}}},"422":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/buyer/payment/execute":{"post":{"tags":["buyer"],"summary":"Replay a seller request with a buyer-signed `X-PAYMENT` header + ingest receipt.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuyerPaymentExecuteBody"}}}},"responses":{"200":{"description":"Settlement attempt summary + spend receipt.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuyerPaymentExecuteResponse"}}}}}}},"/v1/buyer/receipt/finalize":{"post":{"tags":["buyer"],"summary":"Compute `receipt_hash` for a draft receipt (pure).","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptDraft"}}}},"responses":{"200":{"description":"Hashed receipt.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptFinalizeResponse"}}}}}}},"/v1/buyer/receipt/verify":{"post":{"tags":["buyer"],"summary":"Verify a chain of receipts (hashes, nonces, prev links).","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptVerifyBody"}}}},"responses":{"200":{"description":"Verification outcome.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptVerifyResponse"}}}}}}},"/v1/buyer/networks":{"get":{"tags":["buyer"],"summary":"Buyer-side network catalog (mirrors `/v1/seller/networks`).","responses":{"200":{"description":"Network catalog with caller-scoped network as `current`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuyerNetworksResponse"}}}}}}},"/v1/buyer/currency":{"get":{"tags":["buyer"],"summary":"Stablecoins the buyer can settle in on the caller-scoped network.","responses":{"200":{"description":"Currency list.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuyerCurrencyResponse"}}}}}}}}}