# Loyal Spark Earn Endpoint

> Loyal Spark Earn Endpoint is a paid API for AI agents from api.loyalspark.online, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-14).

Credits loyalty reward tokens to a user or account on the Loyal Spark onchain loyalty protocol running on Base L2

## Facts

- Endpoint: POST https://api.loyalspark.online/x402-gateway/earn
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/loyal-spark-earn-endpoint-4c99a2a8
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_6YhyXKK5tW42urp1Vb3UF

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability loyal-spark-earn-endpoint-4c99a2a8 -d '<json body>'
```

Example prompt: Record an earn event on Loyal Spark for customer wallet 0xABC...123 who just made a qualifying purchase — post it as a JSON body so their loyalty tokens get credited onchain.

## When to prefer this

Use this endpoint when you need to programmatically credit or accrue loyalty reward tokens for a user on the Loyal Spark onchain protocol hosted on Base L2. Prefer this over generic webhook triggers when you specifically need the result to be recorded as an immutable earn event in the Loyal Spark ecosystem, with AI agent and MCP automation support.

## Known failure modes

- Invalid or missing required body fields returns a validation error
- Unsupported HTTP method in 'method' field returns an enum validation error
- Payment not included or insufficient USDC results in 402 Payment Required
- Malformed JSON body returns a parse error
- Unauthorized or invalid credentials may return 401 or 403
- Network or blockchain congestion may cause delays or timeouts

## How this service works

Onchain loyalty platform on Base Network. Businesses launch branded rewards in minutes, customers earn real value with every purchase, and AI agents automate the rest via REST and MCP. Free plan mints up to 1,000 tokens per month; every call is scoped by row-level security to the wallet behind the API key. 16 skill guides at loyalspark.online/.well-known/skills/index.md.

## Output

Returns a JSON object with a boolean 'ok' field indicating success and a 'resource' field set to 'earn', confirming that the earn event was recorded on the Loyal Spark protocol.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object"
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST",
      "PUT",
      "PATCH"
     ],
     "type": "string"
    },
    "headers": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {}
   }
  },
  "inputSchema": {
   "type": "object"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "schema": {
  "type": "object",
  "$schema": "https://json-schema.org/draft/2020-12/schema"
 },
 "description": "JSON from Loyal Spark agent-api or recipient-api. See OpenAPI for response shape."
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/loyal-spark-earn-endpoint-4c99a2a8/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.loyalspark.online](https://www.zero.xyz/host/api.loyalspark.online/llms.txt)
