ドキュメント

統合リソース。

統合リソースの入口です。Slotkit の機能を順に確認するには、ホームまたは開発者向け概要から始めてください。

Public API v1

安定した API contract は、インタラクティブ Reference とダウンロード可能な OpenAPI ドキュメントで提供しています。

統合インターフェース

API Key をブラウザコードに埋め込まないでください。自分のバックエンドから API リクエストを送信します。

Public API quickstart · English

Build your own booking app.

Your browser calls your backend. Your backend calls Slotkit. This guide covers discovering an Event Type, listing real Slots, confirming a Booking, and letting its customer reschedule or cancel it.

Use the downloadable OpenAPI contract for exact fields and the API reference for all endpoints, including Booking Invitations. The examples below use raw HTTP; the TypeScript SDK is not publicly distributed yet. This English guide is shared across the documentation locales.

1. Prepare a bookable workspace

  1. Sign in to Administration and create or select a workspace. A first verified Google or email OTP sign-in creates a User; creating the workspace is a separate step.
  2. Use the first-bookable-event setup to create a Host, choose availability and timezone, connect Google Calendar, select conflict-check and destination Calendars, and create and activate an Event Type. Google Calendar is required even for a Meeting type of none. Google sign-in alone does not connect Calendar.
  3. Keep the workspace and Host active and ensure the workspace has Booking capacity through Credits or an applicable pass. API Keys do not bypass billing or bookability rules.
  4. As workspace Owner, open API Keys in Administration, complete recent reauthentication when requested, and create a key with the four scopes below. Copy the key once into your backend's secret store. A lost key must be replaced.
OperationScope
Discover Event Typesevent_types:read
List Slotsslots:read
Read Bookingsbookings:read
Create, reschedule, cancelbookings:write

Booking Invitations additionally use invitations:read and invitations:write. Public API Keys cannot create Hosts, edit availability, connect Calendars, or administer keys and Webhooks. Complete those tasks in Administration.

2. Configure your server and discover the Event Type

Set SLOTKIT_BASE_URL to https://api.slotkit.app and SLOTKIT_API_KEY to the key in server-only configuration. Local developers running Slotkit may use http://127.0.0.1:8000; a local environment needs its own workspace and key. There is no shared test key or built-in Google Calendar simulator in the Public API.

Keep credentials out of source control, browser JavaScript, HTML, URLs, logs, and public environment variables. Browser CORS access is unsupported. Use Authorization: Bearer, UTF-8 JSON, and HTTPS outside local development.

# These variables belong to your server's secret configuration.
# Production base URL: https://api.slotkit.app (no /v1 suffix)
# Local development only: http://127.0.0.1:8000
curl --fail-with-body "$SLOTKIT_BASE_URL/v1/event-types?limit=20" \
  -H "Authorization: Bearer $SLOTKIT_API_KEY" -H 'Accept: application/json'

The response has data (an array) and meta.request_id. Choose an Event Type with bookable: true; when false, inspect unavailable_reason and fix setup in Administration. Store its opaque id as your backend configuration. Never parse IDs or submit a Tenant ID: the key determines the workspace.

Follow meta.next_cursor until null using URL-encoded cursor with the same filters. Default page size is 20, maximum 100. Bookings lists accept status, event_type_id, and paired starts_from/starts_to spanning at most 90 days; there is no Guest-email filter. Your database must retain customer-to-Booking ownership.

3. List Slots for the customer's local date

Set EVENT_TYPE_ID to the selected ID and BOOKING_DATE to a future YYYY-MM-DD within the Event Type's booking horizon. Both from and to are inclusive local dates in the requested IANA timezone. Use the same date for a single-day view; a range may span at most 31 inclusive days.

curl --fail-with-body --get \
  "$SLOTKIT_BASE_URL/v1/event-types/$EVENT_TYPE_ID/slots" \
  -H "Authorization: Bearer $SLOTKIT_API_KEY" -H 'Accept: application/json' \
  --data-urlencode "from=$BOOKING_DATE" --data-urlencode "to=$BOOKING_DATE" \
  --data-urlencode 'timezone=Asia/Bangkok'

