Skip to content

Authentication

Authenticate REST and MCP requests with scoped API keys or OAuth 2.1 Bearer tokens.

Hitfactor supports API keys (hf_live_...) on both REST and MCP, and OAuth 2.1 Bearer tokens on MCP.

API keys use the hf_live_ prefix. Each key binds to one organization, one YouTube channel, and a list of scopes.

Manage keys on /<workspace>/api in the Hitfactor web app:

  1. Select Create API key.
  2. Enter a key name and choose the scopes you need.
  3. Copy the plaintext key immediately. Hitfactor shows the full key once.

To replace a key without downtime, select Rotate. Hitfactor creates a new key with the same name and scopes and revokes the old key. To disable a key immediately, select Revoke.

Pass the key in the x-api-key HTTP header on REST (/api/v1/*) or MCP (POST /api/v1/mcp):

Terminal window
curl -sS "https://hitfactorapp.com/api/v1/credits/balance" \
-H "x-api-key: $HITFACTOR_API_KEY"
ScopeAllowed Tools
(none required)credits_balance, operation_get
research:readresearch_demand, research_radar
retention:readanalyze_channel_retention, critique_retention
packaging:writegenerate_titles, rank_packages, generate_thumbnail
hooks:writegenerate_hooks
ideation:writeideate_concepts
scripts:writegenerate_script

If a key lacks the required scope for a tool, Hitfactor returns 403 insufficient_scope (REST) or -32003 (MCP). In MCP tools/list, Hitfactor hides tools outside the key’s scopes.

MCP clients (POST https://hitfactorapp.com/api/v1/mcp) also accept OAuth 2.1 Bearer JWTs with the public_api scope. REST endpoints (/api/v1/*) accept x-api-key only.

  • Protected resource metadata (RFC 9728): https://hitfactorapp.com/.well-known/oauth-protected-resource/api/v1/mcp
  • Authorization header: Authorization: Bearer <access_token>
  • Required OAuth scope: public_api

When an unauthenticated request hits POST /api/v1/mcp, Hitfactor returns HTTP 401 with a WWW-Authenticate header pointing to the RFC 9728 metadata URL so OAuth-capable clients discover the flow automatically. OAuth tokens grant access to all public tool scopes for the user’s active channel.

  • Send one credential per request. Sending both x-api-key and Authorization returns 401.
  • Browser cookies and internal admin headers are rejected on all /api/v1/* and /api/v1/mcp routes.
  • Requests for an unactivated organization or a revoked key return 401.