REST API
Everything in Lectro is an API call. Scripts and agents outside the MCP flow use the same routes the app does, with an API key.
API keys
In the app, open Settings, turn on Show advanced tools, and create a key under API keys. It is shown once and starts with crt_. Send it as Authorization: Bearer crt_…. A key can read and write everything you study but cannot manage your account or its keys. Revoking a key stops whatever uses it at once.
A first request
All routes live under https://app.lectro.ai/api/v1. This one creates a note and files it in a node:
curl https://app.lectro.ai/api/v1/notes \
-H "Authorization: Bearer crt_…" \
-H "Content-Type: application/json" \
-d '{
"notetype_id": "…",
"fields": { "Front": "Why does SN2 invert?", "Back": "Back-side attack." },
"node_ids": ["…"]
}'Conventions
- Bodies are JSON with snake_case fields. IDs are UUIDv7 strings.
- Times are ISO-8601 in UTC.
- Reviews take a
client_request_id, so a retried request is recorded once. - Requests are rate limited per client; past the limit you get a 429 with code
rate_limited.
Errors
Every error has the same shape, with a stable code beside the HTTP status:
{
"error": {
"code": "validation_failed",
"message": "Invalid request",
"details": [
{ "keyword": "invalid_type", "instancePath": "/notetype_id", "message": "…" }
]
}
}| Code | Status | Meaning |
|---|---|---|
| unauthorized | 401 | No key, or one that was revoked |
| forbidden | 403 | The key may not do this |
| not_found | 404 | Nothing with that ID in your account |
| validation_failed | 400 | The body or query does not fit the schema |
| conflict, stale_version | 409 | Someone changed it first; read it and retry |
| plan_required | 402 | Needs a plan you don’t have, e.g. Teacher to publish a course |
| limit_reached | 402 | A plan limit is used up, e.g. the monthly assistant allowance |
| rate_limited | 429 | Too many requests; slow down |
Routes
| Resource | Routes |
|---|---|
| Account | GET /me, GET /billing |
| Today | GET /today |
| Skill trees | CRUD on /trees, nodes under /trees/:id/nodes, edges under /trees/:id/edges |
| Notes | CRUD on /notes (filter by tree_id, node_id, unfiled), GET /notes/:id/cards, GET /tags |
| Cards and reviews | GET /cards?due=true, GET /cards/:id, GET /cards/:id/reviews, POST /reviews |
| Sessions | POST /sessions, GET /sessions/:id and its items |
| Sources | CRUD on /sources, POST /sources/:id/merge, citations under /notes/:id/citations |
| Notetypes | CRUD on /notetypes, fields and templates under /notetypes/:id |
| Protocols | GET /me/protocol, GET/POST /protocol-revisions |
| Feedback | GET /feedback, POST /feedback/:id/resolve, GET/PUT /style-guide |