- Home
- API Documentation
Pinbar AI API Documentation
Integrate your historical trade data with your own tools, dashboards, and workflows. Our RESTful API provides read-only programmatic access to trades, analytics, and real-time webhooks.
$ curl -X GET https://api.pinbar.ai/v1/v1-trades \
-H "Authorization: Bearer YOUR_API_KEY"
{
"trades": [
{
"id": "tr_abc123",
"symbol": "NIFTY24JAN21000CE",
"pnl": 1237.50,
"emotion_tag": "confident"
}
],
"total": 156,
"page": 1
}API Access Scope
The Pinbar AI API provides read-only access to historical trades, analytics, psychology metrics, and derived insights.
The API cannot:
- Place, modify, or cancel trades
- Access funds or balances
- Execute broker actions
- Provide trading signals or recommendations
Real-time
Webhooks for instant trade notifications
Secure
OAuth 2.0 & API key authentication
RESTful
Standard REST architecture
Documented
Comprehensive docs & examples
Quick Start
Security Notice
All API keys shown in examples are placeholders. Never expose real API keys in client-side code, public repositories, or frontend applications. API keys must be stored securely on the server.
Authentication
All API requests require authentication using a Bearer token. You can generate API keys from your dashboard settings.
Important: API keys must be stored securely on the server. Do not embed API keys in frontend or client-side applications.
// Authentication using API Key
const headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
};
// Base URL: Your project's edge function endpoint
const response = await fetch('https://api.pinbar.ai/functions/v1/export-trades', {
method: 'GET',
headers: headers
});Fetch Your Trades
Retrieve your trade history with optional date range and symbol filters.
// Fetch trades with date filtering
const response = await fetch(
'https://api.pinbar.ai/functions/v1/export-trades?from=2024-01-01&to=2024-01-31&format=json',
{
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN'
}
}
);
const data = await response.json();
console.log(data.trades);Get Analytics
Access aggregated performance metrics including win rate, P&L, and strategy analysis.
// Export trades as CSV
const response = await fetch(
'https://api.pinbar.ai/functions/v1/export-trades?format=csv&status=closed',
{
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_JWT_TOKEN'
}
}
);
const csvData = await response.text();
// Save or process CSV dataAPI Endpoints
/functions/v1/export-tradesExport trades with filtering (JSON or CSV)
/functions/v1/firm-trade-ingestionIngest trades via webhook (Enterprise)
/functions/v1/firm-token-exchangeExchange firm JWT for Pinbar session (SSO)
/functions/v1/firm-webhook-dispatchDispatch webhook events to firm endpoints
/functions/v1/health-monitorSystem health check (admin only)
Real-time Webhooks
Get instant notifications when trades are completed, positions change, or analytics are updated.
Supported Events
- trade.completedWhen a trade is fully closed
- trade.openedWhen a new position is opened
- position.updatedWhen position P&L changes
- alert.triggeredWhen behavior alert fires
Webhook Reliability & Security
- • Webhooks are retried up to 3 times on delivery failure using exponential backoff
- • Each webhook payload includes a signature header for verification
- • Consumers must implement idempotency handling to avoid duplicate processing
// Webhook payload example
{
"event": "trade.completed",
"timestamp": "2024-01-15T10:30:00Z",
"signature": "sha256=REDACTED_SIGNATURE_EXAMPLE",
"data": {
"trade_id": "tr_abc123",
"symbol": "NIFTY24JAN21000CE",
"side": "BUY",
"quantity": 50,
"entry_price": 150.50,
"exit_price": 175.25,
"pnl": 1237.50,
"emotion_tag": "confident",
"behaviour_tag": "disciplined"
}
}Rate Limits
Rate limits are enforced for system stability and fair usage. Limits may change based on plan, usage patterns, or system load.
| Plan | Requests/min |
|---|---|
| Standard | 60 |
| Pro | 300 |
| Enterprise | Custom |
Security
TLS 1.3 Encryption
All API traffic is encrypted in transit
API Key Rotation
Rotate keys without downtime
IP Whitelisting
Restrict access by IP (Enterprise)
Who This API Is For
Intended for
- • Enterprises and institutions
- • Advanced users building internal dashboards
- • Analytics, reporting, and compliance workflows
Not intended for
- • Automated trading systems
- • Signal generation
- • Retail trading bots
- • Strategy execution engines
Non-Advisory Use
All analytics, psychology metrics, behavior tags, and insights exposed via the Pinbar AI API are observational and informational only.
They do not constitute trading advice, investment recommendations, or financial guidance.
The API is intended for self-analysis, reporting, and internal dashboards only.
Ready to Integrate?
Pinbar AI API access is available for Enterprise customers. Contact our team to discuss your integration needs.