API Configuration Guide
How to properly configure and test your API endpoints
The Problem
You tried to connect to https://iot-access.com:3000/api/erp
This fails because port 3000 is only accessible locally. External websites and services cannot reach port 3000 on any public domain.
Why Port 3000 Doesn't Work
Local Only
Port 3000 is bound only to 127.0.0.1 (localhost) on your server. External traffic cannot reach it.
Firewall Protection
Most servers block non-standard ports for security. Only ports 80, 443, and explicitly configured TCP proxies allow external access.
No TLS Support
Port 3000 (HTTP) lacks TLS encryption. Port 443 (HTTPS) provides secure connections with certificates.
The Solution
Use your actual domain with port 443 (HTTPS/TLS)
Correct API URLs
Production (Recommended)
Authentication Endpoint
https://iot-access.com/api/erp/authAttendance Endpoint
https://iot-access.com/api/erp/attendanceDevices Endpoint
https://iot-access.com/api/erp/devicesProtocol: https:// | Port: 443 (implicit) | TLS: Enabled
Local Development Only
Authentication Endpoint (Local)
http://localhost:3000/api/erp/authAttendance Endpoint (Local)
http://localhost:3000/api/erp/attendanceProtocol: http:// | Port: 3000 | TLS: Disabled
Railway TCP Proxy (Legacy)
Example with Railway TCP Proxy
http://turntable.proxy.rlwy.net:23456/api/erp/authProtocol: http:// | Port: Assigned by Railway | TLS: Depends on config
Use only for legacy devices that don't support HTTPS/TLS
WebSocket Connection URLs
Production
WebSocket Secure (TLS)
wss://iot-access.com/wsUse for real devices in production
Local Development
WebSocket Plain (No TLS)
ws://localhost:3000/wsUse only for local testing
Step-by-Step Setup
Deploy Your App
Deploy to Railway, Vercel, or your own server with a domain (iot-access.com)
Get an API Key
Go to Dashboard → ERP Integration → Generate API Key
Test with API Tester
Go to Dashboard → API Tester to test your endpoints
Use in Your Application
Update your application to use the production URL (https://iot-access.com/api/erp/...)
API Reference
POST /api/erp/auth
Description: Authenticate with API key, returns JWT token
Body: { "api_key": "iotacc_..." }
Response: { "token": "eyJ...", "expires_in": 86400 }
GET /api/erp/attendance
Description: Fetch attendance records
Header: Authorization: Bearer {token}
Returns: Array of attendance records
GET /api/erp/devices
Description: Get IoT devices list
Header: Authorization: Bearer {token}
Returns: Array of device objects