Shift presets

Returns the organization's shift presets — a reference of time templates ("Morning", "Evening", "Flexible") that the shift_preset_id field of schedule entries points to.

Scope

No scope required — this is a reference resource with no secrets, available to any valid key for the organization, regardless of its scopes (see Scopes and permissions → Reference resources without a scope). The reference is needed to interpret schedule entries, so it's open with no additional conditions.

Query parameters

Parameter Required Description
limit no Integer 1..200, defaults to 100.
cursor no The meta.next_cursor value from the previous response — for the next page.

from/to, department_id, and employee_id are not supported on this resource: passing any of them returns 400 validation_error (the parameter is explicitly rejected, not silently ignored — see Conventions → Filters). This is a reference resource with no time dimension and no department attachment.

Request

curl -s https://smengo.com/api/v1/shift-presets \
  -H "Authorization: Bearer smg_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

With a smaller page size:

curl -s "https://smengo.com/api/v1/shift-presets?limit=50" \
  -H "Authorization: Bearer smg_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

Response

{
  "data": [
    {
      "id": "3f8e2a1c-6b5d-4e9f-a2c1-7d8e9f0a1b2c",
      "label": "Утро",
      "start_time": "08:00:00",
      "end_time": "16:00:00",
      "is_flexible": false,
      "color": "#22c55e",
      "sort_order": 1
    },
    {
      "id": "5a7c9e1b-3d6f-4c8a-9b2d-0e4f6a8c1d35",
      "label": "Гибкая",
      "start_time": null,
      "end_time": null,
      "is_flexible": true,
      "color": "#a3e635",
      "sort_order": 2
    }
  ],
  "meta": { "next_cursor": null }
}

Response fields

Field Type Description
id string (uuid) The preset's unique identifier; shift_preset_id in Schedule entries points to it.
label string The preset's name.
start_time string (HH:MM:SS) | null Shift start — in the organization's timezone, not UTC (the timezone is in GET /org, the timezone field).
end_time string (HH:MM:SS) | null Shift end — also in the organization's timezone.
is_flexible boolean Whether the shift is flexible — with no fixed start and end times.
color string The preset's color in hex (#22c55e); never null.
sort_order number (int) The position in the list; the list is sorted by this field (plus id as a tiebreaker). Unlike status types, here the field is present in the response.

A null/null pair in start_time/end_time is normal, not missing data — that's what a flexible shift (is_flexible: true) looks like: it has no fixed times, and the concrete time is set by the schedule entry itself or not fixed at all.

Pagination

The list is sorted by sort_order, id. If there are more presets than limit, meta.next_cursor holds a cursor for the next page — pass it verbatim as cursor on the next request:

curl -s "https://smengo.com/api/v1/shift-presets?limit=1&cursor=eyJrIjoxLCJpZCI6IjNmOGUyYTFjLTZiNWQtNGU5Zi1hMmMxLTdkOGU5ZjBhMWIyYyJ9" \
  -H "Authorization: Bearer smg_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

meta.next_cursor is null once there are no more presets. Full pagination rules are in Conventions → Pagination.

What's next

  • Schedule entries — where shift_preset_id points to presets.
  • Status types — the other reference resource for interpreting the schedule.
  • Organization — the timezone start_time/end_time are interpreted in.
Was this article helpful?