# Quickstart

From nothing to a confirmed booking through the API in about ten minutes.

## 1. Get test keys

[Create a test business](https://app.ratesspot.com/start). You get a dashboard and two keys, shown once:

- a **secret key** (`rs_test_sk_…`) for your server: full access to the test business
- a **publishable key** (`rs_test_pk_…`) safe in browsers: listings, availability, quotes and holds only

Test businesses can't take real money and send no emails, so you can try anything.

## 2. Add something to sell

In the dashboard, open **Listings & rates → New listing**: for example "Double room", 3 units, $120 a night, paid in full. (Or create it with the API: `POST /v1/catalog/resources`.)

## 3. Read the catalog

```sh
curl https://api.ratesspot.com/v1/catalog \
  -H "Authorization: Bearer rs_test_pk_…"
```

Note the listing's `id` (the `resourceId` below).

## 4. Price a stay

```sh
curl https://api.ratesspot.com/v1/quotes \
  -H "Authorization: Bearer rs_test_pk_…" \
  -H "Content-Type: application/json" \
  -d '{ "resourceId": "…", "range": { "kind": "nights", "checkIn": "2026-12-10", "checkOut": "2026-12-12" }, "adults": 2 }'
```

The answer has the `total` (in minor units: cents, pence, kobo), each line, the cancellation terms and the ways to pay.

## 5. Hold it, then confirm it

```sh
curl https://api.ratesspot.com/v1/holds \
  -H "Authorization: Bearer rs_test_sk_…" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: first-booking-1" \
  -d '{ "resourceId": "…", "range": { "kind": "nights", "checkIn": "2026-12-10", "checkOut": "2026-12-12" }, "adults": 2,
        "customer": { "name": "Ada Obi", "email": "ada@example.com" } }'
```

A hold reserves a unit while the customer pays. The `Idempotency-Key` makes a retry return the same hold instead of booking twice. To take payment online, see [Payments](https://www.ratesspot.com/docs/payments.md); to record a payment taken in person, `POST /v1/bookings/{id}/desk-payments` with the secret key. Once paid, the booking is `CONFIRMED` and shows in the dashboard.

## 6. Use the SDK

```ts
import { createRatesSpot } from "@ratesspot/sdk";
const rs = createRatesSpot({ apiKey: process.env.RATESSPOT_KEY! });
const { data: quote } = await rs.POST("/v1/quotes", { body: { resourceId, range, adults: 2 } });
```

`@ratesspot/sdk` is typed from the OpenAPI spec, so every request and response is checked by TypeScript.

## Next

- [Build a booking page](https://www.ratesspot.com/docs/booking-page.md): listings, availability, quotes, holds and payment, with a publishable key.
- [Webhooks](https://www.ratesspot.com/docs/webhooks.md): hear about bookings and payments as they happen.
- [API reference](https://api.ratesspot.com/docs): every route.
