Quickstart
In about fifteen minutes: a local Academy with demo data, a machine client, your first calls to the automation API, a webhook that arrives at your own receiver, and an AI assistant connected over MCP. Every call below runs against the local instance as written.
For a real installation, replace http://localhost:4000 with your API’s address (for example https://api.academy.example.com) and create the machine client in the portal instead of step 3.
1. Run Academy locally
Section titled “1. Run Academy locally”You need Node.js 26 (it ships no corepack: npm install -g corepack@0.36.0 && corepack enable), pnpm 10, ffmpeg, and Docker (or a local PostgreSQL 17 with pgvector and Redis 7).
git clone https://github.com/i-Academy/portal.gitcd portalpnpm installdocker compose up -d # PostgreSQL on 127.0.0.1:5432, Redis on 127.0.0.1:6379pnpm dev # API on :4000 (applies the migrations at start), web app on :3000The defaults in apps/api/.env.example and apps/web/.env.example work with docker compose as they are; copy a file to .env beside it only to change something (configuration). Locally, AUTH_MODE=dev lets anyone sign in without a password, and emails are written to the API’s log instead of being sent.
Check that the API is up:
curl -s http://localhost:4000/healthz{"status":"ok"}2. Load the demo data
Section titled “2. Load the demo data”node apps/api/scripts/demo-seed.mjsThis creates the organisation demo with owner@demo.test, admin@demo.test, trainer@demo.test and learners, plus courses, a class and a live session. Sign in to the portal at http://localhost:3000/login with organisation demo and one of these addresses.
3. Create a machine client
Section titled “3. Create a machine client”Automations sign in as a machine client of the organisation (authentication). In a real installation an organisation administrator creates it under Admin → Integrations → Interfaces → Machine clients, and the secret is shown once.
Locally you can do the same from the shell. The development sign-in answers with a session token for the administrator:
SESSION=$(curl -s -X POST http://localhost:4000/v1/auth/dev-login \ -H "Content-Type: application/json" \ -d '{"tenantSlug":"demo","email":"admin@demo.test"}' | node -pe 'JSON.parse(require("fs").readFileSync(0)).token')
curl -s -X POST http://localhost:4000/v1/integrations/machine-clients \ -H "Authorization: Bearer $SESSION" -H "Content-Type: application/json" \ -d '{"name":"Quickstart","scopes":["people:read","people:write","webhooks:read","webhooks:write"]}'{ "client": { "id": "0b6f…", "name": "Quickstart", "scopes": ["people:read", "people:write", "webhooks:read", "webhooks:write"], "createdAt": "…", "revokedAt": null, "lastUsedAt": null }, "secret": "…", "tokenUrl": "http://localhost:4000/v1/integration-oauth/token"}Keep client.id and secret as CLIENT_ID and CLIENT_SECRET. /v1/auth/dev-login exists only with AUTH_MODE=dev outside production.
4. Get a token and make your first call
Section titled “4. Get a token and make your first call”TOKEN=$(curl -s -X POST http://localhost:4000/v1/integration-oauth/token \ -u "$CLIENT_ID:$CLIENT_SECRET" -d grant_type=client_credentials \ | node -pe 'JSON.parse(require("fs").readFileSync(0)).access_token')
curl -s "http://localhost:4000/v1/integration-api/people?limit=2" -H "Authorization: Bearer $TOKEN"{ "items": [ { "id": "53450689-…", "name": "Laura Hughes", "email": "trainer@demo.test", "status": "active", "department": null, "managerId": null, "employeeNumber": null, "joinedAt": "2026-11-20T08:43:43.397Z" }, { "id": "870560e9-…", "name": "Sarah Klein", "email": "owner@demo.test", "status": "active", "department": null, "managerId": null, "employeeNumber": null, "joinedAt": "2026-11-20T08:43:42.906Z" } ], "next": "870560e9-…"}The token lasts 15 minutes (expires_in: 900). Lists are ordered by id; next is the id to pass as after for the next page, and null on the last one (pagination).
5. Write safely
Section titled “5. Write safely”PUT /v1/integration-api/people finds a person by email or creates them. Send an Idempotency-Key with every write, so a retry of the same step never acts twice:
curl -s -X PUT http://localhost:4000/v1/integration-api/people \ -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ -H "Idempotency-Key: quickstart-ada" \ -d '{"email":"ada@demo.test","name":"Ada Lovelace","department":"Warehouse"}'{ "person": { "id": "b18f651d-…", "name": "Ada Lovelace", "email": "ada@demo.test", "status": "active", "department": "Warehouse", "managerId": null, "employeeNumber": null, "joinedAt": null }, "created": true, "invitation": null}The status is 201 Created. Send exactly the same request again: the same answer comes back with the header idempotent-replayed: true, and nothing is created twice. Without the key, a second call finds the person and answers 200 with "created": false.
6. Receive a webhook
Section titled “6. Receive a webhook”Save this receiver as receiver.mjs. It checks the signature as every receiver must (webhooks):
import { createHmac, timingSafeEqual } from "node:crypto";import { createServer } from "node:http";
const secret = process.env.WEBHOOK_SECRET; // whsec_…
function verify(headers, rawBody) { const id = headers["webhook-id"], ts = headers["webhook-timestamp"]; if (!id || !ts || Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false; const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64"); const expected = createHmac("sha256", key).update(`${id}.${ts}.${rawBody}`).digest("base64"); return (headers["webhook-signature"] ?? "").split(" ").some((s) => { const sig = s.split(",")[1]; return sig && sig.length === expected.length && timingSafeEqual(Buffer.from(sig), Buffer.from(expected)); });}
createServer((req, res) => { let body = ""; req.on("data", (c) => (body += c)); req.on("end", () => { if (!verify(req.headers, body)) return res.writeHead(401).end(); const event = JSON.parse(body); console.log(event.type, event.id, JSON.stringify(event.data)); res.writeHead(204).end(); });}).listen(8787);Subscribe it to person.created (outside production, receivers on http://localhost are allowed; in production the address must be public HTTPS):
curl -s -X POST http://localhost:4000/v1/integration-api/subscriptions \ -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ -H "Idempotency-Key: quickstart-subscribe" \ -d '{"url":"http://localhost:8787/academy","events":["person.created"]}'The answer holds the subscription’s id and its signing secret. Start the receiver with it, then create another person as in step 5 (with a new email and key):
WEBHOOK_SECRET=whsec_… node receiver.mjsWithin a few seconds it prints a line such as:
person.created b2f20c7d-… {"email":"grace@demo.test","external":false,"personId":"df2efaaf-…"}End the subscription with DELETE /v1/integration-api/subscriptions/{id}.
7. Connect an AI assistant (MCP)
Section titled “7. Connect an AI assistant (MCP)”Create a personal access token in the portal under My account → My AI agents → Access tokens for AI assistants (the answer shows it once, with the server’s mcpUrl), then add the server, for example to Claude Code:
claude mcp add --transport http academy http://localhost:4000/v1/mcp --header "Authorization: Bearer acad_…"A client that supports MCP’s OAuth sign-in needs only the address http://localhost:4000/v1/mcp. Without a token the server answers 401 with a WWW-Authenticate header that points to /.well-known/oauth-protected-resource/v1/mcp; the client registers itself and sends you to the portal to allow it (authentication, MCP).
Where to go next
Section titled “Where to go next”- Authentication and scopes: every kind of credential and what it may do.
- API conventions: errors, rate limits, pagination, idempotency and versions.
- Automation flows: onboarding, offboarding and certificates to HR, step by step.
- The API reference: every route of the automation API with examples.