Overview
The Snippets AI API uses Bearer token authentication. All API requests must include a valid API key in theAuthorization header.
Getting Your API Key
1
Log into your workspace
Navigate to your Snippets AI app
2
Go to Admin
Click on API Access
3
Create a new API key
Click New API Key and configure: - Key name: A descriptive name for
identification - Team permissions: Select which teams this key can
access - All teams: Toggle if you want workspace-wide access
4
Copy your key
Copy the secret key immediately - you won’t be able to see it again!
Keep your API key secure! Never share it publicly or commit it to version
control. Anyone with your API key can access your snippets and consume your
API quota.
Using Your API Key
Include your API key in theAuthorization header of every request using the Bearer authentication scheme:
Code Examples
Team Permissions
API keys can be configured with different levels of access:All Teams Access
When enabled, the API key has access to all teams in your workspace, including newly created teams.Specific Team Access
Limit the API key to specific teams for better security:If you try to access a resource (snippet, folder, or tag) from a team that
your API key doesn’t have permission for, you’ll receive a
403 Forbidden
error.Security Best Practices
Use Environment Variables
Use Environment Variables
Never hardcode API keys in your source code. Use environment variables or secure secret management systems:
Rotate Keys Regularly
Rotate Keys Regularly
Periodically rotate your API keys, especially if: - A team member with access
leaves - You suspect a key may have been compromised - You’re decommissioning
an integration
Use Minimum Required Permissions
Use Minimum Required Permissions
Create API keys with access only to the teams they need. Don’t use all-teams
access unless necessary.
Monitor API Usage
Monitor API Usage
Regularly check your API usage in the dashboard to detect any unusual activity
or unauthorized access.
Use HTTPS Only
Use HTTPS Only
Always make API requests over HTTPS. The API will reject requests made over plain HTTP.
Managing API Keys
Viewing API Keys
You can view all your API keys in the dashboard, including:- Key name and creation date
- Last used timestamp
- Team permissions
- Active/inactive status
Deactivating Keys
To deactivate an API key:- Go to Settings → API Keys
- Find the key you want to deactivate
- Click Deactivate
Deactivated keys will immediately stop working. Any integrations using that
key will start receiving
401 Unauthorized errors.Deleting Keys
To permanently delete an API key:- First deactivate the key
- Wait at least 24 hours (recommended)
- Click Delete to permanently remove it
Authentication Errors
Common authentication errors and how to resolve them:Invalid or inactive API keyYour API key is either invalid, has been deactivated, or was never created.Solution: Verify your API key is correct and active in the dashboard.
Missing Authorization headerThe request didn’t include an Authorization header.Solution: Ensure you’re including
Authorization: Bearer YOUR_API_KEY in all requests.Insufficient permissionsYour API key doesn’t have access to the requested team.Solution: Update your API key’s team permissions or use a different key.
Inactive subscriptionYour workspace subscription is not active.Solution: Check your subscription status and update your billing information.
Testing Your Authentication
Use this simple request to verify your API key is working:404 Not Found error (which confirms authentication worked). If authentication fails, you’ll receive a 401 Unauthorized error.