{
  "name": "Loyal Spark",
  "description": "Onchain loyalty on Base (chain 8453). Pay $0.01 USDC at POST /x402-gateway/register-agent for a full lsk_ key on the Free plan (200 calls/month, 1,000 mint tokens/month, all 5 scopes), or use SIWE (POST /agent-register-siwe) with a Shopify store plan or paid Pro/Enterprise plan. Then GET /workflow/program-status and follow next_actions.",
  "url": "https://api.loyalspark.online/agent-api",
  "preferredTransport": "HTTP+JSON",
  "protocolVersion": "mcp+rest",
  "protocolNote": "This card documents Loyal Spark MCP + REST surfaces only. It is not an A2A Agent Card for message/send; A2A is not implemented. Use interfaces.mcp for Streamable HTTP MCP and interfaces.rest for OpenAPI REST.",
  "version": "1.0.0",
  "documentationUrl": "https://loyalspark.online/for-agents",
  "provider": {
    "organization": "Loyal Spark",
    "url": "https://loyalspark.online"
  },
  "capabilities": {
    "streaming": false,
    "pushNotifications": false,
    "stateTransitionHistory": false
  },
  "authentication": {
    "schemes": [
      "apiKey"
    ],
    "credentials": "header x-api-key: lsk_... or Authorization: Bearer lsk_..."
  },
  "defaultInputModes": [
    "application/json",
    "text/plain"
  ],
  "defaultOutputModes": [
    "application/json",
    "text/plain"
  ],
  "skills": [
    {
      "id": "merchant-loyalty",
      "name": "Merchant loyalty",
      "description": "Deploy a loyalty program, mint tokens, and redeem vouchers on Base.",
      "tags": [
        "loyalty",
        "base",
        "mint"
      ]
    },
    {
      "id": "agent-plans",
      "name": "Agent plan payment",
      "description": "Discover Pro ($49/mo or $499.80/yr) and Enterprise ($129/mo or $1,238.40/yr) plan prices via MCP get_payment_info or POST https://api.loyalspark.online/verify-agent-plan-payment (actions get_payment_info, verify_payment). Pay USDC on Base from your registered wallet, then verify with x-api-key lsk_. Free plan keys still come from POST /x402-gateway/register-agent ($0.01).",
      "tags": [
        "pricing",
        "plans",
        "usdc",
        "subscription"
      ],
      "examples": [
        "MCP tools/call get_payment_info",
        "POST https://api.loyalspark.online/verify-agent-plan-payment {\"action\":\"get_payment_info\",\"product\":\"agent\"}",
        "POST https://api.loyalspark.online/verify-agent-plan-payment {\"action\":\"verify_payment\",\"product\":\"agent\",\"plan_slug\":\"pro\",\"transaction_hash\":\"0x…\"}"
      ]
    }
  ],
  "pricing": {
    "currency": "USDC on Base",
    "plans": [
      {
        "name": "Free (via $0.01 x402 register-agent)",
        "price_usd": "0.01 one-time key registration",
        "note": "POST /x402-gateway/register-agent"
      },
      {
        "name": "Pro",
        "price_usdc_monthly": 49,
        "annual_price_usdc": 499.8,
        "annual_discount_percent": 15
      },
      {
        "name": "Enterprise",
        "price_usdc_monthly": 129,
        "annual_price_usdc": 1238.4,
        "annual_discount_percent": 20
      }
    ],
    "how_to_pay": {
      "mcp_tool": "get_payment_info",
      "rest": "POST https://api.loyalspark.online/verify-agent-plan-payment",
      "actions": ["get_payment_info", "verify_payment"],
      "auth": "x-api-key: lsk_..."
    }
  },
  "interfaces": {
    "mcp": {
      "url": "https://api.loyalspark.online/loyalty-mcp",
      "transport": "streamable-http",
      "card": "https://loyalspark.online/.well-known/mcp.json",
      "auth": "x-api-key: lsk_",
      "note": "Only MCP transport. Not an A2A message/send endpoint."
    },
    "rest": {
      "openapi": "https://loyalspark.online/openapi.json",
      "openapi_lite": "https://loyalspark.online/openapi-lite.json",
      "baseUrl": "https://api.loyalspark.online/agent-api"
    },
    "a2a": {
      "implemented": false,
      "note": "Loyal Spark does not implement A2A message/send. Prefer MCP or REST."
    },
    "siwe": {
      "first": true,
      "nonceUrl": "https://api.loyalspark.online/siwe-nonce",
      "registerUrl": "https://api.loyalspark.online/agent-register-siwe",
      "domain": "loyalspark.online",
      "uri": "https://loyalspark.online",
      "chainId": 8453,
      "version": "1",
      "statement": "Register Loyal Spark merchant agent",
      "body": {
        "message": "EIP-4361 string",
        "signature": "0x...",
        "name": "agent name",
        "scopes": [
          "read",
          "create_program",
          "mint",
          "manage_rewards",
          "trade"
        ]
      },
      "docs": "https://loyalspark.online/.well-known/skills/00-getting-started.md",
      "note": "Unpaid SIWE registration when the wallet already has a Shopify store plan, a paid Pro/Enterprise plan, or rotates its existing Free agent by name. Otherwise returns HTTP 402 error_code payment_required — pay $0.01 at POST /x402-gateway/register-agent for a full Free plan lsk_ key (200 calls/mo, 1,000 tokens/mo, all 5 scopes)."
    }
  },
  "api": {
    "base_url": "https://api.loyalspark.online/agent-api",
    "route_count": 40,
    "authenticated_routes": 38,
    "route_count_basis": "OpenAPI 3.1 authenticated operations under /agent-api (38) plus public GET /vouchers/status and GET /platform. Source: https://loyalspark.online/openapi.json",
    "public_routes": [
      "GET /vouchers/status",
      "GET /platform"
    ],
    "note": "GET /info and GET /get_platform_info are aliases of GET /platform and are not extra product routes. Compact OpenAPI: https://loyalspark.online/openapi-lite.json",
    "endpoints": [
      {
        "method": "GET",
        "path": "/platform",
        "scope": "none (public)",
        "description": "Public platform and onboarding JSON. No API key. Aliases: GET /info, GET /get_platform_info, and GET /agent-api?action=platform."
      },
      {
        "method": "GET",
        "path": "/me",
        "scope": "authenticated",
        "description": "Get agent profile, permissions, plan, and wallet info"
      },
      {
        "method": "POST",
        "path": "/workflow/generate-program-defaults",
        "scope": "read or mint or create_program",
        "description": "Return field_catalog, workflow.next_actions, and non-binding examples for program name, symbol, economics, and starter rewards. Does not fill values for the agent."
      },
      {
        "method": "GET",
        "path": "/workflow/program-status",
        "scope": "read",
        "description": "Return machine-readable merchant workflow state, next actions, and prerequisites for the most recent or specified program."
      },
      {
        "method": "GET",
        "path": "/programs",
        "scope": "read",
        "description": "List all active loyalty programs"
      },
      {
        "method": "POST",
        "path": "/programs",
        "scope": "mint or create_program",
        "description": "Start a program deploy workflow. External agents must pass name and symbol. Returns workflow metadata for next steps."
      },
      {
        "method": "POST",
        "path": "/register-program",
        "scope": "mint or create_program",
        "description": "Register a deployed token as a loyalty program in the database. B20 becomes active immediately; legacy ERC-20 needs activation flow next."
      },
      {
        "method": "POST",
        "path": "/update-program-config",
        "scope": "mint or create_program",
        "description": "Update default cashback_rate and/or points_per_dollar for a program you own"
      },
      {
        "method": "POST",
        "path": "/activate-program",
        "scope": "mint or create_program",
        "description": "Activation step for legacy ERC-20 programs. For B20 programs this is a no-op because they are active by construction."
      },
      {
        "method": "POST",
        "path": "/program-status",
        "scope": "mint or create_program",
        "description": "Update program status in database after on-chain activation/pause"
      },
      {
        "method": "GET",
        "path": "/rewards",
        "scope": "read",
        "description": "List rewards for a loyalty program"
      },
      {
        "method": "POST",
        "path": "/rewards",
        "scope": "manage_rewards",
        "description": "Create a new reward redeemable with loyalty tokens"
      },
      {
        "method": "POST",
        "path": "/mint",
        "scope": "mint",
        "description": "Prepare a fee-first mint: returns calls[] (protocol fee first, then recipient) plus fee_obligation_id. Submit onchain then confirm. Prefer recipient_address; recipient is a legacy alias."
      },
      {
        "method": "POST",
        "path": "/mint/confirm",
        "scope": "mint",
        "description": "Verify the protocol-fee mint on Base and settle the pending fee obligation. Required after /mint or /earn when fee_amount > 0."
      },
      {
        "method": "GET",
        "path": "/mints",
        "scope": "read or mint",
        "description": "List mint intents for this key. Query status=pending|completed and optional token_address. No per-call charge with an lsk_ key. Not on x402 or MPP."
      },
      {
        "method": "GET",
        "path": "/fee-obligations",
        "scope": "read or mint",
        "description": "This key's fee obligations. status=unpaid means pending. A settled row can still need POST /mint/confirm. No per-call charge with an lsk_ key. Not on x402 or MPP."
      },
      {
        "method": "POST",
        "path": "/earn",
        "scope": "mint",
        "description": "Auto-calculate and mint tokens from purchase amount using program's cashback rate. POS-friendly alternative to /mint."
      },
      {
        "method": "POST",
        "path": "/transfer",
        "scope": "mint",
        "description": "Transfer loyalty tokens between wallets. Returns calldata with Builder Code for onchain execution."
      },
      {
        "method": "GET",
        "path": "/balance",
        "scope": "read",
        "description": "Check token balance for a wallet"
      },
      {
        "method": "GET",
        "path": "/customers",
        "scope": "read",
        "description": "List customers with token balances and activity"
      },
      {
        "method": "GET",
        "path": "/analytics",
        "scope": "read",
        "description": "Get program analytics and performance metrics"
      },
      {
        "method": "GET",
        "path": "/vouchers",
        "scope": "read",
        "description": "List vouchers with optional filters (token_address, status, limit)"
      },
      {
        "method": "GET",
        "path": "/vouchers/status",
        "scope": "none (public)",
        "description": "Check voucher status by code or ID. No API key required."
      },
      {
        "method": "POST",
        "path": "/redeem-reward",
        "scope": "read",
        "description": "Redeem a reward: verify on-chain token transfer tx and create a voucher"
      },
      {
        "method": "POST",
        "path": "/vouchers/use",
        "scope": "manage_rewards",
        "description": "Mark a voucher as used (redeemed by customer). Merchant-only."
      },
      {
        "method": "GET",
        "path": "/tx-receipt",
        "scope": "authenticated",
        "description": "Extract token_address from a deploy transaction hash (requires API key; not public)"
      },
      {
        "method": "GET",
        "path": "/offers",
        "scope": "read or trade",
        "description": "List active P2P escrow offers for token trading"
      },
      {
        "method": "POST",
        "path": "/offers",
        "scope": "trade",
        "description": "Create a new P2P escrow offer. Returns escrow contract calldata for atomic swap."
      },
      {
        "method": "POST",
        "path": "/accept-offer",
        "scope": "trade",
        "description": "Accept a P2P offer. Returns escrow contract calldata for fillOffer."
      },
      {
        "method": "POST",
        "path": "/cancel-offer",
        "scope": "trade",
        "description": "Cancel your own P2P offer. Returns escrow contract calldata for cancelOffer."
      },
      {
        "method": "GET",
        "path": "/merchant-profile",
        "scope": "read",
        "description": "Get merchant business profile (business_name, category, branding) for the agent's bound wallet."
      },
      {
        "method": "POST",
        "path": "/merchant-profile",
        "scope": "mint or create_program",
        "description": "Upsert merchant business profile (business_name, category, logo_url, description, website, location)."
      },
      {
        "method": "PUT",
        "path": "/merchant-profile",
        "scope": "mint or create_program",
        "description": "Update the merchant business profile for the agent's bound wallet."
      },
      {
        "method": "GET",
        "path": "/store/codes",
        "scope": "read",
        "description": "List Shopify discount codes for this merchant's store. Optional query token_address. API key only: not on the x402 or MPP gateway."
      },
      {
        "method": "POST",
        "path": "/store/codes",
        "scope": "manage_rewards",
        "description": "Mark a Shopify discount code used, or cancel it and return the loyalty points. API key only: not on the x402 or MPP gateway."
      },
      {
        "method": "GET",
        "path": "/store/channel",
        "scope": "read",
        "description": "How this store's customers spend points: online (checkout code), offline (voucher at the register), or both. API key only."
      },
      {
        "method": "POST",
        "path": "/store/channel",
        "scope": "manage_rewards or mint",
        "description": "Set how customers spend points. API key only: not on the x402 or MPP gateway."
      }
    ]
  },
  "recipient_registration": {
    "rest_base_url": "https://api.loyalspark.online/recipient-api",
    "nonce_url": "https://api.loyalspark.online/siwe-nonce",
    "register_url": "https://api.loyalspark.online/recipient-api/register",
    "body": {
      "message": "EIP-4361 string",
      "signature": "0x...",
      "name": "optional label"
    },
    "note": "No special SIWE statement phrase. Chain ID 8453. Do not send a Supabase apikey header on api.loyalspark.online. Returns rwk_ once. Merchant registration is a different route (agent-register-siwe) and does use the statement 'Register Loyal Spark merchant agent'."
  }
}
