Authentication
Session Authentication
The primary authentication method is session-based via NextAuth. When signed in through the web application, API requests from the same browser session are automatically authenticated via cookies.API Key Authentication
Organization administrators can create REST API keys for programmatic access. Keys use the formatthig_ followed by 40 hex characters. Manage keys at Settings > Developer or via the REST API Keys API.
REST API keys (format:
thig_...) are for programmatic access to the thig.ai API. They are separate from Organization AI API keys (at Settings > API Keys), which manage your AI provider keys (OpenAI, Anthropic, Gemini) for AI generation.Authorization header:
Creating API Keys
- Navigate to Settings > Developer in your admin dashboard
- Click Create API Key
- Give the key a descriptive name (e.g., “CI/CD Pipeline”, “Slack Integration”)
- Optionally set an expiration date and custom rate limit
- Copy the key immediately — it is only shown once
Key Limits by Plan
| Plan | API Keys | Rate Limit |
|---|---|---|
| Free | No API access | — |
| Starter | 2 keys | 60 req/min |
| Professional | 10 keys | 60 req/min |
| Enterprise | Unlimited | 60 req/min (customizable) |
Key Management
- Deactivate a key to temporarily disable it without deleting
- Delete a key to permanently revoke access
- Keys can have optional expiration dates — you’ll receive an email warning 7 days before expiry
- All API key usage is logged in the audit trail
Error Responses
| Status | Code | Meaning |
|---|---|---|
| 401 | UNAUTHENTICATED | Invalid, expired, or deactivated key |
| 403 | FORBIDDEN | Plan does not include API access |
| 429 | RATE_LIMITED | Rate limit exceeded |
Auth Endpoints
Register
Full name of the user
Email address
Password (min 8 chars, must include uppercase, lowercase, and digit)
IANA timezone string (e.g., “America/New_York”)
Optional invitation token to join an organization
Sign Out
Forgot Password
Reset Password
Change Password (Authenticated)
Verify Email
Resend Verification Email
Permissions
API access respects your organization role:| Role | Access Level |
|---|---|
| Owner | Full access to all resources and settings |
| Admin | Manage team, templates, and settings |
| Member | Create and manage own projects |
| Viewer | Read-only access to shared projects |
Security
- Account lockout after 5 failed login attempts (15-minute lockout, 30-minute reset)
- Rate limiting on auth endpoints to prevent brute force
- Passwords hashed with bcryptjs
- API keys encrypted at rest with AES-256-GCM