> For the complete documentation index, see [llms.txt](https://sponta.gitbook.io/orario/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sponta.gitbook.io/orario/funzioni-e-dettagli-tecnici/api-endpoint.md).

# Catalogo degli endpoint HTTP

Inventario statico di 127 registrazioni Express nei moduli `src/routes`, al commit `3bf5b58`. I permessi indicano i middleware della rotta; le validazioni del body e gli ulteriori controlli di dominio restano nel relativo handler. Non è una specifica completa dei payload.

`Sessione` richiede un token Bearer valido; `Amministratore` richiede anche il ruolo admin. `Senza sessione` indica assenza di `requireAuth`: login e recupero password applicano comunque le proprie verifiche. Il logout legge il token se fornito.

Le URL esterne possono includere il prefisso `/orario`. Vedere [API e integrazioni](/orario/funzioni-e-dettagli-tecnici/api.md).

## ai.js

| Metodo | Percorso                                                  | Accesso        | Codice                                                                         |
| ------ | --------------------------------------------------------- | -------------- | ------------------------------------------------------------------------------ |
| POST   | `/api/ai/diagnosi`                                        | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/ai.js#L12) |
| GET    | `/api/ai/diagnosi/:id`                                    | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/ai.js#L27) |
| POST   | `/api/ai/diagnosi/:id/annulla`                            | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/ai.js#L33) |
| POST   | `/api/ai/diagnosi/:id/suggerimenti/:suggestionId/applica` | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/ai.js#L39) |
| POST   | `/api/ai/applica`                                         | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/ai.js#L56) |

## auth.js

| Metodo | Percorso                           | Accesso        | Codice                                                                            |
| ------ | ---------------------------------- | -------------- | --------------------------------------------------------------------------------- |
| GET    | `/api/auth/config`                 | Senza sessione | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/auth.js#L164) |
| POST   | `/api/auth/login`                  | Senza sessione | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/auth.js#L173) |
| POST   | `/api/auth/logout`                 | Senza sessione | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/auth.js#L218) |
| GET    | `/api/auth/me`                     | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/auth.js#L224) |
| PUT    | `/api/auth/password`               | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/auth.js#L228) |
| POST   | `/api/auth/password-reset/request` | Senza sessione | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/auth.js#L258) |
| POST   | `/api/auth/password-reset/confirm` | Senza sessione | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/auth.js#L334) |
| GET    | `/api/utenti`                      | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/auth.js#L377) |
| POST   | `/api/utenti`                      | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/auth.js#L386) |
| PUT    | `/api/utenti/:id/email`            | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/auth.js#L437) |
| DELETE | `/api/utenti/:id`                  | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/auth.js#L466) |
| PUT    | `/api/utenti/:id/password`         | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/auth.js#L487) |
| POST   | `/api/amministrazione/svuota`      | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/auth.js#L514) |

## constraints.js

| Metodo | Percorso                                 | Accesso        | Codice                                                                                   |
| ------ | ---------------------------------------- | -------------- | ---------------------------------------------------------------------------------------- |
| GET    | `/api/vincoli/catalogo`                  | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/constraints.js#L9)   |
| GET    | `/api/vincoli`                           | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/constraints.js#L19)  |
| GET    | `/api/vincoli/requisiti-mattutini`       | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/constraints.js#L28)  |
| PUT    | `/api/vincoli/requisiti-mattutini/:id`   | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/constraints.js#L37)  |
| GET    | `/api/docenti/:id/vincoli/non-adiacenza` | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/constraints.js#L49)  |
| PUT    | `/api/docenti/:id/vincoli/non-adiacenza` | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/constraints.js#L58)  |
| POST   | `/api/vincoli`                           | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/constraints.js#L127) |
| PUT    | `/api/vincoli/:id`                       | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/constraints.js#L159) |
| DELETE | `/api/vincoli/:id`                       | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/constraints.js#L200) |
| GET    | `/api/conflitti`                         | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/constraints.js#L220) |
| POST   | `/api/conflitti/check-cell`              | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/constraints.js#L229) |

## curriculumConfiguration.js

| Metodo | Percorso                      | Accesso        | Codice                                                                                              |
| ------ | ----------------------------- | -------------- | --------------------------------------------------------------------------------------------------- |
| GET    | `/api/compatibilita`          | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/curriculumConfiguration.js#L21) |
| GET    | `/api/configurazione/blocchi` | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/curriculumConfiguration.js#L25) |
| PUT    | `/api/configurazione/blocchi` | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/curriculumConfiguration.js#L26) |
| GET    | `/api/classi/:id/limiti`      | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/curriculumConfiguration.js#L30) |
| PUT    | `/api/classi/:id/limiti`      | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/curriculumConfiguration.js#L33) |

## domain.js

| Metodo | Percorso              | Accesso        | Codice                                                                            |
| ------ | --------------------- | -------------- | --------------------------------------------------------------------------------- |
| GET    | `/api/config/dominio` | Senza sessione | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/domain.js#L7) |

## public.js

| Metodo | Percorso                   | Accesso  | Codice                                                                             |
| ------ | -------------------------- | -------- | ---------------------------------------------------------------------------------- |
| GET    | `/api/stats`               | Sessione | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/public.js#L18) |
| GET    | `/api/pubblico/stato`      | Sessione | [handler](https://github.com/lsponta/orario/blob/main/src/routes/public.js#L80)    |
| GET    | `/api/pubblico/plessi`     | Sessione | [handler](https://github.com/lsponta/orario/blob/main/src/routes/public.js#L84)    |
| GET    | `/api/pubblico/materie`    | Sessione | [handler](https://github.com/lsponta/orario/blob/main/src/routes/public.js#L88)    |
| GET    | `/api/pubblico/docenti`    | Sessione | [handler](https://github.com/lsponta/orario/blob/main/src/routes/public.js#L92)    |
| GET    | `/api/pubblico/classi`     | Sessione | [handler](https://github.com/lsponta/orario/blob/main/src/routes/public.js#L96)    |
| GET    | `/api/pubblico/calendario` | Sessione | [handler](https://github.com/lsponta/orario/blob/main/src/routes/public.js#L102)   |
| GET    | `/api/pubblico/orario`     | Sessione | [handler](https://github.com/lsponta/orario/blob/main/src/routes/public.js#L106)   |
| GET    | `/api/pubblico/sostegno`   | Sessione | [handler](https://github.com/lsponta/orario/blob/main/src/routes/public.js#L113)   |

## school.js

| Metodo | Percorso                            | Accesso        | Codice                                                                               |
| ------ | ----------------------------------- | -------------- | ------------------------------------------------------------------------------------ |
| GET    | `/api/plessi`                       | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L19)   |
| POST   | `/api/plessi`                       | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L28)   |
| PUT    | `/api/plessi/:id`                   | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L40)   |
| DELETE | `/api/plessi/:id`                   | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L53)   |
| GET    | `/api/calendario`                   | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L73)   |
| POST   | `/api/calendario/anteprima`         | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L100)  |
| PUT    | `/api/calendario`                   | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L112)  |
| GET    | `/api/distanze`                     | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L162)  |
| PUT    | `/api/distanze`                     | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L178)  |
| GET    | `/api/aule`                         | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L226)  |
| POST   | `/api/aule`                         | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L264)  |
| PUT    | `/api/aule/:id`                     | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L281)  |
| DELETE | `/api/aule/:id`                     | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L305)  |
| POST   | `/api/classi/proponi-residenze`     | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L327)  |
| POST   | `/api/classi/residenze`             | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L368)  |
| GET    | `/api/cattedre/quadro`              | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L406)  |
| PUT    | `/api/cattedre`                     | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L436)  |
| POST   | `/api/cattedre/analizza-proposte`   | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L480)  |
| POST   | `/api/cattedre/proponi`             | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L492)  |
| POST   | `/api/cattedre/conferma-proposte`   | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L503)  |
| DELETE | `/api/cattedre/proposte`            | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L514)  |
| GET    | `/api/materie`                      | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L548)  |
| POST   | `/api/materie`                      | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L557)  |
| PUT    | `/api/materie/:id`                  | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L574)  |
| DELETE | `/api/materie/:id`                  | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L599)  |
| GET    | `/api/docenti`                      | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L614)  |
| POST   | `/api/docenti`                      | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L663)  |
| PUT    | `/api/docenti/:id`                  | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L731)  |
| PUT    | `/api/docenti/:id/giorno-libero`    | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L844)  |
| DELETE | `/api/docenti/:id`                  | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L887)  |
| GET    | `/api/classi`                       | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L902)  |
| GET    | `/api/classi/:id/profilo`           | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L983)  |
| POST   | `/api/classi/:id/profilo/anteprima` | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L991)  |
| PUT    | `/api/classi/:id/profilo`           | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L999)  |
| POST   | `/api/classi`                       | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L1068) |
| PUT    | `/api/classi/:id`                   | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L1103) |
| DELETE | `/api/classi/:id`                   | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L1221) |
| GET    | `/api/articolazioni`                | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L1333) |
| POST   | `/api/articolazioni`                | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L1358) |
| PUT    | `/api/articolazioni/:id`            | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L1381) |
| DELETE | `/api/articolazioni/:id`            | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/school.js#L1431) |

