Create a timetable with its lessons
Creates a timetable kept in WorkRoad with its periods and every day's lessons in one call, as the app's setup does: the first timetable becomes the default, and the days with lessons are the days it shows. Use it to save a timetable you read from a photo, a PDF or what the user typed; it uses no AI. Link lessons to the user's subjects with subjectId or subjectName, and list the subjects first (GET /subjects) so the names match. The timetable is saved whole or not at all.
Use this to save content you wrote yourself. It uses none of the user's WorkRoad AI uses.
Required scopes: schedule:create
AuthorizationBearer <token>Idempotency-Key?stringA client-generated key (1 to 255 visible ASCII characters) that makes this POST safe to retry. A retry with the same key and body replays the original response; the same key with a different body returns 409 idempotency_conflict. Stored for 24 hours.
^[\x21-\x7E]{1,255}$1 <= length <= 255application/json- body
name*string2-64 characters. Unique among the user's active schedules.
2 <= length <= 64scheduleType*stringdefined: every day shares one grid of periods, and each day lists one entry per period (null for a free period). dynamic: no periods; each day lists its lessons, each with timeStart and timeEnd.
"defined""dynamic"firstDay?integerThe weekday the timetable starts on, which is the first entry of days. Defaults to 1 (Monday).
0 <= value <= 6periods?array<>defined only: 1-30 periods, in order, not overlapping.
1 <= items <= 30days*array<array<|null>>One entry per weekday from firstDay, up to 7: the day's lessons in order. For a defined timetable every day has exactly one entry per period. A day with no lessons is an empty list (dynamic) or all null (defined), and days left off the end are free.
1 <= items <= 7createSubjectsIfMissing?booleanCreates a subject for each subjectName the user doesn't have yet, so the lessons link to it. Needs the subjects:create scope.
Created
application/json- response
data*curl -X POST 'https://workroad.app/api/v1/schedules/timetable' \ -H 'Authorization: Bearer $WORKROAD_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "name": "string", "scheduleType": "defined", "days": [ [ {} ] ]}'{ "data": { "id": "4d3c2b1a-0f9e-4d8c-8b7a-6f5e4d3c2b1a", "name": "Year 12", "type": "DEFINED", "external": null, "owned": true, "editable": true, "firstDay": 1, "selectedDays": [ 1, 2, 3, 4, 5 ], "issue": null, "structure": { "periods": [ { "index": 0, "name": "Period 1", "start": "09:00", "end": "10:00" }, { "index": 1, "name": "Period 2", "start": "10:00", "end": "11:00" } ] }, "days": [ { "day": 1, "elements": [ { "id": "6e5d4c3b-2a19-4f08-9e7d-6c5b4a392817", "period": 0, "lessonName": "Biology", "subjectId": "5f0c1d2e-3a4b-4c5d-8e6f-7a8b9c0d1e2f", "subjectLabel": null, "room": "S2", "teacher": "Dr Patel", "timeStart": null, "timeEnd": null }, { "id": "7f6e5d4c-3b2a-4190-8f8e-7d6c5b4a3928", "period": 1, "lessonName": null, "subjectId": null, "subjectLabel": null, "room": null, "teacher": null, "timeStart": null, "timeEnd": null } ] } ] }}