Authentication
This guide explains how to authenticate with the Nurul API and manage your API keys.
Overview
Nurul uses API keys to authenticate requests. You can view and manage your API keys in the Dashboard.
Getting Your API Key
Log in to your Nurul account
Navigate to Dashboard → Settings → API
Click "Generate New API Key"
Save your API key securely - it won't be shown again
Using Your API Key
Include your API key in the Authorization header of your requests:
curl https://api.nurul.ai/v1/prompts \
-H "Authorization: Bearer YOUR_API_KEY"
API Key Best Practices
Security
Never share your API key
Don't commit API keys to version control
Rotate keys periodically
Use environment variables
Key Management
Use different keys for development and production
Name your keys descriptively
Monitor key usage
Revoke unused keys
Rate Limits
Rate limits are based on your subscription tier:
Free
1
1/min
Premium
50
10/min
Teams
500
50/min
Error Handling
Authentication Errors
{
"error": {
"code": "unauthorized",
"message": "Invalid API key provided"
}
}
Common Status Codes
401: Invalid API key
403: Valid key, but insufficient permissions
429: Rate limit exceeded
Example Implementation
JavaScript/Node.js
const NURUL_API_KEY = process.env.NURUL_API_KEY;
async function generatePrompt(params) {
const response = await fetch('https://api.nurul.ai/v1/prompts', {
method: 'POST',
headers: {
'Authorization': `Bearer ${NURUL_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify(params),
});
return response.json();
}
Python
import os
import requests
NURUL_API_KEY = os.environ.get('NURUL_API_KEY')
def generate_prompt(params):
response = requests.post(
'https://api.nurul.ai/v1/prompts',
headers={
'Authorization': f'Bearer {NURUL_API_KEY}',
'Content-Type': 'application/json',
},
json=params,
)
return response.json()
Next Steps
Review the API Endpoints documentation
Learn about Rate Limits
Understand Error Handling
Check out our Integration Guides
Last updated