## timetable.js

| Metodo | Percorso                                         | Accesso        | Codice                                                                                  |
| ------ | ------------------------------------------------ | -------------- | --------------------------------------------------------------------------------------- |
| GET    | `/api/orario/docenti/:id/buche`                  | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L57)   |
| GET    | `/api/orario`                                    | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L76)   |
| POST   | `/api/orario`                                    | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L155)  |
| PUT    | `/api/orario/:id`                                | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L219)  |
| DELETE | `/api/orario/:id`                                | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L274)  |
| PUT    | `/api/orario/:id/lock`                           | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L293)  |
| GET    | `/api/sostegno`                                  | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L322)  |
| POST   | `/api/sostegno`                                  | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L353)  |
| DELETE | `/api/sostegno/:id`                              | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L436)  |
| DELETE | `/api/orario`                                    | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L449)  |
| GET    | `/api/orario/:id/destinazioni`                   | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L467)  |
| GET    | `/api/orario/allocazione-assistita/tasks`        | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L482)  |
| POST   | `/api/orario/allocazione-assistita/destinazioni` | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L491)  |
| POST   | `/api/orario/allocazione-assistita/applica`      | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L512)  |
| POST   | `/api/orario/:id/scambia`                        | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L605)  |
| GET    | `/api/orario/log`                                | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L899)  |
| POST   | `/api/orario/undo`                               | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L916)  |
| POST   | `/api/orario/redo`                               | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L937)  |
| POST   | `/api/orario/generazioni`                        | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1078) |
| GET    | `/api/orario/generazioni`                        | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1132) |
| GET    | `/api/orario/bozza/log`                          | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1136) |
| GET    | `/api/orario/generazioni/:id`                    | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1140) |
| DELETE | `/api/orario/generazioni/:id`                    | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1146) |
| POST   | `/api/orario/generazioni/:id/pausa`              | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1152) |
| POST   | `/api/orario/generazioni/:id/tempo`              | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1159) |
| POST   | `/api/orario/generazioni/:id/bozza`              | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1170) |
| POST   | `/api/orario/generazioni/:id/risultato`          | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1180) |
| POST   | `/api/orario/genera`                             | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1204) |
| GET    | `/api/versioni`                                  | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1426) |
| GET    | `/api/versioni/:id/log`                          | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1443) |
| POST   | `/api/versioni`                                  | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1451) |
| POST   | `/api/versioni/:id/ripristina`                   | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1478) |
| PUT    | `/api/versioni/:id`                              | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1581) |
| DELETE | `/api/versioni/:id`                              | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1606) |
| GET    | `/api/orario/stato-pubblicazione`                | Sessione       | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1641) |
| POST   | `/api/orario/verifica-approvazione`              | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1663) |
| POST   | `/api/orario/approva`                            | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1671) |
| POST   | `/api/orario/ritira-pubblicazione`               | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/timetable.js#L1741) |

## workbook.js

| Metodo | Percorso                  | Accesso        | Codice                                                                               |
| ------ | ------------------------- | -------------- | ------------------------------------------------------------------------------------ |
| GET    | `/api/export/excel`       | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/workbook.js#L13) |
| GET    | `/api/export/excel-guida` | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/workbook.js#L31) |
| POST   | `/api/import/anteprima`   | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/workbook.js#L55) |
| POST   | `/api/import/conferma`    | Amministratore | [handler](https://github.com/lsponta/orario/blob/3bf5b58/src/routes/workbook.js#L69) |
