Authorization header.
API Key Types
StashFyle supports two types of API keys:Secret Keys (sk_)
Use for: Server-side applications, backend services, scripts
- Full access to all API endpoints
- Can upload private files
- Can generate signed URLs
- Never expose in client-side code
Public Keys (pk_)
Use for: Browser uploads, mobile apps, client-side code
- Limited to upload endpoint only
- Requires CORS origin configuration
- Cannot access private files or signed URLs
- Safe to use in frontend code
Creating API Keys
- Go to API Keys in your dashboard
- Click Create API Key
- Choose the key type (Secret or Public)
- Optionally add a name and allowed origins (for public keys)
- Copy your key immediately—it won’t be shown again
Using Public Keys with CORS
When using a public key from a browser, you must configure allowed origins:- Edit your public key in the dashboard
- Add your domain(s) to Allowed Origins
- Include the full origin:
https://yourapp.com
Security Best Practices
Never expose secret keys
Never expose secret keys
Secret keys should only be used in server-side code. Use environment variables and never commit keys to version control.
Use public keys for browsers
Use public keys for browsers
For client-side uploads, always use public keys with properly configured CORS origins.
Rotate keys regularly
Rotate keys regularly
If you suspect a key has been compromised, revoke it immediately and create a new one.
Use separate keys for environments
Use separate keys for environments
Create different keys for development, staging, and production.
Key Limits by Plan
| Plan | API Keys |
|---|---|
| Free | 2 |
| Hobby | 10 |
| Pro | 50 |