API Documentation
InTunnel provides a REST API for programmatic access to tunnel management.
WARNING
API access requires authentication. All requests must include your session cookie or API token.
Base URL
https://intunnel.cloud/apiAuthentication
Session-based (Web)
After logging in via the web interface, your session cookie is automatically included.
Token-based (Coming Soon)
API tokens for programmatic access will be available in a future update.
Endpoints
Tunnels
List All Tunnels
http
GET /api/tunnelsResponse:
json
{
"tunnels": [
{
"id": 1,
"name": "My Web App",
"subdomain": "myapp",
"local_port": 3000,
"token": "abc123...",
"status": "active",
"created_at": "2026-01-15T10:30:00Z"
}
]
}Get Tunnel Details
http
GET /api/tunnels/:idResponse:
json
{
"id": 1,
"name": "My Web App",
"subdomain": "myapp",
"local_port": 3000,
"token": "abc123def456...",
"status": "active",
"domain": "intunnel.cloud",
"url": "https://myapp.intunnel.cloud",
"created_at": "2026-01-15T10:30:00Z",
"last_connected": "2026-02-01T14:20:00Z"
}Create Tunnel
http
POST /api/tunnels
Content-Type: application/json
{
"name": "New Tunnel",
"subdomain": "newtunnel",
"local_port": 8080
}Response:
json
{
"success": true,
"tunnel": {
"id": 2,
"name": "New Tunnel",
"subdomain": "newtunnel",
"token": "xyz789..."
}
}Delete Tunnel
http
DELETE /api/tunnels/:idResponse:
json
{
"success": true,
"message": "Tunnel deleted"
}Regenerate Token
http
POST /api/tunnels/:id/regenerate-tokenResponse:
json
{
"success": true,
"token": "newtoken123..."
}User Account
Get Profile
http
GET /api/user/profileResponse:
json
{
"id": 1,
"username": "johndoe",
"email": "john@example.com",
"tunnels_count": 3,
"created_at": "2026-01-10T08:00:00Z"
}Error Responses
All errors follow this format:
json
{
"error": true,
"message": "Description of the error",
"code": "ERROR_CODE"
}Error Codes
| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Not logged in or session expired |
FORBIDDEN | 403 | No permission for this action |
NOT_FOUND | 404 | Resource not found |
VALIDATION_ERROR | 400 | Invalid input data |
SUBDOMAIN_TAKEN | 400 | Subdomain already in use |
RATE_LIMITED | 429 | Too many requests |
Rate Limits
| Endpoint | Limit |
|---|---|
| GET requests | 100/minute |
| POST/PUT/DELETE | 20/minute |
| Token regeneration | 5/hour |
Examples
cURL
bash
# List tunnels (with session cookie)
curl -b cookies.txt https://intunnel.cloud/api/tunnels
# Create tunnel
curl -X POST https://intunnel.cloud/api/tunnels \
-b cookies.txt \
-H "Content-Type: application/json" \
-d '{"name": "Test", "subdomain": "test", "local_port": 3000}'Python
python
import requests
session = requests.Session()
# Login first
session.post("https://intunnel.cloud/login", data={
"email": "user@example.com",
"password": "yourpassword"
})
# Get tunnels
response = session.get("https://intunnel.cloud/api/tunnels")
tunnels = response.json()JavaScript
javascript
// After logging in via browser
fetch("/api/tunnels")
.then(res => res.json())
.then(data => console.log(data.tunnels));