API Reference Overview

Complete reference for all Nacho API methods

Nacho API provides access to Cardano blockchain data through Ogmios JSON-RPC methods.

Base URLs

Mainnet (Production)

ProtocolEndpoint
HTTP/HTTPShttps://api.nacho.builders/v1/ogmios
WebSocketwss://api.nacho.builders/v1/ogmios
Submit APIhttps://api.nacho.builders/v1/submit
GraphQLhttps://api.nacho.builders/v1/graphql

Preprod Testnet (Development)

ProtocolEndpoint
HTTP/HTTPShttps://api.nacho.builders/v1/preprod/ogmios
WebSocketwss://api.nacho.builders/v1/preprod/ogmios
Submit APIhttps://api.nacho.builders/v1/preprod/submit
GraphQLhttps://api.nacho.builders/v1/preprod/graphql

Your API key works on both networks. Switch between Mainnet and Preprod by changing the URL path from /v1/ogmios to /v1/preprod/ogmios.

Request Format

All requests use JSON-RPC 2.0:

{
  "jsonrpc": "2.0",
  "method": "methodName",
  "params": { },
  "id": "optional-id"
}

Available APIs

GraphQL API

Flexible queries for blockchain data using GraphQL. Best for complex queries with filtering and relationships.

FeatureDescription
GraphQL API OverviewQuery blocks, transactions, UTxOs, pools with flexible GraphQL

Ledger State Queries (Ogmios)

Query the current ledger state for blockchain data.

MethodDescription
queryLedgerState/epochCurrent epoch number
queryLedgerState/protocolParametersProtocol parameters
queryLedgerState/utxoUTxO set by address or reference
queryLedgerState/stakePoolsRegistered stake pools
queryLedgerState/tipCurrent ledger tip
queryLedgerState/eraStartCurrent era start info
queryLedgerState/eraSummariesEra bounds and slot parameters
queryLedgerState/liveStakeDistributionStake distribution
queryLedgerState/rewardAccountSummariesReward account info

Network Queries

Query network-level information (available even during sync).

MethodDescription
queryNetwork/blockHeightCurrent block height
queryNetwork/genesisConfigurationGenesis config by era
queryNetwork/startTimeChain start time
queryNetwork/tipNetwork tip

Transaction Methods

Submit and evaluate transactions.

MethodDescription
submitTransactionSubmit a signed transaction
evaluateTransactionEvaluate script execution costs

Chain Synchronization

Follow the chain in real-time (WebSocket only).

MethodDescription
findIntersectionFind chain intersection point
nextBlockGet next block or rollback

Chain synchronization requires a persistent WebSocket connection. See the Chain Synchronization Guide.

Response Format

Success Response

{
  "jsonrpc": "2.0",
  "method": "queryLedgerState/epoch",
  "result": 523,
  "id": "request-123"
}

Error Response

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "Method not found",
    "data": { "method": "invalidMethod" }
  },
  "id": "request-123"
}

Error Codes

CodeMeaning
-32700Parse error - Invalid JSON
-32600Invalid request - Missing required fields
-32601Method not found
-32602Invalid params
-32603Internal error
3000-3999Transaction submission errors

HTTP vs WebSocket

FeatureHTTPWebSocket
One-off queriesYesYes
Chain syncNoYes
Connection overheadPer requestOnce
PipeliningNoYes

Use HTTP for:

  • Simple queries
  • Serverless functions
  • One-off requests

Use WebSocket for:

  • Chain synchronization
  • High-frequency queries
  • Real-time applications

Full Ogmios API Specification

Was this page helpful?