Skip to main content
This domain manages the scheduling infrastructure for bookable services. It exposes three resources: Availabilities (recurring weekly time windows during which a staff member accepts appointments), Unavailabilities (specific calendar dates on which a staff member is blocked), and Calendar Events (concrete scheduled events, including confirmed bookings). Admin routes require authentication; public routes can be called without a Bearer token but still require X-Company. Base URL https://api.genuka.com · Auth Authorization: Bearer <token> + X-Company: <companyId> · See Getting Started for shared conventions, pagination & error formats.

Endpoints at a glance


Availabilities

An Availability represents a recurring weekly window during which a staff member (user) is available for bookings. The store endpoint is a full replace — it deletes all existing availabilities for the user before inserting the new set.

GET /2023-11/admin/availabilities

List all weekly availability windows for a specific user. If user_id is not provided as a query parameter the authenticated user’s own availabilities are returned.
  • Query parameters:
Request example
Success response — 200 OK
Error responses
  • 404 Not Found — no user resolved (neither user_id param nor authenticated session)
  • 401 Unauthorized — missing or invalid Bearer token

POST /2023-11/admin/availabilities

Replace all weekly availability windows for a user. All existing availabilities for the given user_id are deleted before the new set is created.
  • Request body:
Request example
Success response — 201 Created Returns the full availability list for the user after the replace.
Error responses
  • 422 Unprocessable Entityuser_id missing or company_id not resolvable from request context
  • 404 Not Founduser_id does not correspond to a known user
  • 422 Unprocessable Entity — validation failure on availabilities array items (invalid day_of_week, H:i format, or end_time not after start_time)

GET /2023-11/admin/availabilities/{availability}

Retrieve a single availability window by its ULID.
  • Path parameters:
Request example
Success response — 200 OK
Error responses
  • 404 Not Found — availability with that ULID does not exist
  • 401 Unauthorized — missing or invalid Bearer token

PUT /2023-11/admin/availabilities/{availability}

Update a single availability window. All fields are required.
  • Path parameters:
  • Request body:
Request example
Success response — 200 OK
Error responses
  • 404 Not Found — availability ULID not found
  • 422 Unprocessable Entity — validation failure (missing required fields, bad time format, end_time not after start_time, day_of_week out of range 0–6)

DELETE /2023-11/admin/availabilities/{availability}

Delete a single availability window.
  • Path parameters:
Request example
Success response — 200 OK
Error responses
  • 404 Not Found — availability ULID not found
  • 500 Internal Server Error — deletion failed (e.g. database constraint)

GET /2023-11/availabilities

Public version of the availability list. Behaves identically to the admin list endpoint but does not require admin authentication. If user_id is omitted and no authenticated session is present, the request returns 404.
  • Query parameters:
Request example
Success response — 200 OK
Error responses
  • 404 Not Found — no user resolved

GET /2023-11/availabilities/slots

Calculate all available booking slots for a specific staff member, service, and calendar day. The algorithm:
  1. Checks if the user has an Unavailability record for the requested day — if so, returns an empty slots array with "unavailable": true.
  2. Retrieves existing CalendarEvent records for the user on that day.
  3. Iterates over the user’s Availability windows that match the day of the week.
  4. Splits each window into slots of service.duration_minutes, advancing by duration_minutes + buffer_minutes per step.
  5. Excludes any slot that overlaps an existing calendar event.
  6. Excludes slots whose end time is in the past (for the current day).
  • Query parameters:
Request example
Success response — 200 OK (slots available)
Success response — 200 OK (user unavailable that day)
Error responses
  • 404 Not Founduser_id or service_id not found, or no user resolved

GET /2023-11/availabilities/{availability}

Public version of the single availability show endpoint. Behaves identically to GET /2023-11/admin/availabilities/{availability}.
  • Path parameters:
Request example
Success response — 200 OK

Unavailabilities

An Unavailability marks a specific calendar date on which a staff member is not available for bookings (e.g. vacation, holiday, sick leave). Multiple dates can be created in a single request. The getDates endpoint returns a lightweight flat array of date strings for calendar UI rendering.

GET /2023-11/admin/unavailabilities

List unavailabilities for a user with optional date range filtering.
  • Query parameters:
Request example
Success response — 200 OK
Error responses
  • 404 Not Found — no user resolved
  • 401 Unauthorized — missing or invalid Bearer token

POST /2023-11/admin/unavailabilities

