Authentication
All API requests require authentication via Bearer token.
Get Your API Key
- Request access to the Weyl API
- Fill out the access request form with your project details
- Receive your API key via email within 24 hours
- Securely store your key (it will be shown in the email)
Using Your Key
Environment Variable (Recommended)
export WEYL_API_KEY=wyl_sk_prod_1234567890abcdefThen reference in your code:
curl -H "Authorization: Bearer $WEYL_API_KEY" ...In Code
import osimport requests
headers = { "Authorization": f"Bearer {os.environ['WEYL_API_KEY']}"}
resp = requests.post(url, headers=headers, json=payload)Key Types
| Prefix | Type | Use Case |
|---|---|---|
wyl_sk_prod_ | Production | Live applications |
wyl_sk_dev_ | Development | Testing, staging environments |
wyl_sk_test_ | Test | Rate-limited, for prototyping |
Rate Limits
Rate limits vary by plan:
| Plan | Sync (req/min) | Async (req/min) | Notes |
|---|---|---|---|
| Free | 10 | 30 | Test keys only |
| Starter | 60 | 300 | Burst to 120/min |
| Pro | 600 | 3000 | Dedicated capacity |
| Enterprise | Custom | Custom | SLA, priority support |
When rate limited, you’ll receive a 429 response with a Retry-After header.
Best Practices
Security
- Never commit keys to version control
- Use environment variables or secret managers
- Rotate keys every 90 days
- Use separate keys for dev/staging/prod
Error Handling
resp = requests.post(url, headers=headers, json=payload)
if resp.status_code == 401: print("Invalid or expired API key")elif resp.status_code == 429: retry_after = int(resp.headers.get('Retry-After', 60)) print(f"Rate limited, retry in {retry_after}s")else: resp.raise_for_status()Next Steps
- Quick Start - Generate your first image
- API Overview - Learn the API structure