Authentication
Show me your ID, please ๐ชช
Every API request needs authentication. Think of it like a VIP pass to your AI memory partyโno token, no entry!
Get Your API Token
The 30-Second Method
- Visit dashboard.memof.ai/access-tokens
- Click "Create New Token" (the big shiny button)
- Copy your token (starts with
moa_...)
- Keep it secret, keep it safe ๐งโโ๏ธ
Token Format
Your token looks like this:
Notice the moa_ prefix? That stands for "Memory of Agents" (we're creative like that).
Using Your Token
Add your token to the Authorization header with the Bearer prefix:
Complete Example
curl -H "Authorization: Bearer moa_your_token_here" \
-H "Content-Type: application/json" \
https://api.memof.ai/api/workspaces/workspaces
Testing Your Token
Is it working? Let's find out! ๐
# This should return your workspaces
curl -H "Authorization: Bearer moa_your_token" \
https://api.memof.ai/api/workspaces/workspaces
Success: You'll see a JSON response with your workspaces ๐
Failure: You'll get a 401 error (token's invalid, sorry!) ๐ข
Common Authentication Errors
401 Unauthorized
{
"error": {
"code": "AUTHENTICATION_ERROR",
"message": "Invalid or missing API token"
}
}
Translation: Your token is wrong, missing, or you forgot the Bearer prefix.
403 Forbidden
{
"error": {
"code": "FORBIDDEN",
"message": "Insufficient permissions"
}
}
Translation: Your token works, but you don't have permission for that action.
Security Best Practices
DO โ
- Store tokens securely - Use environment variables
- Use HTTPS - We only accept HTTPS (localhost gets a pass)
- Rotate tokens regularly - New month, new token
- Different tokens for different environments - Dev, staging, production
DON'T โ
- Hardcode tokens - Git history never forgets
- Commit tokens - GitHub will yell at you
- Share tokens publicly - Seriously, don't
- Use production tokens in development - Keep them separated
Environment Variables
The smart way to handle tokens:
# ~/.bashrc or ~/.zshrc
export MEMOFAI_API_TOKEN="moa_your_token_here"
# Then use it
curl -H "Authorization: Bearer $MEMOFAI_API_TOKEN" \
https://api.memof.ai/api/workspaces/workspaces
Rate Limits
We're generous, but not infinite ๐๏ธ
- 1000 requests/hour - Per token
- 100 requests/minute - Burst limit
Rate limit headers in every response:
Token Management
Creating Tokens
Visit dashboard.memof.ai/access-tokens to create new tokens.
Revoking Tokens
Compromised token? Revoke it instantly from the dashboard. All requests with that token will immediately fail.
Multiple Tokens
You can create multiple tokens for:
- Different applications
- Different environments
- Different team members
- Testing and production
What's Next?
Now that you're authenticated, time to:
Remember: With great power comes great API tokens! ๐ช