Resource availability — availabilityRule query
Integrations can fetch a persisted clinician availability or unavailability block by ID through the public API.
Affected query: availabilityRule
Availability: Practices using the New Semble Appointment System only. The query is not available on the legacy appointment system.
Summary
availabilityRule returns a single ResourceAvailability row under data, identified by the id returned from createAvailability or stored from a prior sync.
Use it to:
- Confirm what was persisted after creating availability or unavailability
- Re-read recurrence, exclusions, and date/time fields for a known rule ID
- Resolve rule metadata (
comment,unavailability,user,room, audit fields) without listing all rules
This query returns the stored rule definition, not computed bookable slots. For slot-based reads, use availabilitySlots.
Input
QueryAvailabilityRuleInput has one required field:
| Field | Required | Notes |
|---|---|---|
id | yes | Resource availability ID |
Response
The payload shape is ResourceAvailabilityRuleQueryPayload:
{
availabilityRule(data: { id: "RULE_ID" }) {
data {
id
comment
unavailability
resourceType
user {
id
}
room {
id
}
recurrence {
frequency
interval
daysOfTheWeek
}
exclusions
startDate
endDate
startTime
endTime
createdAt
updatedAt
createdBy
lastUpdatedBy
}
}
}
Field behaviour matches createAvailability:
unavailability—falsefor availability (bookable time);truefor unavailability (blocked time).recurrence—nullfor ad-hoc rules; populated for recurring availability (frequency,interval,daysOfTheWeek).exclusions— ISO 8601 UTC instants for dates skipped within a recurrence rule; empty array when none.startDate/endDate/startTime/endTime— persisted calendar and daily window values (YYYY-MM-DDandHH:mm).user/room— clinician and practice location for the rule.createdAt/updatedAt/createdBy/lastUpdatedBy— audit metadata for the row.
Examples
Fetch an ad-hoc availability rule
query GetAvailabilityRule($data: QueryAvailabilityRuleInput!) {
availabilityRule(data: $data) {
data {
id
comment
unavailability
recurrence {
frequency
interval
daysOfTheWeek
}
startDate
endDate
startTime
endTime
user {
id
}
room {
id
}
}
}
}
Variables:
{
"data": {
"id": "RULE_ID"
}
}
For ad-hoc availability created with createAvailability, expect unavailability: false and recurrence: null.
Fetch a recurring availability rule
Use the same query with the id from a recurring createAvailability call. Expect recurrence with frequency: weekly, a positive interval, and at least one entry in daysOfTheWeek (0 = Sunday through 6 = Saturday). exclusions lists any skipped dates as ISO 8601 strings.
Fetch an ad-hoc unavailability rule
Query by the id of a row created with unavailability: true. Expect recurrence: null and unavailability: true.
Validation errors
| Situation | Message (summary) |
|---|---|
Missing id | Field "id" of required type "ID!" was not provided |
Invalid id format | ID must be a valid ID |
| Unknown or other-practice rule | Resource availability with id "…" not found. |
Rules are scoped to the authenticated practice. A valid ObjectId that does not exist in the practice returns the not-found error.
Permissions
The query requires the settingsAvailabilities permission (same as createAvailability).
Integration guidance
- Store
idfromcreateAvailability: Use the mutation responsedata.idas the lookup key untilavailabilityRules(list) is available. - Do not use for slot discovery: Prefer
availabilitySlotswhen you need computed availability windows for booking flows. - Idempotent reads: Safe to retry; the query does not mutate state.
See also
- API reference:
availabilityRule - API reference:
ResourceAvailability - Release notes:
createAvailability - How-to: Get started with the New Semble Appointment System