Skip to content

Indexer REST API ​

The SLASettle Indexer service provides a read-optimized REST API that parses on-chain Soroban events into indexed records for fast client consumption.

  • Hosted Production Endpoint: https://slasettle-indexer-v02.slasettle-indexer.workers.dev
  • Hosting Engine: Cloudflare Workers with Cloudflare D1 SQL storage
  • Design Boundary: Read-only. The API contains zero write endpoints and holds no signing keys.

API Endpoints ​

1. Health Status (GET /v1/health) ​

Returns ingestion engine health and the most recently ingested ledger sequence.

Response 200 OK:

json
{
  "status": "ok",
  "last_indexed_ledger": 5214890
}

2. Network Clock (GET /v1/clock) ​

Returns the authoritative network reference timestamp and active round sequence.

Response 200 OK:

json
{
  "current_time": "2026-10-07T14:32:00.000Z",
  "unix_timestamp": 1791383520,
  "round_length_seconds": 60,
  "current_round_id": 29856392
}

3. Active Watchers (GET /v1/watchers) ​

Returns the list of currently authorized watcher nodes (removed_at IS NULL).

Response 200 OK:

json
{
  "data": [
    {
      "address": "GA4WTXER6HGGZUXEPIOFYRTMOM34Q675DEAAK3WLBIO2FY7ENFNNDQHK",
      "registered_at": "2026-10-01T12:00:00Z"
    }
  ],
  "next_cursor": null
}

4. Active Round Status (GET /v1/slas/:slaId/current-round) ​

Aggregates checks submitted during the active round for a specified SLA.

Parameters:

  • slaId: Numerical SLA identifier (path parameter).

Response 200 OK:

json
{
  "round_id": 29856392,
  "round_started_at": "2026-10-07T14:32:00.000Z",
  "ledger_sequence": 5215001,
  "ledger_close_time": "2026-10-07T14:32:15.000Z",
  "checked_in": [
    {
      "watcher": "GA4WTXER6HGGZUXEPIOFYRTMOM34Q675DEAAK3WLBIO2FY7ENFNNDQHK",
      "status": "up",
      "checked_at": "2026-10-07T14:32:15Z"
    }
  ],
  "not_yet_checked_in": [
    "GB7N22Q..."
  ]
}

ledger_sequence is the sequence of the latest ledger used for this response. ledger_close_time is that ledger's close time in ISO 8601 UTC form. Both values come from the same latest-ledger snapshot used to calculate round_id; round_started_at is the beginning of that round. The endpoint still performs the two D1 reads used to assemble watcher participation.

Clients should treat the two ledger fields as a pair. A response with both fields absent is from a Worker deployed before this extension and must be treated as degraded; a partial or invalid pair is an invalid response. Deploy the Worker before the Web client to use one indexer request during a normal status poll. A Web deployment made first remains compatible with older Workers by using /v1/clock for read-only status and keeping settlement disabled until a coherent ledger snapshot is available.


5. Settlement History (GET /v1/slas/:slaId/settlements) ​

Chronological list of all executed breach penalty settlements for an SLA.

Parameters:

  • slaId: Numerical SLA identifier (path parameter).
  • limit: Number of records to return (optional, default: 20, maximum: 100).
  • before: Opaque pagination cursor (optional).

Response 200 OK:

json
{
  "data": [
    {
      "round_id": 1042,
      "votes_up": 1,
      "votes_down": 4,
      "quorum_threshold": 3,
      "penalty_amount": "10000000",
      "beneficiary": "GBAKUA3AN6MNXF6RREUBQRN3Z6JKT3IH5O6T3WUK3JRYVIWFN45XNVJ2",
      "tx_hash": "6522d8b77e135fc60154089d89b2b720d71593eed0de63916187eef16897d147",
      "ledger_close_time": "2026-10-01T12:45:00Z",
      "explorer_url": "https://stellar.expert/explorer/testnet/tx/6522d8b77e135fc60154089d89b2b720d71593eed0de63916187eef16897d147"
    }
  ],
  "next_cursor": null
}

6. SLA Lifecycle History (GET /v1/slas/:slaId/lifecycle) ​

Chronological list of bond top-up, cancellation, and bond withdrawal events for an SLA. This endpoint is live on the v0.2 GREEN production indexer.

Parameters:

  • slaId: Numerical SLA identifier (path parameter).

Response 200 OK:

json
{
  "data": [
    {
      "event_type": "bond_topped_up",
      "amount": "5000000",
      "tx_hash": "abc123...",
      "ledger_close_time": "2026-10-07T14:32:00Z"
    },
    {
      "event_type": "sla_cancelled",
      "amount": null,
      "tx_hash": "def456...",
      "ledger_close_time": "2026-10-08T09:00:00Z"
    }
  ],
  "next_cursor": null
}

event_type is one of bond_topped_up, sla_cancelled, bond_withdrawn. amount is null for sla_cancelled, which carries no amount on-chain.


v0.2 Note: Endpoint Commitments ​

Under the v0.2 contract interface, sla_created and check_submitted events carry an endpoint_hash — a SHA-256 commitment to the SLA's monitored endpoint (see the SDK's computeEndpointHash and SLASettle-contract-spec.md section 3 for the exact algorithm). This indexer stores it as lowercase hex and never attempts to reverse it into a URL — a hash is not reversible metadata.


Error Handling & CORS Policy ​

  • 400 Bad Request: Returned when path parameters or query constraints (e.g. invalid cursor or negative limits) fail validation.
  • 404 Not Found: Returned if an SLA identifier has no recorded events.
  • 500 Internal Error: Returned if upstream Soroban RPC queries or database reads experience an unhandled failure.
  • CORS Allowlist: Cross-Origin Resource Sharing is controlled via strict allowlists (ALLOWED_ORIGINS). Wildcard origins (*) are disallowed in production deployments.