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
Section titled “API Keys”API keys use the hf_live_ prefix. Each key binds to one organization, one YouTube channel, and a list of scopes.
Manage Keys
Section titled “Manage Keys”Manage keys on /<workspace>/api in the Hitfactor web app:
- Select Create API key.
- Enter a key name and choose the scopes you need.
- 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.
Send an API Key
Section titled “Send an API Key”Pass the key in the x-api-key HTTP header on REST (/api/v1/*) or MCP (POST /api/v1/mcp):
curl -sS "https://hitfactorapp.com/api/v1/credits/balance" \ -H "x-api-key: $HITFACTOR_API_KEY"Scopes
Section titled “Scopes”| Scope | Allowed Tools |
|---|---|
| (none required) | credits_balance, operation_get |
research:read | research_demand, research_radar |
retention:read | analyze_channel_retention, critique_retention |
packaging:write | generate_titles, rank_packages, generate_thumbnail |
hooks:write | generate_hooks |
ideation:write | ideate_concepts |
scripts:write | generate_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.
OAuth 2.1 for MCP
Section titled “OAuth 2.1 for MCP”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.
Credential Rules
Section titled “Credential Rules”- Send one credential per request. Sending both
x-api-keyandAuthorizationreturns401. - Browser cookies and internal admin headers are rejected on all
/api/v1/*and/api/v1/mcproutes. - Requests for an unactivated organization or a revoked key return
401.