Authentication
Learn how to authenticate ApiFinance AI API requests and how billing works for public endpoints.
Authenticate your ApiFinance AI REST API requests with a user-owned API key.
Overview
Every public API request except GET /health requires an API key in the Authorization header.
Header Format
Authorization: Bearer <your_api_key>
If the header is missing, invalid, disabled, or expired, the API returns an authentication error and the request does not run.
Base URL
Use this base URL for all examples in this documentation:
https://api.apifinance.ai
Endpoint paths are shown relative to that base URL, for example:
/stocks/search
Authentication Rules
GET /healthdoes not require authentication.- All
/stocks/*endpoints require a valid API key. - API keys are tied to a user account and its credit balance.
- Interactive MCP access uses OAuth instead of the
Authorizationheader.
Parameter Conventions
symbolis passed in the URL path and is case-insensitive.limit,page, andper_pagemust be positive integers.- Statement endpoints accept
period_type, usuallyannualorquarterly. - Search accepts
query,page, andper_page. - Search also accepts
limitas an alias ofper_page. - Price history requires both
start_dateandend_dateinYYYY-MM-DDformat.
Billing Behavior
- Billable endpoints check available credits before processing the request.
- Credits are charged only when the final HTTP status is successful.
- Requests that fail with
4xxor5xxresponses do not deduct credits.
Example Request
curl -H "Authorization: Bearer $your_api_key" \
"https://api.apifinance.ai/stocks/AAPL/profile"