Authentication
How to authenticate your API requests
Authentication
The eternalsocial.dev API uses Bearer tokens for authentication. You can use an API Key or a JWT token.
API Keys
API Keys are the recommended authentication method for production applications.
Create an API Key
- Go to the Dashboard
- Click Create API Key
- Give it a descriptive name (e.g., "Production", "Development")
- Copy the generated key - it will only be shown once
Use the API Key
Include the key in the Authorization header:
curl -X GET 'https://api.eternalsocial.dev/accounts' \
-H 'Authorization: Bearer sk_live_abc123...'Never expose your API Key in frontend code. Always use environment variables and make calls from your backend.
JWT Tokens
JWT tokens are used for user authentication in the dashboard and applications that need sessions.
Get a token
curl -X POST 'https://api.eternalsocial.dev/auth/login' \
-H 'Content-Type: application/json' \
-d '{
"email": "your@email.com",
"password": "your_password"
}'Response:
{
"token": "eyJhbGciOiJIUzI1NiIs...",
"user": {
"id": "user_123",
"email": "your@email.com"
}
}Use the token
curl -X GET 'https://api.eternalsocial.dev/accounts' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIs...'Rate Limits
| Type | Limit |
|---|---|
| Requests per minute | 60 |
| Requests per hour | 1000 |
| Requests per day | 10000 |
Need higher limits? Contact us at support.
Authentication Errors
| Code | Description |
|---|---|
| 401 | Invalid or expired token |
| 403 | No permission for this resource |
| 429 | Rate limit exceeded |
{
"error": "Unauthorized",
"message": "Invalid or expired token"
}