Skip to main content

Quickstart Guide

Get up and running with NOCY APIs in just a few minutes.

Prerequisites

  • Basic knowledge of REST APIs
  • A tool for making HTTP requests (cURL, Postman, or your preferred language)

Step 1: Check API Health

First, verify the APIs are accessible:

# Get NOCY API
curl https://api.get.nocy.io/health

# Explorer API
curl https://api.explorer.nocy.io/health

Both should return a healthy status:

{
"status": "ok",
"timestamp": "2024-12-13T12:00:00.000Z"
}

Step 2: Get Current NOCY Price

Fetch the current token price:

curl https://api.get.nocy.io/api/price

Response:

{
"priceInAda": 0.001
}

Step 3: Query the Explorer

Search for a block, transaction, or address:

curl "https://api.explorer.nocy.io/api/search?q=1000"

Get the latest blocks:

curl "https://api.explorer.nocy.io/api/blocks?limit=5"

Step 4: Subscribe to Live Data

Connect to real-time block updates using Server-Sent Events:

const eventSource = new EventSource('https://api.explorer.nocy.io/live/blocks');

eventSource.addEventListener('block', (event) => {
const block = JSON.parse(event.data);
console.log('New block:', block.height);
});

eventSource.onerror = (error) => {
console.error('Connection error:', error);
};

Quick Reference

Get NOCY API Endpoints

EndpointMethodDescription
/healthGETHealth check
/api/priceGETCurrent NOCY price
/api/supplyGETToken supply info
/api/payment-addressGETADA payment address
/api/statsGETSales statistics
/api/orderPOSTCreate purchase order
/api/order/:idGETGet order by ID

Explorer API Endpoints

EndpointMethodDescription
/healthGETHealth check
/api/searchGETUnified search
/api/blocksGETList blocks
/api/blocks/:idGETGet block details
/api/transactionsGETList transactions
/api/tx/:idGETGet transaction
/api/contract-actionsGETList contract actions

SSE Live Endpoints

EndpointEvent TypeDescription
/live/blocksblockNew blocks
/live/contract-actionscontractActionContract events
/live/zswap-ledger-eventszswapLedgerEventZSwap events

Code Examples

JavaScript/TypeScript

// Fetch NOCY price
async function getNocyPrice(): Promise<number> {
const response = await fetch('https://api.get.nocy.io/api/price');
const data = await response.json();
return data.priceInAda;
}

// Get latest blocks
async function getLatestBlocks(limit = 10) {
const response = await fetch(
`https://api.explorer.nocy.io/api/blocks?limit=${limit}`
);
return response.json();
}

Python

import requests

# Fetch NOCY price
def get_nocy_price():
response = requests.get('https://api.get.nocy.io/api/price')
return response.json()['priceInAda']

# Get latest blocks
def get_latest_blocks(limit=10):
response = requests.get(
f'https://api.explorer.nocy.io/api/blocks?limit={limit}'
)
return response.json()

Next Steps