Use OpenAPI Generator to scaffold a typed, ready-to-use client from the Bookable Bookings API spec. This removes the need to hand-write HTTP calls, models, or serialization logic.
OpenAPI Generator requires Java 11+ to run. Install it once, then use either the CLI wrapper or the npx approach — no permanent global install needed.
# Check Java version
java -versionInstall the CLI wrapper via npm (recommended for Node-based projects):
npm install @openapitools/openapi-generator-cli --save-devOr run it on-demand without installing:
npx @openapitools/openapi-generator-cli versioncurl -O https://bookable.redocly.app/_spec/apis/BookingApi.ymlOr reference it directly in the generate command using the URL — no local copy needed.
Run generate with the target language generator, the spec file, and an output directory.
npx @openapitools/openapi-generator-cli generate \
-i BookingApi.yml \
-g typescript-fetch \
-o ./src/bookable-client \
--additional-properties=supportsES6=true,npmName=bookable-clientReplace BookingApi.yml with the remote URL https://bookable.redocly.app/_spec/apis/BookingApi.yml to always generate from the latest published spec.
The generated client defaults to the base URL defined in the spec. Override it at runtime and inject the OAuth token before making requests.
import { Configuration, BookingsApi } from './src/bookable-client';
const config = new Configuration({
basePath: 'https://api-sandbox.bookabletech.com', // or https://api.bookabletech.com
accessToken: async () => {
// Return a valid Bearer token — fetch from your token store or refresh if needed
return myTokenStore.getAccessToken();
},
});
const api = new BookingsApi(config);
const availability = await api.getAvailability({
operatorId: 'op_123',
date: '2026-06-15',
partySize: 2,
});The generated client does not handle token refresh automatically. Use a wrapper or middleware to fetch a token via the OAuth client credentials flow before each request, or cache it and refresh when it is about to expire.
See Authentication for the full token endpoint and request format.
To ensure reproducible builds, pin the generator version in your project config:
// openapitools.json (created automatically on first run)
{
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "7.10.0"
}
}Run npx @openapitools/openapi-generator-cli version-manager list to see available versions.
OpenAPI Generator supports 50+ languages and frameworks. Run the following to list all options:
npx @openapitools/openapi-generator-cli listCommon choices for Bookable integrations:
| Generator | Output |
|---|---|
typescript-fetch | TypeScript with native fetch |
typescript-axios | TypeScript with Axios |
javascript | Plain JavaScript (CommonJS) |
python | Python (requests) |
java | Java (OkHttp + Gson) |
csharp | C# (.NET) |
go | Go |
ruby | Ruby |
php | PHP |
- Authentication — OAuth 2.0 token flow and code examples
- API Reference — full Bookings API spec
- Using Postman — test endpoints without code
- Quickstart — make your first booking