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 (UUID format)
- Must match the tenant context of the authenticated user
- Case-sensitive
User-Agent
Type:stringRequired: Yes (all endpoints — enforced by global request filter)
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.
X-Forwarded-From
Type:stringRequired: Yes
Format: Source identifier string Identifies the originating source of the request for tracking and routing purposes. Example:
- All API requests through the BFF layer
- Helps identify the upstream caller (frontend app, test suite, integration partner)
platform
Type:stringRequired: Yes (all endpoints — enforced by global request filter)
Format: Platform identifier Identifies the client platform making the request. Used for analytics, feature gating, and device-specific behavior.
Accepted aliases: The server also accepts
sec-ch-ua-platform as an alternative header name. Either platform or sec-ch-ua-platform satisfies this requirement.web— Browser-based applicationios— iOS mobile applicationandroid— Android mobile application
deviceId
Type:stringRequired: Yes (all endpoints — enforced by global request filter)
Format: Unique device identifier Unique identifier for the device making the request. Used for session tracking, fraud detection, and device management.
Accepted aliases: The server also accepts
X-Device-Id or device-id as alternative header names. Any one of deviceId, X-Device-Id, or device-id satisfies this requirement.- All authenticated API operations
- Session creation and management
- Transaction operations
sec-ch-ua-platform
Type:stringRequired: No (accepted as an alias for
platform)Format: Client hint platform string Browser client hint indicating the user’s operating system platform. Automatically sent by modern browsers. This header is an accepted alias for the
platform header — if sec-ch-ua-platform is present, the platform header requirement is satisfied.
Example:
- Customer registration
- Session creation
- Account activation
- Verification operations
- Consent acceptance
- Transfer operations
Contextual Headers
These headers are required only for specific endpoint groups.X-User-ID
Type:stringRequired: Conditional
Format: User identifier string Identifies the acting user within a customer or organization context. Required for operations that need user-level attribution. Example:
- Consent acceptance
- Beneficiary management (create, delete)
- Payment consent management
- Order execution and cancellation
- Wallet operations (prepare, execute)
- Webhook subscription creation
- Verification approval
X-Session-ID
Type:stringRequired: Conditional
Format: Session identifier string Identifies the current user session. Required for 2FA and session-bound operations. Example:
- 2FA code sending
- 2FA verification
- Session-bound CMS operations
X-Organization-ID
Type:stringRequired: Conditional
Format: Organization identifier string Identifies the organization context for B2B operations. Required when acting within an organization scope. Example:
- Employee management (list, add)
- Director management
- Wallet balance queries (B2B)
- Customer transaction history (B2B)
X-User-Roles
Type:stringRequired: Conditional
Format: Comma-separated role list Specifies the roles of the acting user. Required for operations that enforce role-based access. Example:
- Verification approval
- Employee management (add with role assignment)
X-Consumer-ID
Type:stringRequired: Conditional
Format: Consumer identifier string Identifies the consumer context for wallet and transaction queries. Example:
- Customer transaction history
- Order detail retrieval
X-Activity-ID
Type:stringRequired: Conditional
Format: Activity tracking identifier Tracks activity flow for password recovery and similar multi-step operations. Example:
- Password forgot flow
Optional Headers
Accept
Type:stringRequired: No (optional — defaults to
application/json)Default:
application/json, text/plain, */*Format: 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
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 |
|---|---|---|---|
| Client Source | X-Forwarded-From | Request origin tracking | 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.1 | 2026-03-10 | Added X-Forwarded-From, platform, deviceId, sec-ch-ua-platform, X-User-ID, X-Session-ID, X-Organization-ID, X-User-Roles, X-Consumer-ID, X-Activity-ID headers; updated examples to UUID tenant IDs |
| v2.1.2 | 2026-03-14 | Removed X-Forwarded-For (CORS unsafe for browser clients); use X-Forwarded-From for client identification |
| v2.1 | 2026-01-13 | Added compliance headers (User-Agent) |
| v2.0 | 2025-12-01 | Initial multi-tenant support with X-Tenant-ID |