Skip to content

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/api

Authentication

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/tunnels

Response:

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/:id

Response:

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/:id

Response:

json
{
  "success": true,
  "message": "Tunnel deleted"
}

Regenerate Token

http
POST /api/tunnels/:id/regenerate-token

Response:

json
{
  "success": true,
  "token": "newtoken123..."
}

User Account

Get Profile

http
GET /api/user/profile

Response:

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

CodeHTTP StatusDescription
UNAUTHORIZED401Not logged in or session expired
FORBIDDEN403No permission for this action
NOT_FOUND404Resource not found
VALIDATION_ERROR400Invalid input data
SUBDOMAIN_TAKEN400Subdomain already in use
RATE_LIMITED429Too many requests

Rate Limits

EndpointLimit
GET requests100/minute
POST/PUT/DELETE20/minute
Token regeneration5/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));

Next Steps

Released under the MIT License.