DataStream FYI API Reference
A comprehensive REST API for managing financial data streams, calendar periods, and accounting records. Built with modern .NET 9 architecture for enterprise-scale operations.
Real-time Data
Access live financial data with millisecond precision timestamps
Enterprise Security
API Key and Tenant-based authentication with granular permission controls
Scalable Architecture
Built on .NET 9 with horizontal scaling capabilities and query optimization
Authentication
DataStream FYI uses API Key authentication with tenant identification for secure API access. All requests must include valid API credentials.
Interactive Authentication Tester
Test Your API Credentials
Verify your API key and tenant ID to see your authentication context and permissions.
Required Headers
x-api-key: YOUR_API_KEY
x-api-tenantid: YOUR_TENANT_ID
curl -X GET "https://localhost:7092/api/test/auth" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-api-tenantid: YOUR_TENANT_ID" \
-H "Accept: application/json"
// Test authentication in JavaScript
const response = await fetch('https://localhost:7092/api/test/auth', {
method: 'GET',
headers: {
'Accept': 'application/json',
'x-api-key': 'YOUR_API_KEY',
'x-api-tenantid': 'YOUR_TENANT_ID'
}
});
const authContext = await response.json();
console.log('Authentication context:', authContext);
Security Schemes
API Key
API Key used for authenticating requests. Provide the key value in the x-api-key
header. In development mode, this can be omitted and will default to a test key.
sk_
followed by alphanumeric characters (minimum 16 characters total)
Tenant ID
Tenant identifier required for multitenancy. Provide the tenant ID in the x-api-tenantid
header. The tenant affects your subscription tier and available features.
Tenant Tiers & Features
Basic Tier
Default tier for most tenants
- 10,000 API calls/hour
- Standard performance
- Basic features: api_access, reporting
Pro Tier
Enhanced tier (tenant contains "pro")
- 50,000 API calls/hour
- Advanced analytics & bulk export
- Priority support
Enterprise Tier
Premium tier (tenant contains "enterprise")
- 100,000 API calls/hour
- SSO & audit logs
- Premium performance & caching
- Administrator permissions
Rate Limits
API requests are subject to rate limiting to ensure fair usage and optimal performance for all users.
Rate limit details will be provided in response headers and documented here as they are established.
Error Handling
The API uses conventional HTTP response codes to indicate the success or failure of an API request.
HTTP Status Codes
200
- OK: Request successful
400
- Bad Request: Invalid request parameters
401
- Unauthorized: Invalid API credentials
403
- Forbidden: Insufficient permissions
404
- Not Found: Resource not found
500
- Internal Server Error: Server error occurred
Code Examples
Ready-to-use code examples for integrating with the DataStream FYI API in various programming languages.
JavaScript / Node.js
Modern async/await syntax with proper error handling
// Basic API request to DataStream FYI
const response = await fetch('https://localhost:7092/api/calendar-periods', {
method: 'GET',
headers: {
'Accept': 'application/json',
'x-api-key': 'YOUR_API_KEY',
'x-api-tenantid': 'YOUR_TENANT_ID'
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log('Calendar Periods:', data);
// Advanced request with query parameters
const queryParams = new URLSearchParams({
'PageSize': '10',
'PageNumber': '1',
'Sort': 'PeriodName',
'Filter': 'IsActive eq true'
});
const response = await fetch(`https://localhost:7092/api/calendar-periods?${queryParams.toString()}`, {
method: 'GET',
headers: {
'Accept': 'application/json',
'x-api-key': 'YOUR_API_KEY',
'x-api-tenantid': 'YOUR_TENANT_ID'
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log(`Retrieved ${data.data.length} calendar periods`);
Python
Using the popular requests library with proper exception handling
# Basic API request to DataStream FYI
import requests
import json
url = 'https://localhost:7092/api/calendar-periods'
headers = {
'Accept': 'application/json',
'x-api-key': 'YOUR_API_KEY',
'x-api-tenantid': 'YOUR_TENANT_ID'
}
try:
response = requests.get(url, headers=headers)
response.raise_for_status() # Raises an HTTPError for bad responses
result = response.json()
print(f"Retrieved {len(result['data'])} calendar periods")
print(json.dumps(result, indent=2))
except requests.exceptions.RequestException as e:
print(f"Error making request: {e}")
# DataStream FYI API Client Class
import requests
import json
from typing import Dict, Optional, Any
class DataStreamApiClient:
def __init__(self, api_key: str, tenant_id: str, base_url: str = 'https://localhost:7092'):
self.base_url = base_url.rstrip('/')
self.session = requests.Session()
self.session.headers.update({
'Accept': 'application/json',
'x-api-key': api_key,
'x-api-tenantid': tenant_id
})
def get_calendar_periods(self, page_size: int = 10, page_number: int = 1) -> Dict[str, Any]:
"""Retrieve calendar periods with pagination"""
params = {
'PageSize': page_size,
'PageNumber': page_number
}
try:
response = self.session.get(f'{self.base_url}/api/calendar-periods', params=params)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
raise Exception(f"Failed to retrieve calendar periods: {e}")
# Usage
client = DataStreamApiClient('YOUR_API_KEY', 'YOUR_TENANT_ID')
periods = client.get_calendar_periods(page_size=20)
print(f"Found {periods['totalCount']} total periods")
C# / .NET
Using HttpClient with async/await and proper disposal patterns
// Basic DataStream FYI API client
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
public class DataStreamApiClient : IDisposable
{
private readonly HttpClient _httpClient;
private const string BaseUrl = "https://localhost:7092";
public DataStreamApiClient(string apiKey, string tenantId)
{
_httpClient = new HttpClient();
_httpClient.DefaultRequestHeaders.Add("x-api-key", apiKey);
_httpClient.DefaultRequestHeaders.Add("x-api-tenantid", tenantId);
_httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
}
public async Task GetCalendarPeriodsAsync(int pageSize = 10, int pageNumber = 1)
{
try
{
var url = $"{BaseUrl}/api/calendar-periods?PageSize={pageSize}&PageNumber={pageNumber}";
var response = await _httpClient.GetAsync(url);
response.EnsureSuccessStatusCode();
var jsonContent = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject(jsonContent);
}
catch (HttpRequestException ex)
{
throw new Exception($"Error calling API: {ex.Message}", ex);
}
}
public void Dispose()
{
_httpClient?.Dispose();
}
}
// Usage
using var client = new DataStreamApiClient("YOUR_API_KEY", "YOUR_TENANT_ID");
var periods = await client.GetCalendarPeriodsAsync(pageSize: 20);
Console.WriteLine($"Retrieved calendar periods: {periods}");
// Strongly-typed DataStream FYI API client
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
public class CalendarPeriod
{
public string PeriodId { get; set; }
public string PeriodName { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public bool IsActive { get; set; }
}
public class ApiResponse
{
public List Data { get; set; }
public int TotalCount { get; set; }
public int PageSize { get; set; }
public int PageNumber { get; set; }
}
public class TypedDataStreamApiClient : IDisposable
{
private readonly HttpClient _httpClient;
private const string BaseUrl = "https://localhost:7092";
public TypedDataStreamApiClient(string apiKey, string tenantId)
{
_httpClient = new HttpClient();
_httpClient.DefaultRequestHeaders.Add("x-api-key", apiKey);
_httpClient.DefaultRequestHeaders.Add("x-api-tenantid", tenantId);
_httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
}
public async Task> GetCalendarPeriodsAsync(int pageSize = 10, int pageNumber = 1)
{
try
{
var url = $"{BaseUrl}/api/calendar-periods?PageSize={pageSize}&PageNumber={pageNumber}";
var response = await _httpClient.GetAsync(url);
response.EnsureSuccessStatusCode();
var jsonContent = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject>(jsonContent);
}
catch (HttpRequestException ex)
{
throw new Exception($"Error calling API: {ex.Message}", ex);
}
}
public void Dispose()
{
_httpClient?.Dispose();
}
}
// Usage
using var client = new TypedDataStreamApiClient("YOUR_API_KEY", "YOUR_TENANT_ID");
var response = await client.GetCalendarPeriodsAsync(pageSize: 20);
Console.WriteLine($"Found {response.TotalCount} total periods, showing {response.Data.Count}");
Integration Tips
Authentication
Always include both x-api-key
and x-api-tenantid
headers in every request. These are required for proper authentication and tenant isolation.
Error Handling
Implement robust error handling for HTTP status codes. Check for 401 (unauthorized), 403 (forbidden), and 429 (rate limited) responses.
Pagination
Use PageSize
and PageNumber
parameters for large datasets. The API returns totalCount
to help with pagination logic.
Filtering & Sorting
Use OData-style filtering with the Filter
parameter and sorting with Sort
parameter for efficient data retrieval.
Postman Collection
Download a pre-configured Postman collection with all DataStream FYI API endpoints, authentication headers, and example requests ready for immediate testing.
What's Included
All API Endpoints
Complete collection of all 13 API endpoints from the current swagger definition
Pre-configured Authentication
Headers for x-api-key
and x-api-tenantid
with placeholder variables
Environment Variables
Configurable base URL and authentication variables for easy environment switching
Example Requests
Sample request bodies and parameter values for quick testing
Download Postman Collection
Import this collection into Postman to start testing the DataStream FYI API immediately.
Setup Instructions
Download Collection
Click the download button above to get the Postman collection JSON file
Import to Postman
Open Postman → Import → Upload the downloaded JSON file
Configure Environment
Set your API key and tenant ID in the environment variables
Start Testing
All endpoints are ready to use with pre-configured authentication
Environment Configuration
Configure these variables in your Postman environment:
{
"baseUrl": "https://localhost:7092",
"apiKey": "your-api-key-here",
"tenantId": "your-tenant-id-here"
}
{
"baseUrl": "https://localhost:7092",
"apiKey": "test-api-key-12345",
"tenantId": "demo-tenant-001"
}
Developer Support
Get help with DataStream FYI API integration, troubleshooting, and best practices.
Interactive Documentation
Comprehensive API explorer with live examples generated from current API definitions
Try API Explorer →GitHub Repository
View source code, examples, and contribute to the DataStream FYI API
View on GitHub →