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 stock-data endpoint in this documentation 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:

/securities/search

Authentication Rules

  • All documented public endpoints except /health 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

  • ticker is passed either in the URL path under /securities/{ticker}/... or as a query parameter on calendar, filing, and statement endpoints.
  • limit, page, and per_page must be positive integers.
  • Statement endpoints accept timeframe, typically annual, quarterly, or ttm.
  • Search accepts query, page, and per_page.
  • Price history and insider trading filters accept start and end in YYYY-MM-DD format.
  • Statement start and end filters operate on fiscal year boundaries.

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/securities/AAPL/quote"

Next step

Move from docs into a real evaluation flow

Check the playground, review trust details, and create a key only after the response shape and coverage fit your workflow.