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

MethodPathAuthDescription
GET/apiNoAPI info & endpoint list
GET/api/appsNoList all active applications
GET/api/apps/{id}NoGet app details by ID
GET/api/announcementsNoList active announcements
GET/api/servicesNoList IT services
GET/api/statusNoReal-time system status
POST/api/auth/loginNoLogin. Body: {username, password, generate_token?}
POST/api/auth/logoutYesLogout & destroy session
GET/api/meYesCurrent user profile
GET/api/favoritesYesList user favorites
POST/api/favoritesYesAdd favorite. Body: {app_id}
DEL/api/favorites/{id}YesRemove favorite
GET/api/tokensYesList your API tokens
POST/api/tokensYesGenerate new token. Body: {label}
DEL/api/tokens/{id}YesRevoke 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."
}