API keys: connect a site you built to Haven
An API key lets a website or tool you built read and change your own Haven account: listings, photos, calendars, rates, bookings, guest messages and your Haven sites. You create it yourself and it works right away. There is no application, no review and no certification.
It is made for hosts who build their own booking site with an AI coding tool such as Lovable, Bolt, v0, Replit, Cursor, Claude Code or Codex, and want Haven to stay the booking engine behind it.
When to use it
- Your AI tool is building your website and should fill the pages from your Haven listings instead of you retyping them.
- You want a custom dashboard, report or automation on your own Haven data.
- A tool you use asks for "a Haven API key".
You may not need one. A site that only shows prices and takes bookings needs no key: the booking widget and Haven's booking endpoints work without it. See Add Haven to your existing website.
How to create a key
- Open bookwithhaven.com/connected-apps and sign in. You can also get there from Settings → Integrations, where API keys sits at the bottom of the page, under Connected apps.
- Under API keys, click Create API key.
- Give it a name, such as the site it is for, and click Create key.
- Click Copy key. This is the only time Haven shows it.
- Add it to your AI tool or hosting platform as a secret named
HAVEN_API_KEY, in its secrets or environment variables. - Click Copy prompt for your AI and paste the prompt into your tool. It connects the tool to Haven and walks it through wiring your site. The prompt does not contain your key.
You need the Owner or Manager role. Viewers can see the list of keys but cannot create or delete one. An account can have up to 20 keys.
Keep the key safe
- Put it in secrets, not in the chat. Paste the key into your tool's secrets or environment variables. Do not paste it into the conversation with the AI.
- Server only. It must never be in code that runs in a visitor's browser. The prompt tells your AI tool this too.
- Lost it or pasted it somewhere public? Delete it and create another. A deleted key stops working immediately.
Haven Build: the helper for your AI tool
Add this address to your AI tool as an MCP server (or "connector"):
https://www.bookwithhaven.com/api/public/mcp/build
Haven signs you in and you click Allow access. Your AI tool can then look up your listing codes, fetch working code for each step, compare the price on your page with Haven's, see whether your site's calls to Haven are succeeding, and run a go-live check that tells you what is left. It can only read: it cannot change your account, and it cannot create or see an API key.
Then say to your tool: "Use Haven Build to connect this site to Haven."
The full walkthrough, with a prompt to copy, is on Build a direct booking site with AI.
What a key can do
- Your account only. A key reaches the Haven account it was created in and no other.
- Read and change. Listings, calendars, rates, stay rules, bookings, guest names and emails, guest messages, discount codes, guidebook content, blog and your Haven sites.
- As you. The key has the role of the person who made it. If a Manager who made a key becomes a Viewer, that key can no longer change anything. If they leave the account, the key stops working.
- Not billing, payouts or your team. No key can touch those.
Two protections stay on. A refund or a price change on a booking takes two steps, so nothing moves money in a single call. And a listing whose rates or calendar are managed by your property management system refuses changes to them, because the next sync would undo it.
What your site should never do
Your AI tool is told these, and they are worth knowing yourself:
- Never work out a price. The site asks Haven for the price of a stay and shows exactly that. Fees, taxes and discounts are already in it.
- Never take a card. The Book button sends the guest to Haven's checkout, which runs on Stripe and pays out to your own Stripe account.
- Never keep its own calendar. Availability is read live from Haven, so a booking on Airbnb closes the dates on your site too.
See and delete keys
Connected apps → API keys lists every key with its name, the first characters of the key, when it was created and when it was last used. A key that has never been used, or not for months, is one nothing depends on.
To delete a key, click the bin beside it and confirm. Anything still using it stops working at once, and whatever it already wrote to your account stays.
To swap a key without your site going down: create a new key, put it in your secrets, redeploy, then delete the old one.
When a team member creates a key, the account owner gets an email naming the key and who made it.
Troubleshooting
- The site says the key is invalid (401). Check the secret is named
HAVEN_API_KEY, that it is set where the site actually runs (not only on your computer), and that you redeployed after adding it. The error message says whether the key was deleted or never recognized. - Prices or the calendar do not load, and the error is 404. The listing is not public yet. Finish setup and publish in Haven; your AI tool's go-live check lists what is left.
- The AI tool cannot find Haven Build. Add the address above under MCP servers, Connectors or Integrations in the tool's settings, then sign in when it asks.
Related Articles
Related Articles
New to Haven?
Everything in this guide, done for you
Haven is the direct booking platform these guides are written for — a branded site, secure payments, and guest relationships you own. Build yours free.
Free to build · No credit card · Private until you publish