AssistBot knowledge base

TGbot Cafe API: hall occupancy

Version 1. Access via an individual business key.

The TGbot Cafe booking calendar API returns busy intervals for all halls connected to a business. A website or another application can use them to display an availability calendar. This is a read-only method: it does not support creating or modifying bookings, taking payments or reserving time. Responses exclude customer names and phone numbers, comments, services, amounts and internal document numbers.

Download the OpenAPI 3.0.3 contract

Method and access

ParameterValue
MethodGET /api/v1/availability
Base URLhttps://tgbotcafe.assistbot.ru
AuthorizationAuthorization: Bearer and an individual business key
Response formatapplication/json
Rate limit60 requests per minute per IP; shared with other API requests

The API administrator issues the key after connecting the business. Its format is the prefix arma_avail_ followed by 64 hexadecimal characters. This is a separate TGbot Cafe key; AssistBot messaging API tokens do not work for this method. One key opens only the assigned business's calendar and does not grant access to the admin panel or payment operations.

Send HTTPS requests from your application's server. Store the key in a private server configuration; do not include it in HTML, browser JavaScript or the request URL. If it is exposed, ask the administrator to revoke it and issue a new one. The key determines the business; query parameters cannot change it.

Query parameters

FieldRequiredFormat
fromYesRange start: 2026-10-15T00:00:00+03:00
toYesRange end: 2026-10-17T00:00:00+03:00
  • RFC3339 with whole seconds and an explicit time zone is required: an offset, for example +03:00, or Z. The maximum offset is ±14:00. Fractional seconds, dates without a time and times without a time zone are not accepted.
  • The range is expressed as [from, to): the start is inclusive and the end exclusive. The end must be later than the start, with a duration no greater than 31 × 24 hours, or 2 678 400 seconds.
  • Only the following are allowed: from and to. Selecting a business or filtering halls is not supported: the response includes all configured halls for the business.
  • Encode the + character as %2B. Use a query builder or --data-urlencode.

Example for a connected business. The variable AVAILABILITY_KEY contains the issued key:

curl --fail-with-body --get 'https://tgbotcafe.assistbot.ru/api/v1/availability' \
  --header "Authorization: Bearer ${AVAILABILITY_KEY}" \
  --header 'Accept: application/json' \
  --data-urlencode 'from=2026-10-15T00:00:00+03:00' \
  --data-urlencode 'to=2026-10-17T00:00:00+03:00'

Response and example

A fictional example of a business with six halls. Other connections may have different hall lists and codes. The first booking crosses midnight:

{
  "version": 1,
  "source": "admin_calendar",
  "timezone": "Europe/Moscow",
  "from": "2026-10-15T00:00:00+03:00",
  "to": "2026-10-17T00:00:00+03:00",
  "generated_at": "2026-10-13T13:20:00+03:00",
  "data_updated_at": "2026-10-13T12:45:00+03:00",
  "freshness": "live",
  "complete": false,
  "incomplete_reasons": ["calendar_not_authoritative"],
  "halls": [
    {"hall_id": "armaloft", "name": "ArmaLoft Hall", "busy_intervals": [
      {"starts_at": "2026-10-15T22:00:00+03:00", "ends_at": "2026-10-16T02:00:00+03:00"}
    ]},
    {"hall_id": "mercury", "name": "Mercury Hall", "busy_intervals": []},
    {"hall_id": "airplane", "name": "Airplane Hall", "busy_intervals": []},
    {"hall_id": "rufer", "name": "Rufer Hall", "busy_intervals": []},
    {"hall_id": "pulka", "name": "Pulka Hall", "busy_intervals": []},
    {"hall_id": "boho", "name": "Boho Hall", "busy_intervals": []}
  ]
}
FieldMeaning
version, sourceVersion 1, source admin_calendar — the admin panel calendar.
timezone, from, toTime zone Europe/Moscow. Dates use RFC3339 with the Moscow offset applicable to that date: currently +03:00; historically it may differ, for example +04:00 in 2012.
generated_atThe time when reading the consistent calendar snapshot began.
data_updated_atThe last modification to retained calendar entries or configured hall descriptions, including cancelled entries and dates outside the requested range. May be null. This is neither a revision number nor the time of the last external synchronization; deleting a booking does not create a new timestamp of this kind.
freshnesslive — the current database snapshot without response caching. The value itself does not confirm completeness of external sources.
complete, incomplete_reasonsSource completeness. When false , the reason is calendar_not_authoritative; when true , the reasons array is empty.
halls[].hall_id, nameThe hall's stable public code and current name. Renaming does not change the code.
busy_intervals[].starts_at, ends_atThe start and end of the busy interval, including date and time zone.

How to determine available times

When complete=false the absence of a busy interval does not mean a hall is available: some bookings may still exist in an external source. You can mark known busy periods but cannot confirm availability for the remaining hours. Even HTTP 200 and an empty array do not confirm availability in this case.

Before displaying available times, check HTTP 200, version=1, source=admin_calendar, freshness=live, complete=true and the complete expected list of halls. In case of an error or incomplete calendar, display “Availability temporarily unconfirmed”; do not substitute an empty calendar for that response.

  • Busy intervals are sorted; overlapping and adjacent intervals are merged. Original boundaries are retained even if a booking starts before from or ends after to.
  • A booking is included when starts_at < to and ends_at > from. An adjacent booking may start exactly when the preceding one ends.
  • Cancelled bookings are excluded. A no-show, lack of payment or a free viewing does not by itself release the time. Minutes and overnight intervals are preserved without rounding to hours.

Method responses include the directive no-store in the Cache-Control, for example no-store, private; the header may contain additional valid directives. Do not cache responses as confirmed availability. One request is enough for all halls. Reading the calendar does not reserve the selected time: another user may create a booking after the response. The method does not synchronize external calendars or automatically replace the existing booking creation process.

Errors

Authorization, parameter and calendar reading errors return a short JSON response:

{"error":{"code":"calendar_unavailable"}}
HTTPCode / reasonAction
401unauthorized: the key is missing, invalid, revoked or passed in the query; the business connection is inactive.Check the key with the API administrator.
422invalid_range: invalid dates, or an empty, reversed or excessively large range.Correct from and to.
422unsupported_parameter: an extra query parameter.Keep only from and to.
503calendar_unavailable: a valid calendar cannot be obtained. An unavailable hall is never replaced with an empty availability list.Show temporary unavailability.
405Unsupported method; standard server response.Use GET. Do not rely on the JSON structure described above.
429Shared rate limit exceeded; standard server response.Wait for the duration specified in Retry-After and reduce the request frequency.

Any other response, including 500, also does not confirm availability. Standard 405 and 429 responses are not guaranteed to follow the calendar error format. HEAD is allowed with the same authorization and headers and no body; it is not a separate second API method.

ASSISTBOT IS HERE TO HELP

Let's discuss your requirements

Choose your preferred messenger. We will help with connection, setup and questions about AssistBot.

Or contact us:
+7 926 179-03-39 · info@assistbot.ru

Send a message