Base URL
https://api.phonegrid.id/
Authentication
Kebanyakan endpoint butuh JWT token. Ada 3 cara dapet token:
1\. Login via API
POST /auth/login
Content-Type: application/json
{ "email": "[email protected]", "password": "..." }
Response:
{
"token": "eyJhbGci...",
"refreshToken": "eyJhbGci...",
"user": { "id": 1, "email": "...", "role": "user", "tier": "pro" },
"license": { "tier": "pro", "maxDevices": 100, "maxPcs": 5, "flags": { ... } }
}
2\. Gunakan cookie SSO
Login via website → cookie pg_token berlaku di seluruh *.phonegrid.id termasuk API.
3\. API key \(Enterprise\, coming soon\)
Request long-lived API key via admin panel. Scope-able (read-only / read-write).
Header untuk request:
Authorization: Bearer <token>
Endpoint kategori
/farm/* — remote control
| Method | Path | Fungsi | | ------ | ---- | ------ | | GET | /farm/state | Snapshot devices + tasks + runs | | POST | /farm/run-task | Trigger task execution | | POST | /farm/stop-task | Stop task | | GET | /farm/run-logs/{runId} | Tail log | | GET/POST/PUT/DELETE | /farm/schedules{/id} | Schedule CRUD |
/store/* — app store
| Method | Path | Fungsi | | ------ | ---- | ------ | | GET | /store/apps | List published apps | | GET | /store/apps/{slug} | App detail | | POST | /store/apps/{slug}/install | Install app ke device |
/license/check
Called desktop tiap 5 menit (bisa override via PHONEGRID_LICENSE_PERIOD_MS). Returns:
{
"valid": true,
"tier": "pro",
"planLabel": "Pro",
"maxDevices": 100,
"maxPcs": 5,
"maxApps": 50,
"features": ["builder", "store"],
"flags": { "builder": true, "store": true },
"expiresAt": "2026-12-31T23:59:59Z",
"devices": 7,
"serverTime": "2026-04-25T10:00:00Z"
}
Rate limiting
/auth/*— 30 req / 10 menit per IP- Lainnya — tidak di-rate-limit (akan ditambah di v1.3)
Webhooks (Enterprise)
Coming soon. Akan support event run.completed, run.failed, device.online, device.offline.
OpenAPI / Swagger
Coming soon. Untuk sekarang docs ini adalah spec authoritative.
Test dengan curl
# Login
curl -X POST https://api.phonegrid.id/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"..."}'
# Check license (authed)
curl https://api.phonegrid.id/license/check \
-H "Authorization: Bearer <token>"