Authentication
Learn how to authenticate your API requests using API keys and best practices for keeping your keys secure.
API Keys
IndieFooter uses API keys to authenticate requests. You can create and manage API keys in your dashboard under Settings → API Keys.
API Key Format
All IndieFooter API keys are prefixed with IF_ for easy identification:
IF_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxLog in to your dashboard to see your actual API key
Example Request
Here's how to use your API key in a JavaScript fetch request:
const response = await fetch('https://api.indiefooter.com/v1/products', {
headers: {
'Authorization': 'Bearer IF_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);Code Examples
Next.js
import { IndieFooter } from 'indiefooter';
export default function Page() {
return (
<main>
<h1>My App</h1>
{/* Your content */}
<IndieFooter
apiKey={process.env.NEXT_PUBLIC_INDIEFOOTER_KEY}
/>
</main>
);
}React
import { IndieFooter } from 'indiefooter';
function App() {
return (
<div className="App">
<header>My App</header>
{/* Your content */}
<IndieFooter
apiKey={import.meta.env.VITE_INDIEFOOTER_KEY}
/>
</div>
);
}Creating API Keys
To create a new API key:
- Log in to your dashboard
- Navigate to Settings → API Keys
- Click "Create New Key"
- Give your key a descriptive name (e.g., "Production Site", "Blog Footer")
- Copy and store your key securely
Key Management
Best practices for managing your API keys:
Use Environment Variables
Never hardcode API keys in your source code. Always use environment variables.
Separate Keys per Environment
Create different keys for development, staging, and production environments.
Rotate Keys Regularly
Periodically rotate your API keys for enhanced security.
Revoke Compromised Keys
If a key is exposed, immediately revoke it from your dashboard and create a new one.
Security Best Practices
Environment Variables
Store your API key in environment variables:
# Next.js
NEXT_PUBLIC_INDIEFOOTER_KEY=IF_your_api_key_here
# Vite/React
VITE_INDIEFOOTER_KEY=IF_your_api_key_hereRate Limiting
API keys are subject to rate limits to ensure fair usage:
- •Free tier: 10,000 requests per month
- •Basic plan: 50,000 requests per month
- •Pro plan: Unlimited requests
Error Responses
Common authentication errors:
401 Unauthorized
Your API key is missing or invalid.
{
"error": {
"message": "Invalid API key",
"type": "authentication_error"
}
}429 Too Many Requests
You've exceeded your rate limit.
{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error"
}
}