data contains Slots with UTC start_at/end_at and localized times. An empty array means no Slots for that window. Display times in the customer's timezone and send the selected start_at unchanged. Slots are offers, not reservations; another customer may book before confirmation. Do not calculate an end time or send a Host ID yourself.

4. Confirm the selected Slot

# Persist a unique operation ID and the exact JSON before sending.
# Replace start_at with a value returned by the Slot endpoint.
curl --fail-with-body "$SLOTKIT_BASE_URL/v1/bookings" \
  -H "Authorization: Bearer $SLOTKIT_API_KEY" \
  -H "Idempotency-Key: $CREATE_OPERATION_ID" \
  -H 'Accept: application/json' -H 'Content-Type: application/json' \
  --data '{
    "event_type_id": "evt_REPLACE",
    "start_at": "2026-10-15T09:00:00.000Z",
    "guest": {"name": "Demo Guest", "email": "[email protected]", "timezone": "Asia/Bangkok"},
    "metadata": {"external_order_id": "order_demo_123"}
  }'

A successful creation returns HTTP 201 with data.id, status: confirmed, version, and meta.request_id. Store the Booking ID and your customer/order relationship before acknowledging success. Metadata is optional correlation data, never authorization; use an object and avoid unnecessary sensitive data.

Calendar synchronization is asynchronous. A confirmed Booking can have calendar.status: pending and a null meeting.join_url. Show confirmation immediately and read the Booking again to update Calendar/Meeting state. API-created Bookings do not receive Slotkit Hosted Guest confirmation or management emails; your app owns customer access and communications. Google attendee updates are separate and depend on Event Type configuration.

5. Retry safely, including after a timeout

Every POST requires a printable ASCII Idempotency-Key of 1–255 characters. Persist a unique key, operation path, exact semantic payload, creation time, and attempt/result state before calling Slotkit. Keep it stable across double-clicks, timeouts, process restarts, and API Key rotation.

ResponseYour application action
401 invalid_api_keyCheck key, expiry/revocation, and active workspace; never display it.
403 insufficient_scopeCreate an appropriately scoped key in Administration.
404 resource_not_foundTreat as unavailable; foreign-workspace IDs behave the same.
409 booking_version_conflictRead the Booking again, show current state, then create a new action with its current version.
409 idempotency_conflictFix your retry bookkeeping. Do not silently issue a replacement creation.
409 slot_no_longer_available or 422 validation_failedRefresh Slots or correct the specified input after the rejected attempt is known.
422 operation_not_allowedCheck current Booking/Event Type state. Capacity or other domain validation may also return validation_failed; verify workspace setup and capacity in Administration.
429 or 503Honor Retry-After when present (seconds or HTTP date), apply bounded retry, and keep the original mutation key/payload.

Branch on error.code, preserve error.request_id for support, and read error.details as an array. Do not assume a raw provider or internal error will be exposed.

6. Read, reschedule, and cancel

# Read the authoritative state and version.
curl --fail-with-body "$SLOTKIT_BASE_URL/v1/bookings/$BOOKING_ID" \
  -H "Authorization: Bearer $SLOTKIT_API_KEY" -H 'Accept: application/json'

# Reschedule to a freshly listed Slot; version comes from the Booking read.
curl --fail-with-body "$SLOTKIT_BASE_URL/v1/bookings/$BOOKING_ID/reschedule" \
  -H "Authorization: Bearer $SLOTKIT_API_KEY" \
  -H "Idempotency-Key: $RESCHEDULE_OPERATION_ID" \
  -H 'Accept: application/json' -H 'Content-Type: application/json' \
  --data '{"start_at":"2026-10-15T10:00:00.000Z","expected_version":1}'

# Use a distinct operation ID and the current version for cancellation.
curl --fail-with-body "$SLOTKIT_BASE_URL/v1/bookings/$BOOKING_ID/cancel" \
  -H "Authorization: Bearer $SLOTKIT_API_KEY" \
  -H "Idempotency-Key: $CANCEL_OPERATION_ID" \
  -H 'Accept: application/json' -H 'Content-Type: application/json' \
  --data '{"expected_version":2}'

