Overview
The OpsHub NAV API provides programmatic access to all platform functionality. The API is organized into several categories:
Agent API
Real-time AI agent communication via WebSocket
Data API
Portfolio, holdings, and transaction management
Validation API
ASIC RG94 validation rules and breach reporting
Workflow API
Temporal Cloud workflow orchestration
Base URL
https://api.opshub.nomark.ai/v1
All API requests must use HTTPS. HTTP requests will be redirected to HTTPS.
Authentication
OpsHub uses JWT-based authentication via Supabase Auth.
Getting an API Key
Navigate to Settings
Go to Settings > API Keys
Generate New Key
Click Generate API Key and copy the key
Store Securely
Store your API key securely - it will only be shown once
Authentication Methods
Bearer Token
Service Role
Supabase Client
Include your API key in the Authorization header:curl https://api.opshub.nomark.ai/v1/portfolios \
-H "Authorization: Bearer YOUR_API_KEY"
For server-to-server communication, use the service role key:curl https://api.opshub.nomark.ai/v1/portfolios \
-H "Authorization: Bearer YOUR_SERVICE_ROLE_KEY" \
-H "apikey: YOUR_SERVICE_ROLE_KEY"
Use the Supabase JavaScript client:import { createClient } from '@supabase/supabase-js';
const supabase = createClient(
'https://iyvxidsarqofryyriwix.supabase.co',
'YOUR_API_KEY'
);
// Auto-handles authentication
const { data, error } = await supabase
.from('investment.portfolios')
.select('*');
Never expose your API key or service role key in client-side code. Use environment variables and backend proxies.
Rate Limiting
API requests are rate-limited to ensure fair usage:
| Tier | Requests/Minute | Requests/Hour | Requests/Day |
|---|
| Free | 60 | 1,000 | 10,000 |
| Pro | 300 | 10,000 | 100,000 |
| Enterprise | Unlimited | Unlimited | Unlimited |
Rate limit headers are included in all responses:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1640995200
All API responses use JSON format with consistent structure:
Success Response
{
"data": {
// Response data
},
"meta": {
"timestamp": "2024-01-15T12:00:00Z",
"request_id": "req_abc123"
}
}
Error Response
{
"error": {
"code": "INVALID_REQUEST",
"message": "Portfolio ID is required",
"details": {
"field": "portfolio_id",
"reason": "missing_required_field"
}
},
"meta": {
"timestamp": "2024-01-15T12:00:00Z",
"request_id": "req_abc123"
}
}
Error Codes
| Code | HTTP Status | Description |
|---|
INVALID_REQUEST | 400 | Request parameters are invalid |
UNAUTHORIZED | 401 | Authentication credentials are missing or invalid |
FORBIDDEN | 403 | You don’t have permission to access this resource |
NOT_FOUND | 404 | The requested resource doesn’t exist |
CONFLICT | 409 | Request conflicts with existing resource |
VALIDATION_ERROR | 422 | Validation failed for one or more fields |
RATE_LIMIT_EXCEEDED | 429 | Too many requests, please slow down |
INTERNAL_ERROR | 500 | An internal server error occurred |
SERVICE_UNAVAILABLE | 503 | Service is temporarily unavailable |
List endpoints support cursor-based pagination:
GET /v1/portfolios?limit=20&cursor=eyJpZCI6IjEyMyJ9
Parameters:
limit - Number of items per page (default: 20, max: 100)
cursor - Cursor from previous response for next page
Response:
{
"data": [...],
"meta": {
"next_cursor": "eyJpZCI6IjE0MyJ9",
"has_more": true
}
}
Filtering & Sorting
Use query parameters to filter and sort results:
# Filter portfolios by type
GET /v1/portfolios?portfolio_type=EQUITY
# Sort by creation date
GET /v1/portfolios?sort=created_at:desc
# Multiple filters
GET /v1/portfolios?portfolio_type=EQUITY&status=ACTIVE&sort=name:asc
Supported operators:
eq - Equal to (default)
neq - Not equal to
gt - Greater than
gte - Greater than or equal
lt - Less than
lte - Less than or equal
like - Pattern match
in - Value in list
Example with operators:
GET /v1/holdings?market_value=gte:1000000&position_date=eq:2024-01-15
Webhooks
Subscribe to real-time events via webhooks:
Create Webhook Endpoint
Go to Settings > Webhooks and create a new endpoint
Choose Events
Select which events to receive:
portfolio.created
portfolio.updated
validation.breach_detected
workflow.completed
nav.calculated
Verify Endpoint
OpsHub will send a verification request to your endpoint
Handle Events
Process webhook events in your application
Webhook payload:
{
"event": "validation.breach_detected",
"data": {
"validation_id": "val_123",
"portfolio_id": "port_456",
"breach_type": "NAV_VARIANCE",
"severity": "HIGH"
},
"timestamp": "2024-01-15T12:00:00Z",
"signature": "sha256=..."
}
Verify webhook signatures using the X-OpsHub-Signature header to ensure requests are from OpsHub.
SDK Libraries
Official SDK libraries for popular languages:
npm install @opshub/sdk
import { OpsHub } from '@opshub/sdk';
const client = new OpsHub({
apiKey: process.env.OPSHUB_API_KEY
});
const portfolios = await client.portfolios.list();
API Versioning
The API uses URL-based versioning:
https://api.opshub.nomark.ai/v1/...
Current version: v1
We maintain backward compatibility within major versions. Breaking changes will result in a new major version (v2, v3, etc.).
Support
Need help with the API?
API Status
Check real-time API status and uptime
Support
Contact our API support team
Community
Join our developer community
Changelog
View API changelog and updates