API Documentation
Overview
The calakan.work REST API provides programmatic access to portal data.
All responses are JSON. Base URL: https://calakan.work/api
Authentication
Two methods supported:
1. Session cookie — login via POST /api/auth/login
2. Bearer token — generate API token from Account > Security, then send:
Authorization: Bearer ck_your_token_here
Rate Limiting
60 requests per minute per IP. Returns 429 when exceeded.
Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api | No | API info & endpoint list |
| GET | /api/apps | No | List all active applications |
| GET | /api/apps/{id} | No | Get app details by ID |
| GET | /api/announcements | No | List active announcements |
| GET | /api/services | No | List IT services |
| GET | /api/status | No | Real-time system status |
| POST | /api/auth/login | No | Login. Body: {username, password, generate_token?} |
| POST | /api/auth/logout | Yes | Logout & destroy session |
| GET | /api/me | Yes | Current user profile |
| GET | /api/favorites | Yes | List user favorites |
| POST | /api/favorites | Yes | Add favorite. Body: {app_id} |
| DEL | /api/favorites/{id} | Yes | Remove favorite |
| GET | /api/tokens | Yes | List your API tokens |
| POST | /api/tokens | Yes | Generate new token. Body: {label} |
| DEL | /api/tokens/{id} | Yes | Revoke a token |
Examples
Login with token generation
curl -X POST https://calakan.work/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"secret","generate_token":true}'
Authenticated request with Bearer token
curl https://calakan.work/api/me \
-H "Authorization: Bearer ck_your_token_here"
Get all apps
curl https://calakan.work/api/apps
Response Format
All successful responses contain:
{
"success": true,
"data": { ... },
"count": 5
}
Error responses:
{
"error": "Unauthorized. Authentication required."
}