Skip to content

API reference

Availability

Recurring availability patterns and on-demand availability checks. Define when entities are bookable, then ask the engine for valid slots.

Key points

  • Availability has two surfaces: ad-hoc availability checks and persistent patterns
  • Patterns are recurring (weekly schedules) or blackout (vacation, holidays)
  • Higher-priority patterns override lower-priority ones — useful for layering exceptions on top of defaults
  • POST /availability/check is the primitive used by Bookings and Suggestions internally

About availability

Two distinct concepts share this resource:

  • Patterns — persistent records describing when an entity is or isn’t bookable. Recurring schedules (Mon-Fri 9-5), one-off blackouts (vacation, holidays), capacity-bounded windows.
  • Checks — ad-hoc queries asking “is this entity available for this kind of event in this time range?”. Returns ranked slots.

Most integrations use Bookings for the high-level flow rather than calling availability check directly. The check endpoint exists for cases where you need finer control or the slot data without committing to a booking.

Check availability

POST/api/v1/availability/check

Find available time slots ranked by constraint satisfaction. Pre-allocates resources without committing them.

Headers

  • x-organization-idUUIDrequired

    Organization scope

  • x-template-idstringrequired

    Template ID

Request body

Required: eventType, primaryEntity, timePreferences, durationMinutes. Required participants and resources are optional filters.

{
  "eventType": "home_visit",
  "primaryEntity": {
    "entityId": "ent_pt_9001",
    "entityType": "participant"
  },
  "requiredResources": [
    {
      "resourceType": "transport_vehicle",
      "quantity": 1
    }
  ],
  "timePreferences": {
    "preferredStart": "2026-05-08T10:00:00Z",
    "flexibilityDays": 7,
    "timeOfDay": ["morning", "early_afternoon"]
  },
  "durationMinutes": 60,
  "limit": 10
}

Responses

200Available slots and any overlapping blocked periods that limited the result set
{
  "slots": [
    {
      "startTime": "2026-05-08T10:00:00Z",
      "endTime": "2026-05-08T11:00:00Z",
      "score": 0.95,
      "allocatedResources": [
        { "entityId": "res_van_2", "resourceType": "transport_vehicle" }
      ]
    }
  ],
  "blockedPeriods": [
    {
      "start": "2026-05-08T13:00:00Z",
      "end": "2026-05-08T15:00:00Z",
      "reason": "blackout_pattern"
    }
  ]
}
400Invalid request body — validation failed

Check is read-only

Calling check does not reserve the slots — they remain available until something actually books them. Two parallel callers can both see the same slot as available; whichever creates first wins. This is by design (check should be cheap) but means you should call create promptly after check.

Create pattern

POST/api/v1/availability/patterns

Define a recurring availability or blackout pattern for an entity.

Headers

  • x-organization-idUUIDrequired

    Organization scope

Request body

Required: entityId, patternType, startTime, endTime. Day-of-week and date ranges scope the pattern’s applicability.

{
  "entityId": "ent_staff_a8f4",
  "patternType": "recurring",
  "patternName": "Standard weekday shift",
  "dayOfWeek": [1, 2, 3, 4, 5],
  "startTime": "09:00",
  "endTime": "17:00",
  "startDate": "2026-01-01",
  "endDate": "2026-12-31",
  "priority": 100,
  "capacity": 1,
  "timezone": "America/New_York"
}

Responses

201Pattern created
{
  "id": "pat_a8f4c2d1-...",
  "entityId": "ent_staff_a8f4",
  "patternType": "recurring",
  "patternName": "Standard weekday shift",
  "dayOfWeek": [1, 2, 3, 4, 5],
  "startTime": "09:00",
  "endTime": "17:00",
  "isActive": true,
  "priority": 100,
  "createdAt": "2026-04-26T15:30:00.000Z"
}
400Invalid request body — validation failed

List patterns

GET/api/v1/availability/patterns

Paginated list of patterns with rich filters.

Headers

  • x-organization-idUUIDrequired

    Organization scope

Query parameters

  • entityIdUUID

    Filter to one entity

  • patternTypeenum

    recurring or blackout

  • blockReasonstring

    Filter blackouts by reason (e.g. vacation, holiday)

  • isActiveboolean

    Filter by active flag

  • effectiveDatedate

    Patterns effective on this date

  • startDateFromdate

    Patterns starting on or after this date

  • startDateTodate

    Patterns starting on or before this date

  • endDateFromdate

    Patterns ending on or after this date

  • endDateTodate

    Patterns ending on or before this date

  • dayOfWeekinteger

    Filter by ISO day of week (1=Mon, 7=Sun)

  • minPriorityinteger

    Minimum priority

  • limitinteger

    Default 20, max 100

  • offsetinteger

    Default 0

  • orderBystring

    priority, startDate, or createdAt

  • orderDirectionenum

    asc or desc

Responses

200List of matching patterns

Get pattern

GET/api/v1/availability/patterns/{patternId}

Retrieve a single pattern by ID.

Headers

  • x-organization-idUUIDrequired

    Organization scope

Path parameters

  • patternIdstringrequired

    Pattern ID

Responses

200Pattern returned
{
  "id": "pat_a8f4c2d1-...",
  "entityId": "ent_staff_a8f4",
  "patternType": "recurring",
  "patternName": "Standard weekday shift",
  "dayOfWeek": [1, 2, 3, 4, 5],
  "startTime": "09:00",
  "endTime": "17:00",
  "isActive": true,
  "priority": 100,
  "createdAt": "2026-04-26T15:30:00.000Z"
}
404Pattern not found

Update pattern

PUT/api/v1/availability/patterns/{patternId}

Modify pattern fields. Times, dates, priority, and active state are all mutable.

Headers

  • x-organization-idUUIDrequired

    Organization scope

Path parameters

  • patternIdstringrequired

    Pattern to update

Responses

200Pattern updated successfully
404Pattern not found

Delete pattern

DELETE/api/v1/availability/patterns/{patternId}

Hard-delete a pattern. Existing events are not modified, but new bookings will no longer respect this pattern.

Headers

  • x-organization-idUUIDrequired

    Organization scope

Path parameters

  • patternIdstringrequired

    Pattern to delete

Responses

200Pattern deleted successfully
404Pattern not found

Pattern types

The two pattern types behave differently:

Recurring patterns

Define when an entity is available. Day-of-week + time-of-day. The most common pattern — a staff member’s regular schedule, a clinic’s operating hours, a room’s booking window.

Higher priority overrides lower priority. A staff member might have a base recurring pattern at priority 100 (Mon-Fri 9-5) and a Wednesday-late-start pattern at priority 200 (Wed 11-5). The higher-priority pattern wins on Wednesdays.

Blackout patterns

Define when an entity is not available, regardless of recurring patterns. Vacations, holidays, training days, system maintenance windows.

Blackouts always win over recurring patterns when they overlap — that’s the point. Use blockReason to categorize them for analytics.

{
  "entityId": "ent_staff_a8f4",
  "patternType": "blackout",
  "patternName": "Vacation",
  "blockReason": "vacation",
  "startDate": "2026-07-01",
  "endDate": "2026-07-14",
  "priority": 200
}

Don’t set capacity unless you mean it

Patterns default to capacity 1 — meaning the entity can be booked once per overlapping slot. For shared resources (a treatment room that can host two participants simultaneously, a vehicle with multiple seats) set capacity higher. The engine prevents over-allocation against the configured capacity.