●Last checked 16 prompts0 of 16 run in Lovable

    Add an API to a Lovable App: 16 Prompts and What Breaks

    Prompt builder · five steps · no account

    Step 1 of 5

    What are you building?

    No account needed.

    Building something else? Describe it to the AI generator

    Adding an API to a Lovable app fails in a predictable place: the request works, the happy path renders, and then the key is in the client bundle, the rate limit is undiscovered, and nothing handles the third party being down. Lovable's docs close the first of those by design. These 16 prompts close the other two, and this page shows where the key lives, what the AI gateway costs, and what the first run will record.

    By Marco Kohns · Prompts written and run by us

    Short answers

    Short answers

    Where does the key go?

    In project secrets, never in the chat and never in a VITE_ variable. Lovable's docs say secrets are encrypted, injected into edge functions and never reach the browser. Every prompt here assumes that path.

    The three paths →

    What does a run cost?

    ? credits

    Not measured for this category yet. The runs we have measured range from 1.8 to 10.4 credits; an integration that adds one edge function sits low in that range, and a model call is billed on top as a run credit.

    See what we do know →

    Do I need an OpenAI or Gemini key?

    Not for the AI prompts. Lovable's AI gateway adds model calls without a provider account or key and bills each call to workspace credits. A provider it does not offer is called from an edge function with your own key as a secret.

    From the docs →

    My integration already exists

    Then check three things: the key is not in the bundle, the same webhook event twice does nothing, and a timeout shows a state. The fix lines below cover each.

    Fix lines for live apps →

    16

    API & Integration prompts in this category

    ↳ Copy-paste, free

    0of 16

    Prompts from this category run in Lovable

    ↳ Next run: Payment Provider Webhook Integration

    3runs

    Measured so far across the library

    ↳ 1.8 to 10.4 credits each

    24

    Upvotes since Jan 2026

    ↳ One per visitor, self-reported

    Data basis: no prompt run in this category yet; every card says so. Credit figures come from the three measured runs elsewhere in the library, the screenshots from the 26 September 2026 session, and every rule about secrets, connectors, edge functions and the AI gateway from Lovable's docs, checked 22 October 2026.

    Find a prompt

    Which service are you connecting?

    Cards are sorted by build order. Each says whether we ran it in Lovable, and if not, shows a question mark instead of a guess.

    Showing 16 prompts

    • Step 1 · Understand▲ 7

      API Request Explorer

      A request explorer for your own API that sends through a server proxy with each user's encrypted key, so saved requests and history never store a credential.

      Run it when: before committing to an API, to see the response shape instead of guessing it.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • Step 2 · First integration▲ 1

      Simple Social Login Connector

      Google plus one more provider beside email and password, where a matching verified email links only after the existing account's password confirms it.

      Run it when: you want the server-side key pattern right where a mistake is cheap.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • Step 2 · First integration▲ 1

      Feature Flag Service Integration

      A hosted feature-flag service behind one wrapper and a typed registry, where an unreachable provider falls back to declared defaults and overdue flags are highlighted.

      Run it when: flags live in a service and the app must behave when it is unreachable.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • Step 2 · First integration▲ 3

      API-Driven Weather Dashboard

      A weather dashboard where one server module owns the provider key, cache and call count, so cards fall back to stale cached data when the provider fails.

      Run it when: you want a read-only integration to learn caching and failure states on.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • Step 3 · Money▲ 1

      Payment Provider Webhook Integration

      Signature-verified payment webhooks as the only writer of subscriptions and entitlements, idempotent on event id and tested against duplicates and out-of-order delivery.

      Run it when: a provider's events drive what a customer may do.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • Step 3 · Money

      Third-Party CRM Sync Integration

      A two-way CRM sync where direction and conflict winner are declared per field, every change logs the rule that caused it, and mass changes pause for confirmation.

      Run it when: two systems hold the same records and one of them must win.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • AI▲ 1

      AI Chat Assistant Integration

      An in-app chat assistant that answers from your help articles with source links, reads the user's plan, and hands off to support when retrieval finds nothing.

      Run it when: conversation state and a cost cap matter as much as the answer.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • AI▲ 1

      AI Text Classification API Integration

      A text classifier against a versioned label set with a None of these option, where items below each label's threshold go to a human review queue.

      Run it when: the output is a label from a fixed set and the app acts on it.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • AI▲ 2

      AI Analytics Insights

      A weekly AI narrative over your metrics where change detection runs before the model, and every number in the text must appear in the run's stored snapshot.

      Run it when: numbers go in and a structured summary comes out.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • AI▲ 1

      AI PDF Summarizer

      A PDF summarizer that shows the summary beside the source, links each key point to its page, and names every scanned page it could not read.

      Run it when: one document in, text out, with the size limit stated.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • AI▲ 1

      AI Image Captioner

      A batch captioner that writes alt text under 125 characters and a short description per image, then routes uncertain results to a reviewer who approves them.

      Run it when: images in, captions out, failures handled per file.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • AI▲ 1

      AI Multilingual Translator

      A translation tool that sends the team glossary with every request, checks the output for each required term, and flags any translation that misses one.

      Run it when: the output must preserve structure and the source must stay available.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • AI▲ 1

      AI Driven Research Assistant

      A research assistant that links every sentence to a verbatim supporting quote, labels unsupported sentences Inference, and quotes both sides when sources disagree.

      Run it when: several calls chain and each needs a budget.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • AI▲ 1

      AI Action History Logger

      One wrapper around every model call writes a structured, redacted record that admins search by feature, user and trace, and every record opened is logged.

      Run it when: a model takes actions and someone has to see what it did.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • Your API▲ 1

      Public API Explorer

      A public API catalog with structured, filterable pages, a try-it console behind an allowlisted proxy, and a scheduled job that marks unverified entries Needs re-check.

      Run it when: your app is the service and others need a catalogue and a try-it console.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock
    • Your API▲ 1

      API Auto-Documentation Generator

      An API docs site generated from an uploaded OpenAPI spec, with a page per endpoint and schema, a gap report, and publishing that swaps versions in one step.

      Run it when: endpoints exist and the docs should come from the code.

      Not run yet · credits ?
      Try in Lovable
      Pro version adds the growth-channel instructionsUnlock

    Connecting more than one service? The bundle has all 16 as one kit in build order, with every Pro version unlocked, plus 136 more prompts.

    See what is in the 152-prompt bundle

    Disclosure: if you create a Lovable account through links on this page, we may earn a commission. It costs you nothing and does not change what we recommend.

    Measured run

    No integration prompt has been run yet. This is what the first run will record.

    ●●● prompt · excerpt · Payment Provider Webhook Integration Full prompt on the card above

    ▍Context

    Add payment provider webhooks to an existing subscription app on the app's backend: signature-verified events are the only source of subscription and entitlement state. The one job: no customer pays without access and none keeps access after cancelling.

    ▍Core Features

    1. Receiver: a server function verifies the signature on the raw body, stores the event, answers 200 at once and processes it afterwards

    2. Handlers for checkout completed, payment failed, subscription updated and subscription canceled; with Stripe these are checkout.session.completed, invoice.payment_failed, customer.subscription.updated and customer.subscription.deleted, verified with the Stripe-Signature header and the endpoint's signing secret

    3. Entitlements written only by processed events; the success page after checkout reads them and shows "Confirming your payment" until the event arrives

    4. Failure alerts: a processing error emails admins with the event id and shows on the admin page

    5. Reconciliation page: subscription states in your database against a pull from the provider's API, mismatches listed

    ▍Event Truth & Idempotency

    ▍Safe-Guard Instructions

    - Never grant access from a redirect, query parameter or any browser signal

    - Idempotency on the provider's event id; unknown event types are stored, acknowledged and ignored

    ▍Distribution hooks · Pro

    Locked. The Pro version adds the growth-channel instructions for this screen.

    1. 01

      A fresh project in Marco's own workspace

      Balance read and screenshotted first. A test-mode Stripe key as the secret, added through More > Settings > Secrets, which Lovable's docs say is the place for it.

    2. 02

      The prompt pasted unedited, in Build mode

      Its Before Building line should make Lovable ask which provider and which events matter first. Every question goes on the record with the answer given.

    3. 03

      Watch where the key ends up

      Lovable detects a key pasted into chat and steers it to Secrets. The run checks the published bundle for the key anyway, because a prompt asking for a client-side fetch can still get one.

    4. 04

      Send the same test event twice

      The docs say the Stripe connector uses no webhooks by default, so the prompt has to make Lovable write the endpoint. Idempotency is proven by a replay, never by reading the code.

    5. 05

      Rounds counted until the Core Features list is met, or 5

      Each follow-up verbatim: a missing handler, an unverified signature, a redirect page that wrote state.

    6. 06

      Balance read again, Security view scanned

      Leaked secrets is one of the seven Deep scan areas and the scan is free. The credit figure goes on the card.

    The Lovable More menu open on Analytics: a left list of Analytics, Cloud, AI, Agent integrations, Payments, Connectors, Security, SEO and AI search and Settings, and an empty analytics panel reading Publish your app to start tracking visits
    The More menu: Connectors, Payments, Security and Settings live here
    The project's Security view before the Deep scan: Deep security scan marked Recommended, takes about 4 minutes, Free, not scanned yet; Quick security scan Automatic, Free, last scan 6 hours ago; No issues found; Project dependencies 53 packages, 2 known issues
    The Security view: the free Deep scan covers leaked secrets
    The Lovable code view for the generated SaaS project: a file tree with .lovable, drizzle migrations and schema, public, src with components, hooks, integrations/supabase, lib, routes, router, routeTree, server and start files, a supabase folder, and a Download codebase button
    The code view: a server entry and a backend folder, where server-side calls go
    The Lovable editor after a completed build: the chat panel on the left shows the answered questions and Lovable's completion report for a SaaS app called Cadence, the preview on the right shows the generated landing page with a Create your workspace button, and the top bar shows History, layout, Preview, Homepage route, open-in-new-tab and Publish controls
    The editor after a backend build, 26 Sep 2026: the project the first integration run extends

    Credit math

    What an integration costs, from the docs and the runs we have

    Build credits pay for the message that writes the edge function; run credits pay for every model call through the AI gateway and for the backend while hosted. No run in this category yet, so the row uses the measured range.

    What a measured run of this size costs on each Lovable plan
    PlanDaily build creditsA measured run (1.8 to 10.4)Unused credits
    Free5 a day, max 30 a monthA one-function integration fits in a day; a backend-provisioning build spans two. Plus 4 AI credits and 1 connector credit a month as grants.Daily credits do not roll over; the grants do not either
    Pro5 a day, plus 100 monthly plan credits from $25Daily credits first, then plan credits. Model calls through the gateway are billed per call on top.Plan credits roll over, expire after 2 months
    Business5 a day, plus 100 monthly plan credits from $50Same as ProSame as Pro

    Lovable's own examples, for scale

    “Add authentication”
    1.20
    Build a landing page with images
    2.00
    A Plan mode message
    1.00 plus research
    Deep scan from the Security view
    0.00

    Source: Lovable docs, Credits and usage (illustrative), Plan mode and Security view. Checked 22 October 2026.

    Three ways to spend less

    • Use the gateway for AI before a provider key. No account, no key, no billing setup, per the docs; each call is metered as a run credit. Reach for your own key only for a provider the gateway does not offer.
    • Explore the API in one prompt first. The request explorer shows the response shape before application code depends on it. A wrong guess at the shape is a rebuild round.
    • Prefer a connector where one exists. The docs list connectors for Stripe, Resend, Perplexity, HubSpot, Slack, Twilio and more; the key stays out of code and chat and the connector adds it to requests.

    Start here

    Which integration prompt should you run first?

    Pick the sentence that sounds like your project.

    Learn the server-side pattern where a mistake is cheap

    1. 01API Request Explorer · see the response shape first
    2. 02API-Driven Weather Dashboard · read-only, with caching and failure states
    3. 03Simple Social Login Connector · the key pattern, low stakes

    Build order

    Four steps. Understand the API, call it safely, then handle it failing.

    1. 01

      Understand

      API request explorer

      One prompt to see the response shape beats guessing at it in application code.

    2. 02

      First integration

      Social login · Flags · Weather

      The secret in Secrets, the call in an edge function, the failure state on screen.

    3. 03

      The ones that matter

      Payment webhook · CRM sync

      Signature verification, idempotency on the event id, reconciliation.

    4. 04

      Make failure visible

      API error tracker (backend page)

      The piece most often missing when an integration silently stops.

    Anatomy

    What each section of an integration prompt does

    What each prompt section tells Lovable and what you get without it
    SectionWhat it tells LovableWhat you get without it
    ContextWhich service, which direction, and what the app does when it is downA happy path and nothing else
    Core featuresVerified receipt and storage first, handlers second, the UI lastA redirect page that writes state before the event arrives
    Rules sectionIdempotency, ordering, the output contract, the cost capDouble charges that look correct in testing
    Build orderSecret, then the server-side call, then the screenA key in a VITE_ variable, which the docs say is public
    Safe-guardsKeys in Secrets; calls server-side; reject unsigned payloads; never trust the clientA fetch in the browser with the key in it
    Before buildingAsk questions first, save answers to project knowledgeA guess at which events matter

    A one-line prompt gets you

    • The key in the client bundle
    • One handler for the happy path
    • A webhook that charges twice on retry
    • A blank screen when the model returns prose

    A prompt from this page gets you

    • The secret in Secrets, read by an edge function
    • Every event stored once by its id
    • A confirming state until the webhook has written
    • An output contract and a cost cap in the same message

    Fixes

    Where integration prompts go wrong, and the line that fixes it

    Already shipped an integration that works on the happy path? Paste the fix line into your existing project.

    Symptom

    The API key is visible in the browser

    Cause: the prompt asked for a fetch and the key went into frontend code or a VITE_ variable, which Lovable's docs say is bundled and public.

    Fix line

    Move the [service] key to project secrets. Move the call into an edge function that reads it from there. Remove every reference to the key from frontend code and confirm the published bundle does not contain it.

    Symptom

    A retried webhook event ran twice

    Cause: nothing stored the provider's event id, so a replay looked like a new event.

    Fix line

    Store every incoming event by the provider's event id with a unique constraint. If the id exists, acknowledge and do nothing. Apply events against current state using the provider timestamp, so a cancel that arrives before its update still ends canceled.

    Symptom

    The model answered in prose and the screen went blank

    Cause: the AI call was treated as deterministic and nothing handled a response that does not parse.

    Fix line

    Define the exact JSON shape the model must return. Validate the response; on a parse failure retry once with the error quoted, then show a visible failed state with the raw text available. Never render an unvalidated response.

    Symptom

    The third party was down and the app hung

    Cause: no timeout, no error state, no retry policy were named.

    Fix line

    Add a 10-second timeout to every call to [service]. On timeout or a 5xx, show a retryable error state, log the attempt with the status code, and retry at most 3 times with backoff. Do not block the rest of the page.

    Upvotes

    Which API & Integration prompts do builders upvote?

    Upvotes since January 2026, one per visitor. Small numbers: read them as a hint, never as a ranking.

    • API Request Explorer7
    • API-Driven Weather Dashboard3
    • AI Analytics Insights2
    • AI Text Classification API Integration1
    • AI Image Captioner1
    • API Auto-Documentation Generator1

    The Complete Lovable Bundle

    All 16 integration prompts in build order, plus every other prompt

    Every prompt and kit, every Pro version unlocked. One payment, no subscription.

    One payment. No subscription, no renewal, ever.

    Or get free access first

    FAQ

    Questions about API & Integration prompts

    How do I add an API to a Lovable app?+

    Three ways per Lovable's docs, read on 22 October 2026: a connector from the catalogue, a custom connector an owner or admin creates, or a direct integration where you describe the endpoints, methods and auth and Lovable writes the server-side code. On older React and Vite projects that is an edge function; on newer TanStack Start projects a server function. The key goes in through the Add secret form, never the chat. Then handle the three cases the docs leave to you: the request failing, the response not parsing, the same event arriving twice.

    Does Lovable have an API?+

    Three things get typed as lovable api. Your app can call any internet-reachable API, which is this page. Your published app can be exposed as an MCP server so ChatGPT or Claude can call its actions. And there is a Lovable API connector for Business and Enterprise plans. A public API for scripting Lovable projects themselves is not in the docs as of the check date.

    Where does the API key live?+

    In project secrets, which the docs describe as encrypted, injected into edge functions and never reaching the browser; a value cannot be viewed again after saving, only replaced. Lovable rejects VITE_ names in Secrets because anything with that prefix is bundled into the client. Lovable also detects a key pasted into the chat and steers it to Secrets.

    Which AI model do the AI prompts assume?+

    None in particular. Lovable's AI gateway adds model calls without a provider account, API key or billing setup; Lovable manages a per-project key and bills each call to workspace credits. For a provider the gateway does not offer, the docs say to call it from a backend edge function with your own key stored as a secret. The prompts specify the call shape and the output contract, so either path works.

    Does the Stripe integration handle webhooks?+

    Not by default. Lovable's Stripe connector docs say the integration does not use webhooks and to ask Lovable to write a webhook function when you need one, for fulfilment or subscription state. That is what the payment webhook prompt does. Built-in payments on Pro and above are different: Lovable registers two endpoints per environment and the docs say not to delete either.

    Where do webhooks belong, here or in Backend Logic?+

    Receiving and verifying one is an integration and lives here. Processing the event, retrying it and recovering from a bad batch is the Webhook Listener prompt on the backend page. The two are written to run in that order on one project.

    Which of these prompts have been run?+

    None of the 16 yet, and the cards say so. The three measured runs in the library are a landing page, a UI states system and a SaaS foundation, 1.8 to 10.4 credits. The first integration run is the payment webhook prompt with a test-mode Stripe key, and the replay test is the part that matters.

    What we have not tested yet

    • All 16 prompts in this category. Their cards show a question mark until we run them.
    • A published bundle searched for a key after a direct integration, to confirm the docs' claim on our own build.
    • The same AI prompt through the gateway and through a provider key, with the run credits compared.
    • Connectors other than Stripe. Named from the docs catalogue, never run by us.

    Next run: Payment Provider Webhook Integration, with a test-mode Stripe key and the replay test. How we test prompts

    Who wrote this

    Marco Kohns wrote these prompts and ran the three measured ones elsewhere in the library. Lovable Prompts is independent and not affiliated with Lovable.

    “Try in Lovable” links are affiliate links: we may earn a commission when you create an account through them. The Pro versions and the bundle are our own paid products. Neither decides which prompt we tell you to start with.

    api-integration