API keys
An API key lets a website or tool you built read and change your own Haven account. You create it yourself and it works at once. There is no application, no sandbox and no certification.
Keys are for hosts acting on their own account. Software that connects to other people's accounts uses OAuth instead; see Getting access.
Create one
- Sign in to Haven and open Connected apps.
- Under API keys, click Create API key.
- Name it after what it is for, such as the site that will use it.
- Copy the key. This is the only time Haven shows it.
A key looks like this:
hvsk_Ab3dE9xQ_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The part after hvsk_ and before the next underscore is the key's id. It is not secret, and it is what the Connected apps page shows beside each key so you can tell them apart.
You need the Owner or Manager role to create or delete a key. An account can hold up to 20.
Where it goes
In your hosting platform's secrets, as an environment variable named HAVEN_API_KEY.
| Where your site runs | Where the secret goes |
|---|---|
| Lovable | The project's Secrets (needs Lovable Cloud or Supabase) |
| Bolt | The project's secrets or environment variables |
| Replit | The Secrets tool |
| v0 or Vercel | Project settings, Environment Variables |
| Netlify | Site configuration, Environment variables |
| Cloudflare | The project's Variables and Secrets |
| Your own computer | A .env.local file that is listed in .gitignore |
Then redeploy or restart so the secret is loaded.
Three rules, and they are the whole of key safety:
- Server code only. Never in code that runs in a browser, and never with a prefix that ships a variable to the browser (
NEXT_PUBLIC_,VITE_,PUBLIC_,REACT_APP_). - Never in a chat. Do not paste the key into an AI tool's conversation. Add it as a secret and tell the tool its name.
- Never in a file you commit. If it was pasted or committed anywhere, delete it and create another.
Use it
Send it as a bearer token on every request to the account API:
curl https://www.bookwithhaven.com/api/public/v1/me \
-H "Authorization: Bearer $HAVEN_API_KEY"
GET /me is the right first call. It answers with the account the key acts in, your role there, and the permissions the key holds.
Everything under /api/public/v1 accepts a key: every read in the Endpoint index and every write in Operations (writes). The conventions are the same as for any caller: the response envelope, pagination, money in minor units, and an Idempotency-Key on every write.
A key also works as the bearer on Haven's MCP servers, for a tool that takes a fixed header instead of signing in. See Build MCP endpoint.
What a key can do
Everything a host can grant an application, on your own account only.
- Your account, and only yours. A key is bound to the account it was created in. No header or parameter points it anywhere else.
- Read and write. All of the grantable permissions in the Scope reference: listings, calendar, rates, stay rules, reservations, guest details, messaging, discount codes, guidebook, blog and your Haven sites.
- Capped by your role. The key acts as the person who made it. If their role drops to Viewer, the key becomes read-only on its next request. If they leave the account, the key stops working.
- Not billing, payouts or your team. Haven grants those to no application and no key.
Two safeguards apply to a key exactly as they do to any application:
- Refunds and price adjustments are two steps. The first call is refused and returns a confirmation token; the second, with the token, commits. See Operations (writes).
- A property management system keeps what it owns. A write to rates or availability on a listing your PMS manages is refused with
domain_locked, because the next sync would overwrite it.
What a key does not need
No User-Agent product token, no redirect URI, no refresh. A key does not expire on a schedule: it works until you delete it.
Your site does not need a key at all to show prices and take bookings. Those use the Booking endpoints, which take no credential.
Rate limits
Each key has its own budget: 600 reads and 120 writes a minute. A 429 carries Retry-After. Cache listing content for a few minutes rather than fetching it on every page view. See Rate limits.
Delete or replace a key
On Connected apps, click the bin beside the key. It stops working on its next request and cannot be restored. Whatever it already wrote to your account stays.
To replace a key without downtime, create the new one, put it in your secrets, redeploy, then delete the old one.
The page also shows when each key was last used, which is the quickest way to find one that nothing depends on any more.
When a key is refused
The error says what happened and what to do.
| Status | error.data.reason | Meaning |
|---|---|---|
| 401 | unknown_token | Haven does not recognize the key. Check the whole key was copied. |
| 401 | grant_revoked | The key was deleted. Create another. |
| 401 | seat_lost | The person who made the key no longer has access to the account. |
| 403 | The key's maker is now a Viewer on the account, so it can read but not write. |
Every error carries a requestId. Quote it if you write to info@bookwithhaven.com.
When a team member creates a key
A Manager can create a key for the account they manage. The account owner is emailed when that happens, and can delete the key from Connected apps like any other.