Loyal Spark Billing API
The Billing API from Loyal Spark — 1 operation(s) for billing.
The Billing API from Loyal Spark — 1 operation(s) for billing.
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-billing-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 Billing 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: Billing
paths:
/verify-agent-plan-payment:
post:
tags:
- Billing
operationId: verifyAgentPlanPayment
summary: Agent/merchant plan payment info and USDC verify
description: 'POST https://api.loyalspark.online/verify-agent-plan-payment. Actions: get_payment_info (treasury, per-plan limits, annual prices, required_sender_rule, steps) and verify_payment (after a plain USDC transfer on Base). Auth: x-api-key lsk_ (owner_address is the required Transfer from) or Supabase JWT with linked wallet. product agent|merchant; plan_slug pro|enterprise (agent) or starter|growth|scale (merchant); billing_cycle monthly|annual. Transfer from must equal the authenticated wallet (403 payer_mismatch otherwise). Not an x402 resource.'
security:
- apiKey: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- action
properties:
action:
type: string
enum:
- get_payment_info
- verify_payment
- retry_verification
- admin_verify
product:
type: string
enum:
- agent
- merchant
default: agent
plan_slug:
type: string
enum:
- pro
- enterprise
- starter
- growth
- scale
billing_cycle:
type: string
enum:
- monthly
- annual
default: monthly
transaction_hash:
type: string
pattern: ^0x[0-9a-fA-F]{64}$
subscription_id:
type: string
format: uuid
examples:
get_payment_info:
value:
action: get_payment_info
product: agent
verify_payment:
value:
action: verify_payment
product: agent
plan_slug: pro
billing_cycle: monthly
transaction_hash: '0x0000000000000000000000000000000000000000000000000000000000000001'
responses:
'200':
description: Payment info or verified subscription
content:
application/json:
schema:
type: object
properties:
product:
type: string
subscription_wallet:
type: string
usdc_contract:
type: string
chain_id:
type: integer
required_sender_rule:
type: string
steps:
type: array
items:
type: string
plans:
type: array
items:
type: object
properties:
slug:
type: string
price_usdc_monthly:
type: number
annual_price_usdc:
type: number
max_api_calls_monthly:
type:
- integer
- 'null'
max_mint_amount_monthly:
type:
- number
- 'null'
max_agents:
type:
- integer
- 'null'
transaction_fee_percent:
type:
- number
- 'null'
limits:
type: object
additionalProperties: true
verified:
type: boolean
plan_effective:
type: boolean
effective_limits:
type: object
additionalProperties: true
error_code:
type: string
next_steps:
type: object
additionalProperties: true
'400':
description: invalid_json / missing_fields / payment_unverified
content:
application/json:
schema:
type: object
required:
- error
- error_code
additionalProperties: true
properties:
error:
type: string
error_code:
type: string
description: Stable machine code. 401 bodies use error_code and do not also send code.
missing:
type: array
items:
type: string
example: {}
docs:
type: string
next_action:
type: object
description: 'Merchant (lsk_): POST /x402-gateway/register-agent ($0.01, method+url+body). Holder (rwk_): free SIWE registration (first_step POST /siwe-nonce, then POST /recipient-api/register).'
next_steps:
type: object
description: Machine-readable first step matching next_action (register-agent for lsk_; siwe-nonce for rwk_).
siwe_register:
type: object
description: SIWE registration template (merchant or holder). Prefer this over siwe_after_payment.
siwe_after_payment:
type: object
deprecated: true
description: Deprecated alias of siwe_register. SIWE is free and comes first; it is not after payment.
free_plan_option:
type: object
description: 'Merchant only: $0.01 POST /x402-gateway/register-agent Free-plan lsk_ option.'
'401':
description: missing_auth
content:
application/json:
schema:
type: object
required:
- error
- error_code
additionalProperties: true
properties:
error:
type: string
error_code:
type: string
description: Stable machine code. 401 bodies use error_code and do not also send code.
missing:
type: array
items:
type: string
example: {}
docs:
type: string
next_action:
type: object
description: 'Merchant (lsk_): POST /x402-gateway/register-agent ($0.01, method+url+body). Holder (rwk_): free SIWE registration (first_step POST /siwe-nonce, then POST /recipient-api/register).'
next_steps:
type: object
description: Machine-readable first step matching next_action (register-agent for lsk_; siwe-nonce for rwk_).
siwe_register:
type: object
description: SIWE registration template (merchant or holder). Prefer this over siwe_after_payment.
siwe_after_payment:
type: object
deprecated: true
description: Deprecated alias of siwe_register. SIWE is free and comes first; it is not after payment.
free_plan_option:
type: object
description: 'Merchant only: $0.01 POST /x402-gateway/register-agent Free-plan lsk_ option.'
'403':
description: payer_mismatch — Transfer from ≠ registered wallet
content:
application/json:
schema:
type: object
required:
- error
- error_code
additionalProperties: true
properties:
error:
type: string
error_code:
type: string
description: Stable machine code. 401 bodies use error_code and do not also send code.
missing:
type: array
items:
type: string
example: {}
docs:
type: string
next_action:
type: object
description: 'Merchant (lsk_): POST /x402-gateway/register-agent ($0.01, method+url+body). Holder (rwk_): free SIWE registration (first_step POST /siwe-nonce, then POST /recipient-api/register).'
next_steps:
type: object
description: Machine-readable first step matching next_action (register-agent for lsk_; siwe-nonce for rwk_).
siwe_register:
type: object
description: SIWE registration template (merchant or holder). Prefer this over siwe_after_payment.
siwe_after_payment:
type: object
deprecated: true
description: Deprecated alias of siwe_register. SIWE is free and comes first; it is not after payment.
free_plan_option:
type: object
description: 'Merchant only: $0.01 POST /x402-gateway/register-agent Free-plan lsk_ option.'
'409':
description: tx_already_used / shopify_billed
content:
application/json:
schema:
type: object
required:
- error
- error_code
additionalProperties: true
properties:
error:
type: string
error_code:
type: string
description: Stable machine code. 401 bodies use error_code and do not also send code.
missing:
type: array
items:
type: string
example: {}
docs:
type: string
next_action:
type: object
description: 'Merchant (lsk_): POST /x402-gateway/register-agent ($0.01, method+url+body). Holder (rwk_): free SIWE registration (first_step POST /siwe-nonce, then POST /recipient-api/register).'
next_steps:
type: object
description: Machine-readable first step matching next_action (register-agent for lsk_; siwe-nonce for rwk_).
siwe_register:
type: object
description: SIWE registration template (merchant or holder). Prefer this over siwe_after_payment.
siwe_after_payment:
type: object
deprecated: true
description: Deprecated alias of siwe_register. SIWE is free and comes first; it is not after payment.
free_plan_option:
type: object
description: 'Merchant only: $0.01 POST /x402-gateway/register-agent Free-plan lsk_ option.'
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)