Authentication Methods
Snip API supports two authentication methods:API Key
Recommended for server-to-server API access
Bearer Token (JWT)
Used for web application authentication
API Key Authentication
The recommended method for API access. Include your API key in the request header:Getting Your API Key
Login
Log in to your account at snip.sa
Example Request
Bearer Token Authentication
Used for web applications. Include your JWT token in the Authorization header:Getting a JWT Token
Authenticate with your credentials to receive a JWT token:Using the JWT Token
Security Best Practices
Keep Keys Secure
Keep Keys Secure
- Never commit API keys to version control
- Use environment variables to store keys
- Rotate keys regularly
- Never share keys publicly
Server-Side Only
Server-Side Only
- Never expose API keys in client-side code
- Use server-side proxies for client applications
- Implement proper CORS policies
Key Rotation
Key Rotation
- Regenerate keys if compromised
- Update all applications using the old key
- Previous keys are immediately invalidated
Monitor Usage
Monitor Usage
- Track API usage in your dashboard
- Set up alerts for unusual activity
- Review access logs regularly
Managing API Keys
Regenerate API Key
Get Current API Key
Authentication Errors
| Status Code | Error | Description |
|---|---|---|
| 401 | Unauthorized | Invalid or missing API key/token |
| 403 | Forbidden | Valid credentials but insufficient permissions |
