All API requests to genui.sh require authentication using an API key.
Getting Your API Key
- Sign in to your genui.sh dashboard
- Navigate to Settings > API Keys
- Click Create New Key
- Copy and securely store your API key
API keys are only shown once when created. If you lose your key, you’ll need to generate a new one.
Using Your API Key
Include your API key in the Authorization header of all requests:
Authorization: Bearer YOUR_API_KEY
curl -X GET https://genui.sh/api/artifacts \
-H "Authorization: Bearer genui_abc123..."
import requests
import os
API_KEY = os.environ.get("GENUI_API_KEY")
response = requests.get(
"https://genui.sh/api/artifacts",
headers={"Authorization": f"Bearer {API_KEY}"}
)
const API_KEY = process.env.GENUI_API_KEY;
const response = await fetch('https://genui.sh/api/artifacts', {
headers: {
'Authorization': `Bearer ${API_KEY}`
}
});
apiKey := os.Getenv("GENUI_API_KEY")
req, _ := http.NewRequest("GET", "https://genui.sh/api/artifacts", nil)
req.Header.Set("Authorization", "Bearer "+apiKey)
api_key = ENV['GENUI_API_KEY']
request = Net::HTTP::Get.new(uri)
request['Authorization'] = "Bearer #{api_key}"
let api_key = std::env::var("GENUI_API_KEY")?;
let response = client
.get("https://genui.sh/api/artifacts")
.header("Authorization", format!("Bearer {}", api_key))
.send()
.await?;
var apiKey = Environment.GetEnvironmentVariable("GENUI_API_KEY");
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
var response = await client.GetAsync("https://genui.sh/api/artifacts");
Best Practices
Use environment variables
Never hardcode API keys in your source code. Use environment variables instead:export GENUI_API_KEY=genui_your_key_here
Generate new API keys periodically and revoke old ones from the dashboard.
Use separate keys for different environments
Create separate API keys for development, staging, and production environments.
Check your dashboard regularly to monitor API usage and detect any anomalies.
Error Responses
If authentication fails, you’ll receive one of these responses:
| Status Code | Error | Description |
|---|
| 401 | unauthorized | Missing or invalid API key |
| 403 | forbidden | API key doesn’t have permission for this resource |
| 429 | rate_limited | Too many requests, slow down |
Example error response:
{
"error": {
"code": "unauthorized",
"message": "Invalid API key provided"
}
}
Rate Limits
API requests are rate limited based on your plan:
| Plan | Requests per minute |
|---|
| Free | 60 |
| Pro | 600 |
| Enterprise | Custom |
Rate limit headers are included in all responses:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1705320000