Ultima verifica: 11 ottobre 2026
PRO workspaces can issue a one-time API access key to call ShiftScheduler's built-in REST endpoints directly. The key authenticates requests to the same server-side routes that power the web application, so you always receive normalized JSON responses.
Solo gli amministratori dell’area possono gestire le chiavi. L’organizzazione deve avere almeno una licenza a pagamento per generare o usare una chiave API REST; la sola prova gratuita non basta. Le chiavi hanno privilegi equivalenti a quelli di un amministratore nella propria area.
Only one API access key can exist per workspace. Regenerating a key immediately invalidates the previous value.
All API requests must include the key in the Authorization header using the Bearer scheme:
curl https://shiftscheduler.ai/api/persons \
-H "Authorization: Bearer <YOUR_API_ACCESS_KEY>"Per richieste tra server, inviare la chiave Bearer senza cookie di sessione del browser. Una sessione valida ha la precedenza e usa i propri permessi. Un corpo JSON richiede Content-Type: application/json; una richiesta senza corpo non lo richiede.
Gli errori di autenticazione restituiscono 401. Una chiave valida senza accesso a pagamento restituisce 403. Anche permessi e limiti di licenze possono restituire 403; i conflitti 409 e i dati non validi generalmente 400. Gli errori contengono una stringa error. Una licenza non aggira i limiti di persone dell’organizzazione.
Use the REST API access key—not an MCP key or webhook secret. The response is a JSON object whose locations property is the array of locations; it is not a bare array.
curl https://shiftscheduler.ai/api/locations \
-H "Authorization: Bearer <YOUR_API_ACCESS_KEY>" \
-H "Accept: application/json"{
"locations": [
{
"id": "66f01234567890abcdef1234",
"title": "Ward A",
"sortOrder": 1,
"weeklyTemplate": []
}
]
}Collection reads use matching envelopes: persons, locations , or shifts. A missing, invalid, revoked, or regenerated key returns 401 with a JSON error message.
The following endpoints accept bearer authentication. Payloads use camelCase fields, and responses always return the normalized ShiftScheduler shape.
| Metodo | Endpoint | Note |
| --- | --- | --- |
| GET, POST | `/api/persons` | Elencare o creare persone. |
| GET, PUT, DELETE | `/api/persons/{id}` | Leggere, aggiornare parzialmente o eliminare una persona e i record dipendenti. |
| POST | `/api/persons/reorder` | Riordinare con orderedIds; non disponibile con ordinamento alfabetico. |
| POST | `/api/persons/{id}/access` | Gestire l’accesso con action: invite, cancel-invite o revoke. Gli inviti inviano e-mail. |
| GET, POST | `/api/locations` | Elencare o creare sedi. |
| GET, PUT, DELETE | `/api/locations/{id}` | Leggere, aggiornare o eliminare una sede e i suoi turni. |
| POST | `/api/locations/reorder` | Riordinare con orderedIds; non disponibile con ordinamento alfabetico. |
| GET, POST | `/api/shift-templates` | Elencare o creare modelli dell’area di lavoro. |
| GET, PUT, DELETE | `/api/shift-templates/{id}` | Leggere, aggiornare o eliminare un modello; i riferimenti possono impedirne l’eliminazione (409). |
| POST | `/api/shift-templates/{id}` | Visualizzare l’impatto di una modifica al modello senza salvarla. |
| GET, PUT, DELETE | `/api/location-day-schedules` | GET: locationIds/locationId, from, to. PUT: locationId, date, slots. DELETE: parametri locationId e date. |
| GET, POST, DELETE | `/api/shifts` | GET: locationId, personId, date, from, to. POST: creare. DELETE: corpo JSON con id. |
| PUT | `/api/shifts/{id}` | Aggiornare parzialmente un turno. |
| GET, DELETE | `/api/schedule-draft` | Leggere la bozza condivisa; includeChanges=true aggiunge descrizioni sicure. DELETE elimina l’intera bozza. |
| POST | `/api/schedule-draft/publish` | Pubblicare atomicamente tutte le modifiche in sospeso. |
| GET, PUT | `/api/person-preferences` | GET: personIds/personId, from, to. PUT: personId, date, preference; un valore vuoto cancella la preferenza. |
| GET, POST | `/api/timeoff/requests` | GET: status (requested predefinito; archived include approved/rejected). POST: personId, date, typeId; gli orari provengono dal modello. |
| PUT | `/api/timeoff/requests/{id}` | Aggiornare nota/data o action: approve/reject. Modello e orari non sono modificabili. |
| GET | `/api/timeoff/allowances` | Leggere i saldi delle assenze visibili. |
| GET, POST | `/api/timeoff/grants` | GET richiede personId. POST: personId, typeId, hours, note facoltativa. |
| DELETE | `/api/timeoff/grants/{id}` | Annullare un’assegnazione; il record resta fino all’eliminazione della persona. |
| GET | `/api/overview` | Riepilogo con date start/end facoltative. |
| GET, PUT | `/api/workspace/ai-settings` | Leggere le regole IA; PUT sostituisce rules o esegue l’azione supportata. |
| PATCH | `/api/workspace/rules/reset-interpretation` | Reimpostare l’interpretazione con ruleId. |I campi delle risposte variano: persons, locations, shifts, schedules, preferences (con quotas), data (modelli e richieste di assenza), grants (con summary) o allowances. Non sono array senza contenitore. Anche le risposte alle scritture variano in base all’endpoint.
Solo POST /api/shifts, DELETE /api/shifts, PUT /api/location-day-schedules, PUT /api/person-preferences e POST /api/timeoff/requests accettano un { items: [...] }.
I risultati dei lotti mantengono l’ordine e includono successCount, failureCount, mutationCount e results. Un lotto accettato restituisce HTTP 200 anche se alcuni o tutti gli elementi falliscono. Controllare ok e status di ogni risultato; HTTP 200 da solo non indica successo.
Time Off responses include createdAt, the daily request order, and approval or rejection audit references. Queue order spans pending, approved, and rejected requests for the same calendar day.
If Draft Schedule is enabled for the workspace, API shift reads and regular-shift writes use the shared working schedule. Writes do not notify members or emit shift webhooks until the draft is published. Publishing applies every pending change together; deleting the draft discards it in full. Time Off operations remain immediate, and API keys have admin-equivalent permission to publish or discard.
To review the shared draft without exposing raw shift snapshots, call GET /api/schedule-draft?includeChanges=true. The optional changes array contains the operation type, document ID, label, and localized history descriptor parameters for each pending shift, ordered by schedule date.
GET /api/shifts accepts optional locationId, personId, from , and to query parameters to refine the list. Provide a single date to fetch everything on/after or on/before that day, or pass both to limit results to a window. When no filters are provided, you receive every shift in the workspace.
Write endpoints accept the same payloads the web app uses internally. The examples below demonstrate how to create each entity with typical fields.
Le modifiche a persone, sedi o modelli invalidano le interpretazioni delle regole IA. Eliminare persone o sedi elimina i dati di pianificazione dipendenti. Le modifiche ai modelli possono richiedere opzioni di propagazione; visualizzarne prima l’impatto. Usare un’area di test per provare le scritture.
curl -X POST https://shiftscheduler.ai/api/persons \
-H "Authorization: Bearer <YOUR_API_ACCESS_KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "Jordan Weaver",
"invited": false
}'Set invited=true to trigger an email invitation. The server sanitises any membership payload before persisting.
To add someone without inviting them yet, omit invited (or set it to false) and skip the membership block—the person will be created without any access assigned.
Membership settings require invited=true and a valid email. The optional membership.role may be admin, manager , or member; it defaults to member. Supplying membership settings without requesting an invitation returns a validation error.
Responses include the normalised membership snapshot (status, invite email, and timestamps) so you can confirm what was persisted.
curl -X POST https://shiftscheduler.ai/api/locations \
-H "Authorization: Bearer <YOUR_API_ACCESS_KEY>" \
-H "Content-Type: application/json" \
-d '{
"title": "Ward A",
"weeklyTemplate": []
}'curl -X POST https://shiftscheduler.ai/api/shifts \
-H "Authorization: Bearer <YOUR_API_ACCESS_KEY>" \
-H "Content-Type: application/json" \
-d '{
"location": "LOCATION_ID",
"person": "PERSON_ID",
"date": "2026-10-20",
"startTime": "09:00",
"endTime": "17:00",
"note": "Internal workshop prep and handoff"
}'