# PREXSELL API > REST API for the PREXSELL bus booking platform. ## Docs - [Current user](https://docs.prexsell.com/api-reference/auth/current-user.md): Returns the authenticated user's profile, active access context, and session details. Requires a valid access token cookie. - [Email login](https://docs.prexsell.com/api-reference/auth/email-login.md): Authenticates the user with email and password and creates a new session. Sets HTTP-only access and refresh token cookies on success. - [Google login](https://docs.prexsell.com/api-reference/auth/google-login.md): Authenticates the user using a Google ID token and creates a new session. Sets HTTP-only access and refresh token cookies on success. - [Google pre login](https://docs.prexsell.com/api-reference/auth/google-pre-login.md): Verifies a Google ID token and returns the matched user profile with all company contexts available for login. Does not create a session. - [Logout](https://docs.prexsell.com/api-reference/auth/logout.md): Revokes the current session and clears auth cookies. If the token is missing or already expired, cookies are still cleared and the response is 204. - [Logout all](https://docs.prexsell.com/api-reference/auth/logout-all.md): Requires a valid access token. Revokes every active session for the authenticated user across all devices, then clears cookies. - [Pre login](https://docs.prexsell.com/api-reference/auth/pre-login.md): Verifies email and password without creating a session. Returns the user identity and all company contexts the user can log into. Use the returned `companyId` values with the login endpoint. - [Refresh](https://docs.prexsell.com/api-reference/auth/refresh.md): Reads the refresh token from the HTTP-only cookie, rotates it, and issues a new access token. Detects token replay attacks and revokes the entire session family when detected. - [Switch company](https://docs.prexsell.com/api-reference/auth/switch-company.md): Updates the current session to operate in the context of a different company the user has access to. Issues a new access token scoped to the target company. - [Book booking](https://docs.prexsell.com/api-reference/bookings/book-booking.md): Marks targeted orders as Booked. Authenticated via the api-key header; data scoped to the caller's partner. 409 Conflict when any targeted order is already Booked, Paid, Canceled, or Refund. A Paid order is blocked from a Booked downgrade (getUpdatedBookedOrders would overwrite unconditionally). Sin… - [Cancel booking](https://docs.prexsell.com/api-reference/bookings/cancel-booking.md): Cancels targeted orders (status → Canceled; Paid PrexSell orders → Refund + refundAmount). Authenticated via the api-key header; data scoped to the caller's partner. 409 Conflict when any targeted order is already Canceled or Refund. Canceling a paid PrexSell order inside 24h of departure returns 40… - [Create booking](https://docs.prexsell.com/api-reference/bookings/create-booking.md): Creates a booking for one or more passengers. Authenticated via the api-key header; data scoped to the caller's partner. Returns 201 with the booking aggregate. offer token failures: expired → 400 OFFER_EXPIRED; malformed → 400 VALIDATION_ERROR. Undeclared body fields are rejected (strict body — dis… - [Get booking by ID](https://docs.prexsell.com/api-reference/bookings/get-booking-by-id.md): Returns a single booking by its booking ID. Authenticated via the api-key header; data scoped to the caller's partner. Returns 404 when the booking does not exist or does not belong to the actor's partner (foreign and unknown are indistinguishable — ADR-0033 §1). - [Get refund rules for a booking](https://docs.prexsell.com/api-reference/bookings/get-refund-rules-for-a-booking.md): Returns refund rules for each partner-owned order within a booking. Authenticated via the api-key header; data scoped to the caller's partner. Returns 404 when the booking does not exist or does not belong to the actor's partner. Fixes legacy defect 3 (IDOR) and defect 4 (500 on unknown ID). - [List bookings](https://docs.prexsell.com/api-reference/bookings/list-bookings.md): Returns a paginated list of the caller's bookings, newest first. Authenticated via the api-key header; data scoped to the caller's partner. Optionally filter to a single departure date, matched against the booking's UTC onboarding instant for that calendar day. Omit it to list all your bookings. Onl… - [Pay booking](https://docs.prexsell.com/api-reference/bookings/pay-booking.md): Marks targeted orders as Paid. Authenticated via the api-key header; data scoped to the caller's partner. 409 Conflict when any targeted order is already Paid, Canceled, or Refund. paymentRecipient is always Agent (FISCALIZE_ORDER gate must not become configurable). Returns the refreshed booking aft… - [Get a city by slug](https://docs.prexsell.com/api-reference/cities/get-a-city-by-slug.md): Returns a single city record identified by its unique slug. - [List cities](https://docs.prexsell.com/api-reference/cities/list-cities.md): Returns a paginated list of cities. Optionally filtered by name search string and/or country code. - [List stops for a city](https://docs.prexsell.com/api-reference/cities/list-stops-for-a-city.md): Returns a paginated list of bus stops belonging to the specified city. - [Toggle bus geolocation](https://docs.prexsell.com/api-reference/geolocation/toggle-bus-geolocation.md): Toggles geolocation tracking for an FmsObject scoped to the caller's company. Enabling registers a per-bus polling cron so tracking starts immediately; disabling removes it. Requires a valid backoffice access token with company context. - [Get schedule for a city pair on a date](https://docs.prexsell.com/api-reference/offers/get-schedule-for-a-city-pair-on-a-date.md): Returns a dated timetable of individual departures for the given city pair. Each row includes departure/arrival datetime (wall-clock, timezone-aware), company, route name, travel time, and price. Sorted by departure time ascending. Paginated with take/skip. - [Search bookable offers](https://docs.prexsell.com/api-reference/offers/search-bookable-offers.md): Returns bookable offers for the given city pair, date, and passenger count. Authenticated via the api-key header; data scoped to the caller's partner. Offer ids are 20-minute signed JWT booking tokens — use expiresAt to detect expiry before attempting to book. - [Create company orders report](https://docs.prexsell.com/api-reference/reports/create-company-orders-report.md): Enqueues an async CSV report of the authenticated company's orders over the specified date range. Returns 202 Accepted with the new report record. Poll GET /orders or fetch GET /orders/:id/download once status is Completed. The date range must not exceed 366 days. The company is resolved from the se… - [Download company order report](https://docs.prexsell.com/api-reference/reports/download-company-order-report.md): Mints a fresh 15-minute signed GCS URL for a Completed report. Returns 409 if the report is not yet Completed, 404 if not found or not owned by the authenticated company. - [List company order reports](https://docs.prexsell.com/api-reference/reports/list-company-order-reports.md): Returns a paginated list of order report records for the authenticated company, ordered by creation date descending. Does not include download URLs — fetch GET /orders/:id/download for a fresh signed URL. - [Get a stop by ID](https://docs.prexsell.com/api-reference/stops/get-a-stop-by-id.md): Returns a single bus stop record including coordinates and an embedded city summary. - [List stops](https://docs.prexsell.com/api-reference/stops/list-stops.md): Returns a paginated list of bus stops across all cities. Optionally filtered by city ID or country code. - [Getting started with the Distribution API](https://docs.prexsell.com/guides/distribution-getting-started.md): First integration walkthrough for partners: find cities, search offers, create a booking, and manage it through pay, book, and cancel. - [Migrating from /rest to /v2](https://docs.prexsell.com/guides/rest-to-v2-migration.md): Step-by-step guide for external partners moving from the legacy /rest endpoints to the v2 Distribution API. - [Introduction](https://docs.prexsell.com/introduction.md): REST API for the PREXSELL bus booking platform. ## OpenAPI Specs - [openapi](https://docs.prexsell.com/api-reference/openapi.json)