Read and authorize the customer-to-Booking relationship in your app before calling a management endpoint. A Tenant-wide key can manage every Booking in that workspace; an opaque Booking ID alone is not customer authorization. Keep your own browser authentication and CSRF/Origin protections, and never expose a generic authenticated proxy to arbitrary /v1 routes.

Reschedule requires expected_version; cancel accepts it optionally. Action responses are HTTP 200 with the complete current Booking. Repeated cancellation is idempotent. Fetch the latest state rather than inferring versions. For a small app, refresh authorized Booking reads on page load and after mutations; for background state changes, use Webhooks.

7. A server-side Node.js helper

Download slotkit-client.mjs (Node.js 22+, no dependencies). This raw HTTP example preserves envelopes, request IDs, errors, Retry-After, timeout uncertainty, and cursor pagination. It does not persist operations or authorize your customers; the database methods below are application-owned integration points, not SDK methods.

import { SlotkitClient, SlotkitError } from './slotkit-client.mjs';
const slotkit = new SlotkitClient({
  baseUrl: process.env.SLOTKIT_BASE_URL,
  apiKey: process.env.SLOTKIT_API_KEY,
});
const eventTypes = await slotkit.listEventTypes();
const event = eventTypes.find(event => event.bookable);
if (!event) throw new Error('Complete Event Type setup in Administration');
const { envelope } = await slotkit.slots(event.id, bookingDate, bookingDate, 'UTC');
const selected = envelope.data[0];
if (!selected) throw new Error('No Slots for the chosen date');

// Implement this using YOUR database. Save once before making the request.
// Bind the operation to your authenticated customer, action, and payload hash.
const operation = await operations.persist({
  customerId,
  action: 'create_booking',
  payload: { event_type_id: event.id, start_at: selected.start_at,
    guest: { name: 'Demo Guest', email: '[email protected]', timezone: 'UTC' } },
});
try {
  const result = await slotkit.request('/v1/bookings', {
    method: 'POST', body: operation.payload, idempotencyKey: operation.idempotencyKey,
  });
  // Save Booking ID + customer ownership and result before responding to browser.
  await operations.complete(operation.id, result);
} catch (error) {
  if (!(error instanceof SlotkitError)) throw error;
  // Persist status/code/requestId/retryAfter and retain the original payload/key.
  await operations.recordFailure(operation.id, error);
}

Keep the helper in server code. It makes no automatic mutation retries. Your operation service must save the original request before invoking it, then recover uncertain attempts with the same operation. The OpenAPI document remains the request/response authority.

8. Webhooks and launch verification

A basic app can use Booking reads. For durable background updates, workspace Owners configure an HTTPS Webhook endpoint and subscriptions in Administration. Delivery is at least once and may arrive out of order. Booking lifecycle events and calendar.created/calendar.failed let you refresh Calendar and Meeting presentation. Store the one-time endpoint signing secret only on your backend.

Verify Slotkit-Signature: v1=<hex> using HMAC-SHA256 over Slotkit-Timestamp + "." + raw_request_body before parsing JSON. Use constant-time comparison, a five-minute timestamp tolerance, and accept a valid signature from any active signing secret during rotation. Slotkit-Event-Id is the stable Event ID; retries keep the ID/body and receive a new timestamp/signature.

Durably deduplicate by Event ID, reject stale Booking versions, and acknowledge with 2xx only after the event is safely stored. Webhook api_version is v1; lifecycle Booking snapshots are in data.object. If you need Meeting state after a Calendar event, read the authorized Booking again. HTTPS endpoints must be publicly reachable; private-address and redirect destinations are rejected. A localhost receiver requires a separately configured safe public endpoint and is not part of this polling quickstart.

Before accepting real customers, verify successful create/read/reschedule/cancel, identical mutation replay, stale-version and taken-Slot handling, denied key/scope and cross-workspace access, customer ownership, restart/timeout recovery, rate limits, and secret-free browser assets. Test your real Google Calendar authorization and Calendar projection separately; a local fake does not prove Google compatibility. Add your own customer authentication, communications, abuse limits, and production operation retention.