API Authentication
All API requests to SiteX must be authenticated using an API key. This page explains how to authenticate your requests.
Authentication Method
Include your API key in the Authorization header using the Bearer scheme:
Authorization: Bearer sx_live_your_api_key_here
Example Request
curl -X POST https://yoursite.com/api/publish-content \
-H "Authorization: Bearer sx_live_abc123def456" \
-H "Content-Type: application/json" \
-d '{"type": "article", "title": "My Article", "content": "..."}'
Authentication Errors
| Code | Error | Cause |
|---|---|---|
| 401 | missing_api_key | No Authorization header provided |
| 401 | invalid_api_key | Key doesn't exist or has been deleted |
| 403 | key_disabled | API key has been disabled |
| 403 | key_expired | API key has passed its expiration date |
| 403 | ip_not_whitelisted | Request IP not in the key's whitelist |
Test vs Live Keys
Keys prefixed with sx_test_ work identically to live keys, but content created with test keys is not publicly visible. Use test keys during development and AI agent setup.
Security Best Practices
- Never expose API keys in client-side code or public repositories
- Use environment variables to store keys in your application
- Enable IP whitelisting to restrict key usage to known servers
- Use granular permissions - don't give keys more access than needed