| Access Method | Auth Type | When to Use |
|---|---|---|
| REST API | API Key | Direct HTTP requests from your code |
| MCP Integration | OAuth 2.1 | AI assistants (Claude, Cursor) |
REST API Authentication
All REST API requests require an API key passed in theX-API-Key header.
Getting Your API Key
Go to the API Keys page
Using Your API Key
Include theX-API-Key header in every request:
Environment Variables
Store your API key in an environment variable:.env file:
MCP Authentication
The MCP endpoint uses OAuth 2.1 for secure authentication with AI assistants.How It Works
Add the TinyFish MCP server
Add the TinyFish MCP server to your AI client configuration. See the MCP Integration guide for setup instructions.
You need a TinyFish account with an active subscription or credits. Sign up here.
Error Responses
Authentication errors return standard HTTP status codes with a JSON error body. See Error Codes for the full reference.401 Unauthorized — Missing API Key
401 Unauthorized — Missing API Key
401 Unauthorized — Invalid API Key
401 Unauthorized — Invalid API Key
403 Forbidden — Insufficient Credits
403 Forbidden — Insufficient Credits
Authentication succeeded, but you lack credits or an active subscription.How to fix:
- Check your account at agent.tinyfish.ai/api-keys
- Add credits or upgrade your plan
Security Best Practices
Use Environment Variables
Never hardcode API keys in source code
Rotate Keys Regularly
Regenerate keys periodically and after team changes
Limit Exposure
Use separate keys for development and production
Monitor Usage
Review API usage in your dashboard for anomalies