# Endpoints

> Courses, lessons, exercises and checks, progress, explanations, offers and settings.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://learn.docs.sypnia.com/api/endpoints/

For agents: Endpoints: GET /courses, GET /courses/{id}, POST /courses (admin; multipart course folder → new version), DELETE /courses/{id} (admin); GET /lessons/{id}?level=&language=&project= (rendered + bound items), GET /next; POST /lessons/{id}/exercises {project, path?} → 201 exercise {id, branch, state}; GET /exercises, GET /exercises/{id}, POST /exercises/{id}/check → 202 run, GET /exercises/{id}/checks, POST /exercises/{id}/hint, POST /exercises/{id}/finish {keep: bool}, POST /questions/{lesson}/{question}/answer (person) ; GET /progress, GET /progress/export, DELETE /progress (person); POST /explain {item {kind: diff|case|failure|trace|problem|table|column|log|code, ref}, level?, language?}; GET /offers, POST /offers/{id}/dismiss {forever}; GET|PATCH /settings {offers, offers_projects, teach_default, language, captions}; GET /health; MCP at /mcp.

## Courses and lessons

| Method and path                               | Does                                                                               |
| --------------------------------------------- | ---------------------------------------------------------------------------------- |
| `GET /courses`                                | Courses you can take, with your progress                                           |
| `GET /courses/{id}`                           | A course, its lessons and checkpoints                                              |
| `POST /courses`                               | Publish a course folder, or a new version (`admin`)                                |
| `DELETE /courses/{id}`                        | Take a course down (`admin`); progress is kept                                     |
| `GET /lessons/{id}?level=&language=&project=` | A lesson rendered for a level and language, with the items chosen from the project |
| `GET /next`                                   | The next lesson of your path                                                       |

## Exercises and checks

| Method and path                              | Does                                                                        |
| -------------------------------------------- | --------------------------------------------------------------------------- |
| `POST /lessons/{id}/exercises`               | `{ project }` → `201` the exercise, its branch and state                    |
| `GET /exercises`, `GET /exercises/{id}`      | Your exercises; one of them                                                 |
| `POST /exercises/{id}/check`                 | Run the checks on the branch's last commit → `202` a run                    |
| `GET /exercises/{id}/checks`                 | The runs and the result of each check                                       |
| `POST /exercises/{id}/hint`                  | One hint, at your level                                                     |
| `POST /exercises/{id}/finish`                | `{ keep: true }` opens a pull request; `{ keep: false }` deletes the branch |
| `POST /questions/{lesson}/{question}/answer` | Answer a question (a person only)                                           |

## Progress

| Method and path        | Does                                                               |
| ---------------------- | ------------------------------------------------------------------ |
| `GET /progress`        | What you have done                                                 |
| `GET /progress/export` | All of it, as JSON                                                 |
| `DELETE /progress`     | Delete all of it, and the memory notes Learn wrote (a person only) |

## Explanations, offers and settings

| Method and path                    | Does                                                                                                                                                                                 |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `POST /explain`                    | `{ item: { kind, ref }, level?, language? }` → an explanation and the lessons that cover it. `kind`: `diff`, `case`, `failure`, `trace`, `problem`, `table`, `column`, `log`, `code` |
| `GET /offers`                      | Lessons offered to you right now                                                                                                                                                     |
| `POST /offers/{id}/dismiss`        | `{ forever: true }` never offers it again                                                                                                                                            |
| `GET /settings`, `PATCH /settings` | `offers`, `offers_projects`, `teach_default`, `language`, `captions`                                                                                                                 |

## The engine

| Method and path | Does                                                            |
| --------------- | --------------------------------------------------------------- |
| `GET /health`   | `{ "status": "ok" }`                                            |
| `/mcp`          | the MCP server ([MCP](https://learn.docs.sypnia.com/tools/mcp)) |

The OpenAPI document is in the engine's repository, at `spec/openapi.yaml`.
