Documentation

API and protocol reference

REST is canonical. Every adapter (OpenAPI, MCP, A2A, x402) maps to the same canonical operation, so marketplace payload formats never leak into agent logic.

Base URL

The API and this site share one origin. Requests are same-origin relative paths; the canonical public host is agent.becoder.xyz.

  • Runtime basethis host
  • Canonical hostagent.becoder.xyz
  • Content typeUTF-8 application/json
  • API version/v1

Discovery routes (free)

Never charged. Use these before spending anything.

RouteMethodReturns
/healthGETLiveness of the service process.
/readyGETReadiness of dependencies.
/agentsGETCatalog, current versions, free/paid status, schema links.
/agents/:slugGETCanonical manifest for one agent.
/openapi.jsonGETMachine-readable OpenAPI document.
/.well-known/agent-card.jsonGETA2A hub card advertising all five skills.
/mcpPOSTMCP transport exposing five tools.

Standard response envelope

Every canonical API response uses the same shape. Success carries status: "success"; failures carry an error object and a stable code.

Success

{
  "request_id": "req_...",
  "agent": { "id": "tx-decoder", "version": "1.0.0" },
  "status": "success",
  "result": {},
  "evidence": [],
  "warnings": [],
  "limitations": [],
  "execution": { "started_at": "ISO-8601", "duration_ms": 120, "cache": "miss" }
}

Failure

{
  "request_id": "req_...",
  "status": "error",
  "error": {
    "code": "UNSUPPORTED_CHAIN",
    "message": "The requested chain is not enabled."
  },
  "retryable": false
}

An execution is successful only if input validates, payment validates, core execution completes, output validates, and response persistence/telemetry reaches the minimum durability. Malformed output is never leaked as success. No stack traces are returned to public clients.

Stable error codes

Clients may rely on these codes; human-readable messages may change.

x402 payment flow

x402 is implemented at the HTTP boundary, not inside agent core. Unpaid calls are rejected before any paid work happens.

  1. 1

    Call

    Client POSTs the input with no payment.

  2. 2

    402

    Server returns a payment requirement describing asset, network and amount.

  3. 3

    Pay

    An x402-capable client satisfies the requirement using a facilitator.

  4. 4

    Retry

    Client retries the same request; payment is verified, then the agent executes.

402 payment requirement (illustrative)

{
  "status": 402,
  "error": "Payment Required",
  "error_code": "PAYMENT_REQUIRED",
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",
      "asset": "USDC",
      "maxAmountRequired": "0.005",
      "resource": "/v1/agents/tx-decoder/decode",
      "payTo": "0x0000000000000000000000000000000000000000"
    }
  ]
}

Exact fields follow the configured x402 version and facilitator. Business logic never trusts a client-provided paid=true field. Payment references are persisted and endpoint handling is idempotency-safe. Secret payment configuration is never shipped to frontend bundles.

MCP tools

One MCP server exposes five tools. Tool descriptions use the canonical machine descriptions and call the same execute() implementation.

Tool nameAgent

Discovery and tool listing are free. If the calling environment cannot complete x402 itself, the handler returns a typed payment-required result with the canonical paid endpoint rather than silently bypassing payment.

A2A card

A single network card at the host well-known path advertises all five skills with a canonical service URL, input/output modes, payment notes and version.

  • Card URL/.well-known/agent-card.json
  • Canonical hostagent.becoder.xyz
  • Skillsprovider-reliability, tx-decoder, wallet-permission-auditor, contract-capability-inspector, onchain-data-normalizer

curl examples

Copy-paste against this origin. Set $BASE to the runtime base URL shown above, or to agent.becoder.xyz.

Discovery

BASE="https://agent.becoder.xyz"

curl -s "$BASE/health"
curl -s "$BASE/ready"
curl -s "$BASE/agents"
curl -s "$BASE/agents/tx-decoder"
curl -s "$BASE/openapi.json"
curl -s "$BASE/.well-known/agent-card.json"

Unpaid call returns 402

curl -s -i -X POST "$BASE/v1/agents/tx-decoder/decode" \
  -H "Content-Type: application/json" \
  -d '{"chain_id":"eip155:8453","tx_hash":"0x1111111111111111111111111111111111111111111111111111111111111111"}'

Paid call with an x402 client

# Use an x402-capable client or facilitator.
# The client reads the 402 requirement, pays, and retries the same POST.
# BeCoder never executes paid work before payment verification succeeds.

Outputs are evidence-based utility results, not guarantees of safety or financial advice. Agents distinguish observed facts, deterministic flags, unknowns and external claims. No result should be read as a promise about a contract, wallet or service.