API Authentication: Session and CSRF
The browser API uses a session cookie and a CSRF token. Token clients, including hosted MCP, send Authorization Bearer. This page does not set up JWT or OAuth.
Authentication Overview
The browser calls use a session cookie plus a CSRF token from /api/v1/auth/csrf/. Unsafe methods need that token. Hosted MCP and other token clients send Authorization: Bearer instead. Do not log the token.
Authentication Methods:
- • Session-based authentication
- • CSRF token protection
- • Secure cookie handling
- • Rate limiting per user
Security Features:
- • HTTPS required
- • Session timeout
- • IP-based rate limiting
- • Audit logging
Getting Started
Login to Your Account
First, log in to your Cool Web Tool account through the web interface. This establishes your session and authentication cookies.
Get CSRF Token
Retrieve a CSRF token from the API to protect against cross-site request forgery attacks.
Make API Requests
Include your session cookies and CSRF token in all API requests to authenticate properly.
Authentication Flow
Step 1: Get CSRF Token
Response:
{"csrfToken": "abc123def456ghi789"}Step 2: Make Authenticated Request
Response:
{"data": [{"id": "project-uuid", "name": "My Website", "domain": "example.com"}]}Code Examples
JavaScript/Node.js
Python
PHP
Error Handling
401 Unauthorized
Your session has expired or is invalid. Re-authenticate by logging in again.
403 Forbidden
You don't have permission to access this resource. Check your subscription tier.
429 Too Many Requests
You've exceeded your rate limit. Wait before making more requests.
Best Practices
Store Tokens Securely
Never hardcode authentication tokens in your code. Use environment variables or secure storage.
Handle Session Expiry
Implement proper error handling for expired sessions and re-authentication flows.
Respect Rate Limits
Implement exponential backoff when hitting rate limits to avoid being blocked.
Use HTTPS
Always use HTTPS for API requests to ensure your authentication data is encrypted.
Rate Limiting
API requests are rate-limited based on your subscription tier to ensure fair usage and system stability.
Free Tier
100 requests/hour
Starter Plan
500 requests/hour
Professional Plan
2000 requests/hour
Rate Limit Headers
API responses include headers showing your current usage:
X-RateLimit-Limit: 100 X-RateLimit-Remaining: 85 X-RateLimit-Reset: 1640995200