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 /health does 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 Authorization header.

Parameter Conventions

  • symbol is passed in the URL path and is case-insensitive.
  • limit, page, and per_page must be positive integers.
  • Statement endpoints accept period_type, usually annual or quarterly.
  • Search accepts query, page, and per_page.
  • Search also accepts limit as an alias of per_page.
  • Price history requires both start_date and end_date in YYYY-MM-DD format.

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 4xx or 5xx responses do not deduct credits.

Example Request

curl -H "Authorization: Bearer $your_api_key" \
  "https://api.apifinance.ai/stocks/AAPL/profile"