Lovable set up

    Store Your MLS API Key in Lovable

    Where Lovable keeps secrets, how a Lovable server function or Edge Function reads the key, and how to check it never reaches the page.

    Part of the Lovable MLS API Integration guide · Last reviewed 2026-11-20

    Storing an MLS API key in Lovable secrets

    In Lovable, an API key belongs in Secrets. Open More in the project toolbar, then Settings, then Secrets, select Add secret, and enter the name SAIGE_MLS_API_KEY with your key as the value. Add a second secret, SAIGE_MLS_API_URL, for the feed address. Lovable injects secrets into server code at run time, where an Edge Function reads them with Deno.env.get, and its docs say secrets never reach the browser.

    Key takeaways

    • Path: More, then Settings, then Secrets, then Add secret.
    • Names may not start with VITE_, SUPABASE_ or LOVABLE_.
    • Secrets are write-only: to change one, save a new value.
    • Server code reads it with Deno.env.get("SAIGE_MLS_API_KEY").

    Need the data feed for this? Saige is an approved MLS data vendor in BC. Send a request and our team will contact you.

    Where Lovable keeps secrets

    Lovable gives you two ways to add a secret. When a prompt needs a key, Lovable can show a secure input in the chat: enter the value there, not as a chat message. Or add it yourself from the project toolbar.

    Lovable rejects names that start with VITE_, because those values are built into page code. Names starting with SUPABASE_ or LOVABLE_ are reserved. The Secrets view lists each secret's name and date, never its value.

    • In the project toolbar, open More, then Settings, then Secrets.
    • Select Add secret.
    • Name: SAIGE_MLS_API_KEY. Value: your key. Save.
    • Add secret again. Name: SAIGE_MLS_API_URL. Value: the feed address our team gave you. Save.

    Reading the key in a Lovable server function or Edge Function

    Lovable's docs show secrets read with Deno.env.get inside an Edge Function. Newer Lovable apps can use server functions instead, and the build prompt tells Lovable to keep every feed call in server code either way.

    Edge Function reading the key (Lovable)
    const key = Deno.env.get("SAIGE_MLS_API_KEY");
    const base = Deno.env.get("SAIGE_MLS_API_URL");
    
    const res = await fetch(
      `${base}/Property?$filter=StandardStatus eq 'Active'&$top=24`,
      { headers: { Authorization: `Bearer ${key}` } }
    );
    const data = await res.json(); // data.value is the list of listings

    Check before you publish

    Open the published Lovable site, view the page source, and search for the first characters of your key. It must not be there. Then use the search page with the browser's network panel open: requests should go to your own server code, not straight to the feed address. The full check list is at Keep Your MLS API Key Secret on an AI-Built Site.

    Frequently asked questions

    Can I see the key again after saving it?

    No. Lovable's secrets are write-only. To change the key, save a new value under the same name.

    What happens to secrets when I remix a project?

    Lovable's docs say secrets you added keep their names in a remix, but not their values. Add the values again in the remixed project.

    Why can't I name it VITE_SAIGE_KEY?

    Lovable rejects the VITE_ prefix because those values are built into the page code that visitors download.

    Should I use a connector instead?

    A custom connector stores credentials once for a workspace and needs an admin to create it. For one site, a project secret is simpler.

    Related pages in this guide

    Sources

    Every claim on this page that could be checked against a primary source is linked below. Where something is not publicly documented by a vendor, the page says so rather than filling the gap with an estimate.

    MLS API for BC

    Put live MLS listings on the site you are building

    Saige is an approved MLS data vendor for Greater Vancouver REALTORS, Fraser Valley Real Estate Board, Chilliwack and District Real Estate Board and BC Northern Real Estate Board. Send a request and our team will contact you to check what your board allows and how to connect your builder.

    Call 604.401.4849