Create unavailability records for one or more dates. Duplicate dates for the same user are silently skipped (idempotent per date). Returns the full updated unavailability list for the user sorted by date ascending.
  • Request body:
Request example
Success response — 201 Created Returns the user’s complete unavailability list after the insert (including pre-existing records).
Error responses
  • 422 Unprocessable Entityuser_id or company_id missing, or dates array missing/empty
  • 404 Not Founduser_id does not correspond to a known user

POST /2023-11/admin/unavailabilities/bulk-delete

Delete unavailability records for a user by date. Only records whose date matches an entry in the dates array are deleted. Returns the count of deleted rows.
  • Request body:
Request example
Success response — 200 OK
Error responses
  • 422 Unprocessable Entity — validation failure (missing user_id or dates)

GET /2023-11/admin/unavailabilities/dates

Return a flat array of "Y-m-d" date strings for a user within an optional date range. Designed for calendar widget rendering where only blocked dates are needed, not full records.
  • Query parameters:
Request example
Success response — 200 OK
Error responses
  • 422 Unprocessable Entityuser_id not provided

GET /2023-11/admin/unavailabilities/{unavailability}

Retrieve a single unavailability record by ULID.
  • Path parameters:
Request example
Success response — 200 OK
Error responses
  • 404 Not Found — ULID not found
  • 401 Unauthorized — missing or invalid Bearer token

PUT /2023-11/admin/unavailabilities/{unavailability}

Update a single unavailability record. The date field is optional (sometimes); if omitted, only type and/or reason are updated.
  • Path parameters:
  • Request body:
Request example
Success response — 200 OK
Error responses
  • 404 Not Found — ULID not found
  • 422 Unprocessable Entitydate value is not a valid date

DELETE /2023-11/admin/unavailabilities/{unavailability}

Delete a single unavailability record.
  • Path parameters:
Request example
Success response — 200 OK
Error responses
  • 404 Not Found — ULID not found
  • 500 Internal Server Error — deletion failed

GET /2023-11/unavailabilities

Public version of the unavailability list. Accepts the same user_id, start_date, and end_date query parameters as the admin endpoint. Request example
Success response — 200 OK

GET /2023-11/unavailabilities/dates

Public version of the flat date list. Accepts user_id, start_date, end_date. Requires user_id. Request example
Success response — 200 OK

GET /2023-11/unavailabilities/{unavailability}

Public version of the single unavailability show endpoint.
  • Path parameters:
Request example
Success response — 200 OK

Calendar Events

A CalendarEvent is a concrete scheduled occurrence linked to a staff member (user) and optionally tied to an Order. It carries a start/end timestamp, an all-day flag, a status lifecycle, and a free-form source tag. The index endpoint is fully implemented with rich filtering and sorting via Spatie QueryBuilder. The remaining write endpoints (store, show, update, destroy) are registered as routes but are not yet implemented in the controller (empty method bodies).

GET /2023-11/admin/calendar-events

List calendar events with optional includes, filtering, sorting, and pagination.
  • Query parameters:
Request example
Success response — 200 OK Paginated collection wrapped in the standard pagination envelope. CalendarEventResource serializes all model fields, converts starts_at and ends_at to ISO 8601, and appends relations (universal polymorphic relations) and the user relationship when loaded.
Error responses
  • 401 Unauthorized — missing or invalid Bearer token
  • 403 Forbidden — invalid OAuth scope
  • 400 Bad Request — missing X-Company header

POST /2023-11/admin/calendar-events

Not yet implemented. The route is registered but the controller method body is empty. Calling this endpoint returns an empty 200 OK response with no body.

GET /2023-11/admin/calendar-events/{calendarEvent}

Not yet implemented. The route is registered but the controller method body is empty. Calling this endpoint returns an empty 200 OK response with no body.
  • Path parameters:
Response: 200 OK — empty body (stub). Expected response when implemented — 200 OK

PUT /2023-11/admin/calendar-events/{calendarEvent}

Not yet implemented. The route is registered but the controller method body is empty. Calling this endpoint returns an empty 200 OK response with no body.
  • Path parameters:
  • Expected request body (when implemented):
Response: 200 OK — empty body (stub).

DELETE /2023-11/admin/calendar-events/{calendarEvent}

Not yet implemented. The route is registered but the controller method body is empty. Calling this endpoint returns an empty 200 OK response with no body.
  • Path parameters:
Response: 200 OK — empty body (stub).