Loyal Spark Identity API
Public SIWE nonce and merchant agent registration (no API key)
Public SIWE nonce and merchant agent registration (no API key)
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/loyalspark-online:loyalspark-online-identity-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Loyal Spark — Onchain Loyalty Protocol on Base Identity API
version: 2.2.0
summary: AI-agent-native loyalty-as-a-service protocol on Base L2 with paid x402 + MPP corridors.
description: 'Loyal Spark is an onchain loyalty-as-a-service protocol on Base L2. AI agents and merchants can create B20 loyalty programs (legacy ERC-20 optional), mint tokens to customer wallets, manage reward catalogs, trade tokens on a P2P escrow marketplace, redeem rewards for vouchers, and run analytics — all via paid x402 endpoints (USDC on Base) or via standard REST with x-api-key. Coverage: 89 paid operations across 83 paths (x402 corridor). Direct MCP exposes 43 merchant + 20 recipient tools (get_platform_info answers without a key or a payment); paid x402 MCP prices 32 merchant + 16 recipient tools (confirm_mint_fee is lsk_-only settlement, not x402-priced). Builder Code bc_wdmnog7m. Paying $0.01 USDC at POST /x402-gateway/register-agent (when the wallet has no Merchant Store Plan or Paid Agent Plan) issues a full lsk_ key on the Free plan (1 agent, 200 API calls/month, 1,000 mint tokens/month, 1.25% mint fee, all 5 scopes: read, create_program, mint, trade, manage_rewards). A Shopify Store Plan (Starter $39: 1 agent, 1,000 calls/mo, read only; Growth $79 or 45-day store trial: 3 agents, 10,000 calls/mo, read, mint, manage_rewards; Scale $149: 10 agents, 100,000 calls/mo, all 5 scopes) or Paid Agent Plan (Pro $49: 5 agents, 10,000 calls/mo, unlimited mint, 0.5% fee; Enterprise $129: unlimited, 0.25% fee) sets the wallet''s call and scope ceiling. Mint fee is loyalty tokens: 1.25% Free, 0.5% Pro, 0.25% Enterprise. Keyed REST and MCP calls are scoped by Postgres row-level security to the owner wallet behind the lsk_/rwk_ key. On x402 and MPP, every recipient-api route, the merchant GET reads (programs, rewards, balance, customers, vouchers, analytics, merchant-profile, workflow/program-status), the merchant read MCP tools (list_loyalty_programs, list_rewards, get_token_balance, get_program_analytics, export_customers, and similar) and the holder MCP tools accept the payment alone: the paying wallet is the caller (holder on recipient routes, merchant owner on merchant reads). Other routes (mint, create program, create rewards, trade, bazaar tools) need a live lsk_ (merchant) or rwk_ (holder) key on the same request as the payment; a payment without that live key is not charged. Every keyed call and merchant read enforces the wallet''s plan rate and monthly call limits. These routes accept the payment alone; do not send an API key: GET /offers and GET /recipient-api/offers on both gateways, GET /public-programs ($0.001, active programs, same price as GET /programs), POST /x402-gateway/register-agent ($0.01 USDC on Base; when the wallet has no Merchant Store Plan or Paid Agent Plan, issues a full lsk_ key on the Free plan — 1 agent, 200 API calls/month, 1,000 mint tokens/month, 1.25% mint fee, all 5 scopes: read, create_program, mint, trade, manage_rewards; when the wallet belongs to a Merchant Store Plan — Starter $39: 1 agent, 1,000 calls/mo, read only; Growth $79 or 45-day store trial: 3 agents, 10,000 calls/mo, read, mint, manage_rewards; Scale $149: 10 agents, 100,000 calls/mo, all 5 scopes — or a Paid Agent Plan — Pro $49: 5 agents, 10,000 calls/mo, unlimited mint, 0.5% fee; Enterprise $129: unlimited agents/calls/mint, 0.25% fee — the lsk_ key operates strictly within that plan''s call and scope limits; unpaid SIWE registration without a plan returns HTTP 402 error_code payment_required and next_action pay_x402), POST /x402-gateway/mcp-tools/get_platform_info, POST /x402-gateway/mcp-tools/list_marketplace_offers, and POST /x402-gateway/recipient-mcp-tools/list_p2p_offers. 16 agent skill guides (00-15): https://loyalspark.online/.well-known/skills/index.md'
x-guidance: 'Loyal Spark on Base L2 (chain 8453, USDC native).
Auth modes:
• Merchant agents — header x-api-key: lsk_... (or Authorization: Bearer lsk_...). Look first: GET https://api.loyalspark.online/x402-gateway/public-programs ($0.001, active programs, not your own list). Autonomous onboarding: POST https://api.loyalspark.online/x402-gateway/register-agent ($0.01 USDC, no API key; when the wallet has no Merchant Store Plan or Paid Agent Plan, issues a full lsk_ key on the Free plan — 1 agent, 200 API calls/month, 1,000 mint tokens/month, 1.25% mint fee, all 5 scopes: read, create_program, mint, trade, manage_rewards; when the wallet belongs to a Shopify Store Plan — Starter $39: 1 agent, 1,000 calls/month, read only; Growth $79 or 45-day store trial: 3 agents, 10,000 calls/month, read, mint, manage_rewards; Scale $149: 10 agents, 100,000 calls/month, all 5 scopes, 300 rpm — or a Paid Agent Plan — Pro $49: 5 agents, 10,000 calls/month, unlimited mint, 0.5% fee; Enterprise $129: unlimited agents/calls/mint, 0.25% fee — the lsk_ key operates strictly within that plan''s call and scope limits). Dashboard / SIWE registration: https://loyalspark.online/merchant → AI Agents, or POST https://api.loyalspark.online/agent-register-siwe once the wallet has a Store Plan, Paid Agent Plan, or registered agent.
• Holder agents — header x-api-key: rwk_... (or Authorization: Bearer rwk_...). Issued via SIWE: https://loyalspark.online/.well-known/agent.json (200 calls/month Free quota or per-call x402).
• x402 corridor — pay USDC on Base per call. Discovery (application/json): https://api.loyalspark.online/.well-known/x402. Marketing mirror (application/json): https://loyalspark.online/.well-known/x402.json. The extensionless https://loyalspark.online/.well-known/x402 is the same document but that host serves it as application/octet-stream; use the .json mirror or the API origin. Look first with no key: GET https://api.loyalspark.online/x402-gateway/public-programs ($0.001).
Direct REST (this document, not only the paid gateway): every /agent-api and /recipient-api route, including free ones. Typical merchant flow (B20 default):
1. GET /me — profile and scopes
2. POST /programs — B20 createB20 calldata
3. POST /register-program — persist program (status active)
4. POST /update-program-config — set cashback_rate / points_per_dollar
5. POST /rewards — catalog
6. POST /mint or POST /earn — fee-first calls[] + fee_obligation_id
7. POST /mint/confirm — settle protocol fee on-chain
8. GET /analytics — metrics
Legacy ERC-20: add POST /activate-program + program-status after register.
Direct MCP: 43 merchant tools at https://api.loyalspark.online/loyalty-mcp and 20 recipient tools at https://api.loyalspark.online/recipient-loyalty-mcp. Paid x402 MCP paths: /x402-gateway/mcp-tools/<name> (32) and /x402-gateway/recipient-mcp-tools/<name> (16).
Docs: https://loyalspark.online/api-docs · llms: https://loyalspark.online/llms.txt · agent manifest: https://loyalspark.online/.well-known/agent.json
Plan limits: Free plan (issued via $0.01 POST /x402-gateway/register-agent when the wallet has no Store Plan or Paid Agent Plan): 1 agent, 200 API calls/month, 1,000 mint tokens/month, 1.25% mint fee, all 5 scopes (read, create_program, mint, trade, manage_rewards). Shopify Store Plans set the merchant''s ceiling (an agent plan does not raise a store ceiling): Starter ($39/mo) 1 agent, 1,000 calls/month, read only; Growth ($79/mo and 45-day store trial) 3 agents, 10,000 calls/month, read, mint, manage_rewards; Scale ($149/mo) 10 agents, 100,000 calls/month, all 5 scopes, 300 rpm. Paid Agent Plans: Pro ($49/mo) 5 agents, 10,000 calls/month, unlimited mint, 0.5% mint fee; Enterprise ($129/mo) unlimited agents, calls, and mint, 0.25% mint fee. Mint fee is charged in loyalty tokens: 1.25% Free, 0.5% Pro, 0.25% Enterprise.
Access control: Keyed REST and MCP calls are scoped by Postgres row-level security to the owner wallet behind the lsk_/rwk_ key. On x402 and MPP, every recipient-api route, the merchant GET reads (programs, rewards, balance, customers, vouchers, analytics, merchant-profile, workflow/program-status), the merchant read MCP tools (list_loyalty_programs, list_rewards, get_token_balance, get_program_analytics, export_customers, and similar) and the holder MCP tools accept the payment alone: the paying wallet is the caller (holder on recipient routes, merchant owner on merchant reads). Other routes (mint, create program, create rewards, trade, bazaar tools) need a live lsk_ (merchant) or rwk_ (holder) key on the same request as the payment; a payment without that live key is not charged. Every keyed call and merchant read enforces the wallet''s plan rate and monthly call limits. These routes accept the payment alone; do not send an API key: GET /offers and GET /recipient-api/offers on both gateways, GET /public-programs ($0.001, active programs, same price as GET /programs), POST /x402-gateway/register-agent ($0.01 USDC on Base; when the wallet has no Merchant Store Plan or Paid Agent Plan, issues a full lsk_ key on the Free plan — 1 agent, 200 API calls/month, 1,000 mint tokens/month, 1.25% mint fee, all 5 scopes: read, create_program, mint, trade, manage_rewards; when the wallet belongs to a Merchant Store Plan — Starter $39: 1 agent, 1,000 calls/mo, read only; Growth $79 or 45-day store trial: 3 agents, 10,000 calls/mo, read, mint, manage_rewards; Scale $149: 10 agents, 100,000 calls/mo, all 5 scopes — or a Paid Agent Plan — Pro $49: 5 agents, 10,000 calls/mo, unlimited mint, 0.5% fee; Enterprise $129: unlimited agents/calls/mint, 0.25% fee — the lsk_ key operates strictly within that plan''s call and scope limits; unpaid SIWE registration without a plan returns HTTP 402 error_code payment_required and next_action pay_x402), POST /x402-gateway/mcp-tools/get_platform_info, POST /x402-gateway/mcp-tools/list_marketplace_offers, and POST /x402-gateway/recipient-mcp-tools/list_p2p_offers.
Skills: 16 agent skill guides (00-15): https://loyalspark.online/.well-known/skills/index.md'
contact:
name: Loyal Spark
email: admin@loyalspark.online
url: https://loyalspark.online
license:
name: MIT
url: https://loyalspark.online
x-logo:
url: https://loyalspark.online/new-favicon.png
altText: Loyal Spark
x-provider: Loyal Spark
x-brand: Loyal Spark
x-builder-code: bc_wdmnog7m
x-mcp:
url: https://api.loyalspark.online/loyalty-mcp
transport: streamable-http
tool_count: 43
x-recipient-mcp:
url: https://api.loyalspark.online/recipient-loyalty-mcp
transport: streamable-http
tool_count: 20
x-x402-discovery:
wellKnownResources: https://api.loyalspark.online/.well-known/x402
gatewayBaseUrl: https://api.loyalspark.online/x402-gateway
asset: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
network: eip155:8453
x-skills:
url: https://loyalspark.online/.well-known/skills/index.md
guide_count: 16
range: 00-15
x-plan-limits:
free:
api_calls_monthly: 200
max_mint_amount_monthly: 1000
max_agents: 1
transaction_fee_percent: 1.25
scopes:
- read
- create_program
- mint
- trade
- manage_rewards
starter_store:
api_calls_monthly: 1000
max_agents: 1
scopes:
- read
growth_store:
api_calls_monthly: 10000
max_agents: 3
scopes:
- read
- mint
- manage_rewards
scale_store:
api_calls_monthly: 100000
max_agents: 10
scopes:
- read
- create_program
- mint
- trade
- manage_rewards
pro:
api_calls_monthly: 10000
max_mint_amount_monthly: null
max_agents: 5
transaction_fee_percent: 0.5
enterprise:
api_calls_monthly: null
max_mint_amount_monthly: null
max_agents: null
transaction_fee_percent: 0.25
note: 'Paying $0.01 at POST /x402-gateway/register-agent (when the wallet has no Store Plan or Paid Agent Plan) issues a full lsk_ key on the Free plan (1 agent, 200 calls/month, 1,000 mint tokens/month, 1.25% mint fee, all 5 scopes). A Shopify Store Plan caps that merchant: Starter 1 agent and 1,000 calls/month read only, Growth (and 45-day store trial) 3 agents and 10,000 calls/month read, mint, manage_rewards, Scale 10 agents and 100,000 calls/month all 5 scopes and 300 rpm. Paid Agent Plans: Pro ($49/mo, 5 agents, 10,000 calls/mo, unlimited mint, 0.5% fee) and Enterprise ($129/mo, unlimited agents/calls/mint, 0.25% fee).'
x-access-control:
model: row-level-security
description: 'Keyed REST and MCP calls are scoped by Postgres row-level security to the owner wallet behind the lsk_/rwk_ key. On x402 and MPP, every recipient-api route, the merchant GET reads (programs, rewards, balance, customers, vouchers, analytics, merchant-profile, workflow/program-status), the merchant read MCP tools (list_loyalty_programs, list_rewards, get_token_balance, get_program_analytics, export_customers, and similar) and the holder MCP tools accept the payment alone: the paying wallet is the caller (holder on recipient routes, merchant owner on merchant reads). Other routes (mint, create program, create rewards, trade, bazaar tools) need a live lsk_ (merchant) or rwk_ (holder) key on the same request as the payment; a payment without that live key is not charged. Every keyed call and merchant read enforces the wallet''s plan rate and monthly call limits. These routes accept the payment alone; do not send an API key: GET /offers and GET /recipient-api/offers on both gateways, GET /public-programs ($0.001, active programs, same price as GET /programs), POST /x402-gateway/register-agent ($0.01 USDC on Base; when the wallet has no Merchant Store Plan or Paid Agent Plan, issues a full lsk_ key on the Free plan — 1 agent, 200 API calls/month, 1,000 mint tokens/month, 1.25% mint fee, all 5 scopes: read, create_program, mint, trade, manage_rewards; when the wallet belongs to a Merchant Store Plan — Starter $39: 1 agent, 1,000 calls/mo, read only; Growth $79 or 45-day store trial: 3 agents, 10,000 calls/mo, read, mint, manage_rewards; Scale $149: 10 agents, 100,000 calls/mo, all 5 scopes — or a Paid Agent Plan — Pro $49: 5 agents, 10,000 calls/mo, unlimited mint, 0.5% fee; Enterprise $129: unlimited agents/calls/mint, 0.25% fee — the lsk_ key operates strictly within that plan''s call and scope limits; unpaid SIWE registration without a plan returns HTTP 402 error_code payment_required and next_action pay_x402), POST /x402-gateway/mcp-tools/get_platform_info, POST /x402-gateway/mcp-tools/list_marketplace_offers, and POST /x402-gateway/recipient-mcp-tools/list_p2p_offers.'
servers:
- url: https://api.loyalspark.online
description: Loyal Spark — canonical API origin for x402scan discovery and paid resource invocation. All listed x402 gateway paths return live HTTP 402 payment requirements.
security:
- apiKey: []
tags:
- name: Identity
description: Public SIWE nonce and merchant agent registration (no API key)
paths:
/siwe-nonce:
post:
tags:
- Identity
operationId: siweNonce
summary: Issue a one-time SIWE nonce
description: 'Public. POST https://api.loyalspark.online/siwe-nonce (no API key, no payment). Returns a nonce plus next_action: a ready EIP-4361 template for a merchant lsk_ key when the wallet has a Shopify Store Plan, a Paid Agent Plan (Pro/Enterprise), or an existing registered agent (otherwise HTTP 402 error_code payment_required, pointing to $0.01 POST /x402-gateway/register-agent for a full Free-plan lsk_ key) (domain loyalspark.online, URI https://loyalspark.online, Chain ID 8453, statement ''Register Loyal Spark merchant agent'') and the POST target agent-register-siwe. Registering again with the same wallet and name rotates the key. The same nonce is consumed by siwe-verify, agent-register-siwe, and recipient-api/register. Domain must be an allowed host (loyalspark.online, www.loyalspark.online, loyaltyspark.lovable.app, loyalty-spark.lovable.app, this project''s preview host, localhost, 127.0.0.1; no other *.lovable.app) and must match the URI hostname. Chain ID must be 8453.'
security: []
responses:
'200':
description: Fresh nonce
content:
application/json:
schema:
type: object
required:
- nonce
- next_action
properties:
nonce:
type: string
example: 0123456789abcdef0123456789abcdef
next_action:
type: object
description: Merchant lsk_ key via SIWE for a wallet with a Shopify Store Plan, Paid Agent Plan (Pro/Enterprise), or existing registered agent (rotates key). Replace 0xYOUR_WALLET, sign the message, and POST body to url. With no plan or registered agent, the response is HTTP 402 error_code payment_required and next_action pay_x402 (pay $0.01 USDC at POST /x402-gateway/register-agent for a full Free-plan lsk_ key).
properties:
type:
type: string
example: sign_siwe_and_register
method:
type: string
example: POST
url:
type: string
example: https://api.loyalspark.online/agent-register-siwe
body:
type: object
siwe:
type: object
properties:
domain:
type: string
example: loyalspark.online
uri:
type: string
example: https://loyalspark.online
chainId:
type: integer
example: 8453
version:
type: string
example: '1'
statement:
type: string
nonce:
type: string
issuedAt:
type: string
expirationTime:
type: string
free_plan_option:
type: object
description: 'Autonomous x402 registration ($0.01 USDC on Base at POST /x402-gateway/register-agent). Issues a full Free-plan lsk_ key (1 agent, 200 calls/mo, 1,000 mint tokens/mo, 1.25% fee, all 5 scopes: read, create_program, mint, trade, manage_rewards) when the wallet has no Store/Agent plan, or a plan-scoped lsk_ key if on a Store/Agent plan. api_key is shown once; recover it free via SIWE rotation.'
read_only_option:
type: object
deprecated: true
description: Deprecated alias of free_plan_option (same content; the key is NOT read-only). Autonomous x402 registration ($0.01 USDC on Base at POST /x402-gateway/register-agent). Issues a full Free-plan lsk_ key (1 agent, 200 calls/mo, 1,000 mint tokens/mo, 1.25% fee, all 5 scopes) when the wallet has no Store/Agent plan, or a plan-scoped lsk_ key if on a Store/Agent plan.
/agent-register-siwe:
post:
tags:
- Identity
operationId: agentRegisterSiwe
summary: Register a merchant agent API key with SIWE
description: 'Public. POST https://api.loyalspark.online/agent-register-siwe. No API key. The signed EIP-4361 message must contain the exact statement ''Register Loyal Spark merchant agent'', Chain ID 8453, a nonce from POST https://api.loyalspark.online/siwe-nonce, and a domain/URI on the allowlist (production: domain loyalspark.online and URI https://loyalspark.online). Write scopes (create_program, mint, manage_rewards, trade) are stored with read included. The lsk_ key is returned once. Send agent_name (alias name). Registering again with the same wallet and the same name rotates and recovers the key (HTTP 200, rotated true) and keeps the stored name; the previous key stops working.'
security: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- message
- signature
anyOf:
- required:
- agent_name
- required:
- name
properties:
message:
type: string
description: Complete EIP-4361 message. Replace Nonce and Issued At before signing.
example: 'loyalspark.online wants you to sign in with your Ethereum account:
0x0000000000000000000000000000000000000001
${MERCHANT_SIWE_STATEMENT}
URI: https://loyalspark.online
Version: 1
Chain ID: 8453
Nonce: 0123456789abcdef0123456789abcdef
Issued At: 2026-10-21T18:00:00.000Z'
signature:
type: string
description: Hex signature of message by the address line.
agent_name:
type: string
maxLength: 64
example: Cafe agent
description: Agent name (trimmed, control/markup characters removed, max 64). Same wallet + same name rotates that agent's key; a rotation never renames.
name:
type: string
maxLength: 64
description: Alias of agent_name (agent_name wins when both are sent).
description:
type: string
maxLength: 500
scopes:
type: array
items:
type: string
enum:
- read
- create_program
- mint
- trade
- manage_rewards
example:
- create_program
- mint
- manage_rewards
description: Requested scopes. Any write scope also persists read. Empty or omitted becomes [read].
example:
message: 'loyalspark.online wants you to sign in with your Ethereum account:
0x0000000000000000000000000000000000000001
${MERCHANT_SIWE_STATEMENT}
URI: https://loyalspark.online
Version: 1
Chain ID: 8453
Nonce: 0123456789abcdef0123456789abcdef
Issued At: 2026-10-21T18:00:00.000Z'
signature: 0x
agent_name: Cafe agent
scopes:
- create_program
- mint
- manage_rewards
responses:
'200':
description: 'Same wallet and name: the key was rotated. api_key is the new key and the previous key stops working. rotated is true.'
'201':
description: Agent created. api_key is shown once.
content:
application/json:
schema:
type: object
properties:
api_key:
type: string
example: lsk_...
description: Shown once. Save it now.
warning:
type: string
agent:
type: object
'400':
description: Missing fields, or SIWE domain, URI, or chain ID rejected.
'401':
description: 'Invalid signature, expired message, or used nonce. error_code: siwe_message_expired or siwe_nonce_invalid; next_steps: POST /siwe-nonce, sign a new message, POST agent-register-siwe again.'
components:
securitySchemes:
apiKey:
type: apiKey
in: header
name: x-api-key
description: Agent API key (lsk_... merchant or rwk_... recipient)
siwx:
type: apiKey
in: header
name: SIGN-IN-WITH-X
description: SIWE proof (identity-only routes)