# Altegio

## What it is

**Altegio** is an international online-booking and business management platform for beauty salons, barbershops, clinics, fitness studios and other service businesses. It is the international version of YCLIENTS. The integration uses Altegio's public online-booking API: the bot shows a location's services and team members, finds free dates and times, books the client and cancels the booking. The booking shows up in the location's schedule right away.

## Requirements

- A location in [Altegio](https://alteg.io) with online booking enabled: services and team members must be available for online booking.
- A **partner token** — issued after developer registration in the [Altegio Marketplace](https://app.alteg.io/appstore/developers/1). The app that owns the token must have access to your location.
- The **location ID** — the number in the Altegio dashboard URL.

## How to connect

1. Register as a developer in the Altegio Marketplace and copy the partner token.
2. Copy the location ID from the Altegio dashboard URL.
3. In the constructor, open **Integrations** → find the **Altegio** card → **Connect**.
4. Fill in the **Partner token** and **Location ID** fields.
5. Save the connection and click **Check connection**. The button requests the online-booking service list and shows how many services were found.

## Available operations

| Operation | What it does |
|---|---|
| List services | Online-booking services: ID, title, price from/to, duration. Can be filtered by team member |
| List team members | Online-booking team members: ID, name, specialization, rating. Can be filtered by service and time |
| Available dates | Dates with free time, taking the service and team member into account |
| Available times | Free slots on the chosen date; without a team member — with anyone available |
| Create booking | Checks the slot and books the client (name, phone, email, comment). Returns the booking ID and hash |
| Cancel booking | Cancels a booking by its ID and hash |

## Limitations

- Operations only see services and team members that are open for online booking in the location settings.
- One connection works with one location. For a chain, create a separate connection per location.
- Altegio rate-limits requests: 200 per minute and 5 per second per IP. Don't call lists in a loop — store the result in variables.
- If the location requires confirming the client's phone with an SMS code, Altegio rejects bookings without the code. Turn phone confirmation off in the online-booking settings to book through the bot.
- Client lookup, visit history and rescheduling are not part of the public online-booking API.
- Dates and times use ISO 8601. To create a booking, use the `datetime` field from the «Available times» result.

## Notes

> A typical booking flow: «List services» → «Available times» for the chosen date → «Create booking».

> Store `record_id` and `record_hash` from «Create booking» in the client's variables — the bot needs them to cancel the booking.

> If the chosen slot has already been taken, Altegio returns an error at the check step and no booking is created. Offer the client another time from «Available times».
