Standard HTTP Headers
All Finhub API requests require specific HTTP headers for authentication, tenant identification, compliance tracking, and proper request handling.Required Headers
Authorization
Type:stringRequired: Yes (except for public endpoints)
Format:
Bearer <JWT_TOKEN>
Bearer token for API authentication. Obtained from the session creation endpoint after successful login.
Example:
- All authenticated API operations
- Customer operations (registration, verification, consents)
- Financial operations (transfers, beneficiaries, payment consents)
- Administrative operations
X-Tenant-ID
Type:stringRequired: Yes (all endpoints)
Format: Alphanumeric tenant identifier Identifies the tenant context for multi-tenant operations. Must match the tenant associated with the authenticated user or admin token. Example:
- Must be a valid, active tenant identifier
- Must match the tenant context of the authenticated user
- Case-sensitive
X-Forwarded-For
Type:stringRequired: Yes (for compliance operations)
Format: IPv4 or IPv6 address Client’s originating IP address. Critical for regulatory compliance (AML/KYC), fraud detection, and audit trails. Examples:
- Customer registration (individual and organization)
- Session creation (login)
- Consent acceptance
- Account activation
- Transaction execution
- Document submission
- Captured and stored permanently for regulatory audits
- Used for geolocation-based compliance checks
- Required for GDPR, AML, and KYC regulations
- Cannot be modified after capture
- If using a proxy/load balancer, forward the original client IP
- For direct connections, use the client’s actual IP address
- For mobile apps, use device’s current IP address
- For server-to-server calls, use the originating server’s IP
User-Agent
Type:stringRequired: Yes (for compliance operations)
Format: Standard User-Agent string Client application identifier including browser, mobile app, or SDK version. Used for security analysis, device fingerprinting, and compliance reporting. Examples:
- Browser: Use standard browser User-Agent
- Mobile Apps:
{AppName}/{Version} ({OS} {OSVersion}; {DeviceModel}) - SDKs:
finhub-sdk-{language}/{version} {runtime}/{runtime_version}
- Customer registration
- Session creation
- Consent acceptance
- Transaction operations
- Document uploads
- Used for device fingerprinting and fraud detection
- Helps identify suspicious access patterns
- Required for security audit trails
- Analyzed for bot detection and abuse prevention
Content-Type
Type:stringRequired: Yes (for requests with body)
Format: MIME type Specifies the media type of the request body. Common Values:
application/json for all API endpoints unless otherwise specified.
Optional Headers
Accept
Type:stringRequired: No
Default:
application/jsonFormat: MIME type Specifies the desired response format. Example:
X-Idempotency-Key
Type:stringRequired: No (recommended for financial operations)
Format: UUID v4 Unique identifier for idempotent request handling. Prevents duplicate transaction processing. Example:
- Payment transfers
- Beneficiary creation
- Payment consent creation
- Any operation that modifies financial state
- If a request with the same idempotency key is received within 24 hours, the original response is returned
- Prevents accidental duplicate transactions due to network issues or retries
- Key expires after 24 hours
X-Request-ID
Type:stringRequired: No
Format: UUID v4 Unique request identifier for tracing and debugging. Automatically generated if not provided. Example:
- Request tracing across microservices
- Debugging and troubleshooting
- Support ticket correlation
SDK Implementation Examples
JavaScript/TypeScript
Python
Java
Error Scenarios
Missing Required Header
Request:Invalid Authorization Token
Request:Tenant Mismatch
Request:Security Best Practices
Token Management
IP Address Handling
- Always forward the original client IP, not proxy/CDN IP
- Validate IP address format before sending
- Be aware of IPv4 vs IPv6 differences
- Document IP handling in privacy policy
User-Agent Best Practices
- Use descriptive User-Agent strings with version information
- Update User-Agent when releasing new app versions
- Include SDK version for better support diagnostics
- Avoid spoofing or randomizing User-Agent (triggers fraud detection)
Compliance & Audit
Data Captured
For each API request with compliance headers, the system captures:| Field | Source | Purpose | Retention |
|---|---|---|---|
| IP Address | X-Forwarded-For | Geolocation, fraud detection, AML | 7 years |
| User Agent | User-Agent | Device fingerprinting, security | 7 years |
| Timestamp | System | Audit trail, compliance reporting | 7 years |
| Request ID | X-Request-ID or auto-generated | Tracing, debugging | 90 days |
| Tenant ID | X-Tenant-ID | Multi-tenant isolation | Permanent |
| User ID | JWT claims | User attribution | Permanent |
Regulatory Compliance
The captured headers support compliance with:- GDPR (General Data Protection Regulation): Right to audit, data processing records
- PSD2 (Payment Services Directive 2): Strong customer authentication
- AML (Anti-Money Laundering): Customer due diligence, transaction monitoring
- KYC (Know Your Customer): Identity verification, risk assessment
- eIDAS (Electronic Identification): Authentication and trust services
Related Documentation
Authentication
JWT token management and session handling
Error Handling
Common error codes and resolution strategies
Security Best Practices
API security guidelines and recommendations
API Schema Mapping
Complete OpenAPI schema reference
Changelog
| Version | Date | Changes |
|---|---|---|
| v2.1 | 2026-01-13 | Added compliance headers (X-Forwarded-For, User-Agent) |
| v2.0 | 2025-12-01 | Initial multi-tenant support with X-Tenant-ID |