- Development:
http://localhost:3000/api - Production:
https://snapshots.bryanlabs.net/api
- System Endpoints
- Public API v1
- NextAuth Endpoints
- Account Management
- Admin Endpoints
- Error Responses
Check the health status of the application and its services.
Response:
{
"success": true,
"data": {
"status": "healthy",
"timestamp": "2025-07-22T10:00:00Z",
"services": {
"database": true,
"nginx": true,
"redis": true
},
"version": "1.5.0"
}
}Prometheus-compatible metrics endpoint.
Response: Plain text Prometheus metrics format
# HELP http_requests_total Total HTTP requests
# TYPE http_requests_total counter
http_requests_total{method="GET",path="/api/v1/chains"} 1234
Get current bandwidth usage statistics.
Response:
{
"success": true,
"data": {
"free": {
"current": 25.5,
"total": 50,
"connections": 3
},
"premium": {
"current": 125.0,
"total": 250,
"connections": 2
}
}
}Reset daily bandwidth limits (requires cron secret).
Headers:
X-Cron-Secret: your-cron-secret
Response:
{
"success": true,
"message": "Bandwidth limits reset successfully"
}Legacy JWT authentication for API compatibility.
Request Body:
{
"username": "premium_user",
"password": "password123"
}Response:
{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"username": "premium_user",
"tier": "premium"
}
}
}End the current session (JWT invalidation).
Headers:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Response:
{
"success": true,
"message": "Logged out successfully"
}Get current user info from JWT token.
Headers:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Response:
{
"success": true,
"data": {
"username": "premium_user",
"tier": "premium"
}
}Refresh JWT token.
Headers:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Response:
{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}Authenticate with Cosmos wallet signature.
Request Body:
{
"address": "cosmos1...",
"pubkey": "...",
"signature": "...",
"message": "Sign this message to authenticate with Snapshots Service"
}Response:
{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"address": "cosmos1...",
"tier": "free"
}
}
}Get a list of all chains with available snapshots.
Query Parameters:
includeEmpty(boolean): Include chains without snapshots
Response:
{
"success": true,
"data": [
{
"id": "noble-1",
"name": "Noble",
"description": "Native asset issuance chain for the Cosmos ecosystem",
"logoUrl": "/chains/noble.png",
"snapshotCount": 14,
"latestSnapshot": {
"height": 20250722,
"size": 7069740384,
"lastModified": "2025-07-22T18:03:00Z",
"compressionType": "lz4"
},
"totalSize": 98765432100
}
]
}Get details for a specific chain.
Response:
{
"success": true,
"data": {
"id": "noble-1",
"name": "Noble",
"description": "Native asset issuance chain for the Cosmos ecosystem",
"logoUrl": "/chains/noble.png",
"snapshotCount": 14,
"latestSnapshot": {
"height": 20250722,
"size": 7069740384,
"lastModified": "2025-07-22T18:03:00Z",
"compressionType": "lz4"
}
}
}Get available snapshots for a specific chain.
Query Parameters:
type(string): Filter by type (pruned, archive)compression(string): Filter by compression (zst, lz4)limit(number): Maximum results to returnoffset(number): Pagination offset
Response:
{
"success": true,
"data": [
{
"id": "noble-1-snapshot-1",
"chainId": "noble-1",
"height": 20250722,
"size": 7069740384,
"fileName": "noble-1-20250722-175949.tar.lz4",
"createdAt": "2025-07-22T17:59:49Z",
"updatedAt": "2025-07-22T18:03:00Z",
"type": "pruned",
"compressionType": "lz4"
},
{
"id": "noble-1-snapshot-2",
"chainId": "noble-1",
"height": 20250722,
"size": 4929377924,
"fileName": "noble-1-20250722-174634.tar.zst",
"createdAt": "2025-07-22T17:46:34Z",
"updatedAt": "2025-07-22T17:47:00Z",
"type": "pruned",
"compressionType": "zst"
}
]
}Get the latest snapshot for a chain.
Response:
{
"success": true,
"data": {
"id": "noble-1-latest",
"chainId": "noble-1",
"height": 20250722,
"size": 7069740384,
"fileName": "noble-1-20250722-175949.tar.lz4",
"createdAt": "2025-07-22T17:59:49Z",
"type": "pruned",
"compressionType": "lz4"
}
}Get metadata and statistics for a specific chain.
Response:
{
"success": true,
"data": {
"chainId": "noble-1",
"name": "Noble",
"latestHeight": 20250722,
"snapshotSchedule": "Every 3 hours",
"averageSize": 5899559154,
"compressionRatio": {
"zst": 0.45,
"lz4": 0.64
},
"totalSnapshots": 14,
"oldestSnapshot": "2025-07-20T18:09:38Z"
}
}Generate a secure download URL for a snapshot.
Request Body:
{
"filename": "noble-1-20250722-175949.tar.lz4"
}Response:
{
"success": true,
"data": {
"url": "https://snapshots.bryanlabs.net/snapshots/noble-1/noble-1-20250722-175949.tar.lz4?md5=abc123&expires=1234567890&tier=free",
"expires": "2025-07-22T19:00:00Z",
"size": 7069740384,
"tier": "free"
}
}Get download status for current user.
Headers:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Response:
{
"success": true,
"data": {
"dailyLimit": 10,
"downloadsToday": 3,
"remainingDownloads": 7,
"resetTime": "2025-07-23T00:00:00Z"
}
}Proxy download with authentication and tracking.
Request Body:
{
"url": "https://snapshots.bryanlabs.net/snapshots/..."
}Response: Binary stream of file content
List available authentication providers.
Response:
{
"credentials": {
"id": "credentials",
"name": "Email and Password",
"type": "credentials"
},
"keplr": {
"id": "keplr",
"name": "Keplr Wallet",
"type": "oauth"
}
}Get CSRF token for authentication.
Response:
{
"csrfToken": "abc123..."
}Sign in with email and password.
Request Body:
{
"email": "[email protected]",
"password": "snapshot123",
"csrfToken": "abc123..."
}Response: Redirect to callback URL or error page
Get current NextAuth session.
Response:
{
"user": {
"id": "1",
"email": "[email protected]",
"name": "Test User",
"image": "/avatars/1.png"
},
"expires": "2025-07-29T10:00:00Z"
}Sign out and clear session.
Request Body:
{
"csrfToken": "abc123..."
}Response: Redirect to home page
Register a new account.
Request Body:
{
"email": "[email protected]",
"password": "securepassword123",
"name": "New User"
}Response:
{
"success": true,
"message": "Account created successfully"
}Get user avatar image.
Response: Binary image data (PNG/JPEG)
Link email to wallet account.
Request Body:
{
"email": "[email protected]",
"verificationCode": "123456"
}Response:
{
"success": true,
"message": "Email linked successfully"
}Delete user account and all data.
Response:
{
"success": true,
"message": "Account deleted successfully"
}Get system statistics (requires admin role).
Response:
{
"success": true,
"data": {
"users": {
"total": 1234,
"premium": 56,
"active24h": 234
},
"downloads": {
"total": 45678,
"today": 234,
"bandwidth": "2.5 TB"
},
"storage": {
"used": "45 TB",
"available": "155 TB",
"chains": 8
}
}
}Get download analytics (requires admin role).
Query Parameters:
startDate(string): ISO date stringendDate(string): ISO date stringchainId(string): Filter by chaintier(string): Filter by tier (free/premium)
Response:
{
"success": true,
"data": {
"downloads": [
{
"id": "1",
"userId": "123",
"chainId": "noble-1",
"filename": "noble-1-20250722-175949.tar.lz4",
"size": 7069740384,
"tier": "premium",
"downloadedAt": "2025-07-22T18:15:00Z",
"duration": 120,
"completed": true
}
],
"summary": {
"totalDownloads": 234,
"totalBandwidth": "2.5 TB",
"averageSpeed": "125 Mbps"
}
}
}All error responses follow this format:
{
"success": false,
"error": "Error type",
"message": "Detailed error message"
}200: Success400: Bad Request - Invalid input or parameters401: Unauthorized - Authentication required403: Forbidden - Insufficient permissions404: Not Found - Resource not found429: Too Many Requests - Rate limit exceeded500: Internal Server Error - Server error503: Service Unavailable - Service temporarily down
400 Bad Request:
{
"success": false,
"error": "Validation Error",
"message": "Invalid email format"
}401 Unauthorized:
{
"success": false,
"error": "Unauthorized",
"message": "Please sign in to access this resource"
}404 Not Found:
{
"success": false,
"error": "Not Found",
"message": "Chain 'invalid-chain' not found"
}429 Rate Limited:
{
"success": false,
"error": "Rate Limit Exceeded",
"message": "Too many requests. Please try again in 60 seconds"
}500 Server Error:
{
"success": false,
"error": "Internal Server Error",
"message": "An unexpected error occurred. Please try again later"
}