> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sundialprotocol.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sundial Node API: Overview, Auth, and All Endpoints

> The Sundial node API is an unversioned RPC-style HTTP API for submitting L2 transactions, querying UTxOs and block data, and monitoring node health.

The Sundial node exposes an unversioned, RPC-style HTTP API that lets you submit transactions to the L2 mempool, query UTxO and transaction history, inspect block data, and monitor node health — all without any API key or authentication for public endpoints. The testnet node is available at `https://rpc.testnet.sundialprotocol.com`.

## Base URL

```
https://rpc.testnet.sundialprotocol.com
```

All paths in this reference are relative to this base URL. There is no `/v1` or versioning prefix — endpoints are served at the root.

## API Style

The Sundial node API is RPC-style HTTP, not REST. Endpoints are named after operations rather than resources, and their HTTP methods (`GET` vs `POST`) reflect implementation details rather than strict REST semantics. Two notable examples:

* `GET /commit` and `GET /merge` are side-effecting even though they use `GET`.
* `POST /submit` accepts a raw hex string as its body, not a JSON object.

## Authentication

Public read and submission endpoints require no authentication. The `POST /faucet/claims` endpoint requires a static bearer token (`Authorization: Bearer <FAUCET_API_KEY>`) — this is a server-to-server endpoint and is not intended for direct end-user access.

<Note>
  No endpoint other than `POST /faucet/claims` performs authentication or rate-limiting at the application layer. On testnet there are no rate limits enforced on public endpoints. Do not expose the node directly to the public internet without an external proxy in production environments.
</Note>

## Request Format

Most endpoints accept a JSON body with `Content-Type: application/json`. The exception is `POST /submit`, which takes the raw hex-encoded CBOR transaction as a plain text body:

```http theme={null}
POST /submit
Content-Type: text/plain

<hex-encoded-transaction-cbor>
```

Query parameters are used for all `GET` endpoints.

## Response Format

All endpoints return JSON responses. The `POST /submit` success response carries a Redis stream entry ID, not a transaction hash — compute the hash client-side from the CBOR if you need it.

## Error Handling

Most unexpected failures return a generic `500` response:

```json theme={null}
{ "error": "Something went wrong" }
```

Validation errors return `400` with a descriptive message, and not-found conditions return `404`. The faucet endpoint returns structured error objects with a stable `code` field rather than generic messages — see the [Faucet API](/api/faucet) page for the full error code table.

## Endpoint Summary

The table below lists all 17 endpoints on the full (monolith) node. The **Router** column shows which deployments serve each endpoint: **full** means any node running `NODE_ROLE=all` (the default); **api** means it is also served by `NODE_ROLE=api` nodes used in horizontally scaled public deployments.

| Method | Path                                | Router    | Description                                                                |
| ------ | ----------------------------------- | --------- | -------------------------------------------------------------------------- |
| `GET`  | `/health/live`                      | full, api | Liveness probe — always returns `200` if the process is up                 |
| `GET`  | `/health/ready`                     | full, api | Readiness probe — checks database, Redis, and L1 provider                  |
| `GET`  | `/tx`                               | full      | Look up a single transaction CBOR by hash                                  |
| `GET`  | `/txs`                              | full      | Query paginated address transaction history                                |
| `GET`  | `/utxos`                            | full      | Query the current UTxO set for an address                                  |
| `GET`  | `/block`                            | full      | Query transaction hashes for a block by header hash                        |
| `POST` | `/submit`                           | full, api | Submit a raw CBOR transaction to the L2 queue                              |
| `POST` | `/faucet/claims`                    | full, api | Claim testnet ADA for a preprod address (bearer auth required)             |
| `GET`  | `/commit`                           | full, api | Manually trigger one block-commitment cycle (operator)                     |
| `GET`  | `/stateQueue`                       | full      | Fetch the state-queue linked list from L1                                  |
| `GET`  | `/stateQueue/root-unit-diagnostics` | full, api | Report health of the state-queue root unit                                 |
| `GET`  | `/stateQueue/repair-root-units`     | full      | Burn duplicate state-queue root units (operator)                           |
| `GET`  | `/commitment-wallet/balance`        | full, api | Return the operator commitment wallet lovelace balance                     |
| `GET`  | `/init`                             | full      | Mint the state-queue root unit and run genesis programs (operator)         |
| `GET`  | `/merge`                            | full      | Trigger merging the oldest confirmed block into confirmed state (operator) |
| `GET`  | `/reset`                            | full      | Reset demo chain/node state — **destructive** (operator)                   |
| `GET`  | `/logBlocksTxsDB`                   | full      | Log block-to-transaction counts to server logs (operator/debug)            |
| `GET`  | `/logGlobals`                       | full      | Log in-memory global state to server logs (operator/debug)                 |

<Note>
  `/init`, `/commit`, `/merge`, `/reset`, `/logBlocksTxsDB`, and `/logGlobals` are operator and debug endpoints. They mutate node or on-chain state and are not intended for general application use. `/reset` is destructive and not available on `api`-role nodes.
</Note>

## Quick Start

Run a liveness check to confirm the node is reachable:

```bash theme={null}
curl https://rpc.testnet.sundialprotocol.com/health/live
```

A healthy node responds immediately with:

```json theme={null}
{ "status": "ok" }
```

For a deeper readiness check — which validates the database, Redis, and the L1 provider connection — use the ready endpoint:

```bash theme={null}
curl https://rpc.testnet.sundialprotocol.com/health/ready
```

A fully ready node returns:

```json theme={null}
{ "status": "ready" }
```

If any dependency is unavailable, the response is `503` with a `failing` array identifying the affected subsystems.

## Explore the API

<CardGroup cols={2}>
  <Card title="Transactions" icon="arrow-right-arrow-left" href="/api/transactions">
    Submit transactions to the L2 mempool, look up individual transactions, and query address history.
  </Card>

  <Card title="UTxOs" icon="coins" href="/api/utxos">
    Fetch spendable unspent outputs for any address on the Sundial L2 ledger.
  </Card>

  <Card title="Blocks" icon="cube" href="/api/blocks">
    Query block data by header hash and inspect the state queue committed to L1.
  </Card>

  <Card title="Faucet API" icon="faucet" href="/api/faucet">
    Claim testnet ADA programmatically for automated testing and CI pipelines.
  </Card>
</CardGroup>
