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
| Endpoint | Method | Description |
|---|---|---|
/health | GET | Health check |
/api/price | GET | Current NOCY price |
/api/supply | GET | Token supply info |
/api/payment-address | GET | ADA payment address |
/api/stats | GET | Sales statistics |
/api/order | POST | Create purchase order |
/api/order/:id | GET | Get order by ID |
Explorer API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/health | GET | Health check |
/api/search | GET | Unified search |
/api/blocks | GET | List blocks |
/api/blocks/:id | GET | Get block details |
/api/transactions | GET | List transactions |
/api/tx/:id | GET | Get transaction |
/api/contract-actions | GET | List contract actions |
SSE Live Endpoints
| Endpoint | Event Type | Description |
|---|---|---|
/live/blocks | block | New blocks |
/live/contract-actions | contractAction | Contract events |
/live/zswap-ledger-events | zswapLedgerEvent | ZSwap 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
- Get NOCY API Reference - Full API documentation
- Explorer API Reference - Explorer endpoints
- Token Purchase Guide - Complete purchase integration
- Live Streaming Guide - SSE integration