KBAISE/ for lovable
Library
Docs

Integrate any API with Lovable

about 15 minBuildingchecked 30h agoOfficial page
The short version

You can connect almost any external service to your Lovable app, even if Lovable doesn't have a ready-made connection for it. You can either create a custom connection that Lovable manages, or you can ask Lovable to connect the service directly to your app's code.

Anyone building an app with Lovable who needs to connect to an external service or API.

Do this, in order

  1. 1

    Decide if you want to use a connector from Lovable's catalog, create a custom connector, or connect the service directly.

    This choice determines how Lovable handles credentials and how much control you have over the integration.

  2. 2

    If the service needs no credentials, just ask Lovable to integrate it by providing its URL.

    Lovable will automatically detect that no key is required and add the feature to your app.

  3. 3

    If the service needs an API key or OAuth and you want Lovable to manage credentials, go to 'Connectors' in your dashboard, click '+', and choose 'Custom connector'.

    This creates a reusable connection for your workspace where Lovable securely stores credentials and handles requests.

  4. 4

    After creating a custom connector, connect to it with the service's credentials, then ask Lovable in your project chat to link this connection to your project and build the feature.

    This makes the custom connector available for use in your specific project.

  5. 5

    If you prefer to manage the API key yourself, ask Lovable to connect the service directly, providing details like endpoint URLs, authentication method, required headers, and example request/response formats.

    This gives you full control over the integration details within your app's code.

  6. 6

    When Lovable asks for the API key for a direct integration, enter it in the 'Add secret' form.

    This ensures the key is stored securely as a project secret and not exposed in your chat history.

  7. 7

    If you want to embed a widget or feed, paste the embed code into the project chat and ask Lovable to place it.

    Lovable can add pre-built external content directly into your app.

Paste this into your project

Integrate the OpenWeatherMap API. Base URL: https://api.openweathermap.org/data/2.5. Auth: API key passed as a query parameter appid. I need an endpoint to fetch the current weather: GET /weather?q={city}&units=metric&appid={API_KEY}. Docs: https://openweathermap.org/current

Words decoded

API
API stands for Application Programming Interface. It's a set of rules and tools that lets different software programs talk to each other and share information. Think of it like a menu in a restaurant: it tells you what you can order (what data you can request) and how to order it.
Connector Gateway
This is a secure system within Lovable that acts as a middleman for your app's connections to external services. It safely stores your login details (like API keys) and handles the communication, so your app doesn't have to directly manage sensitive information.
Credentials
These are the login details, like usernames, passwords, or special keys (API keys), that prove your identity and give you permission to access an external service.
OAuth
This is a secure way for you to grant an application (like your Lovable app) limited access to your information on another service (like Google or Facebook) without giving away your password. It's like giving someone a temporary, specific key instead of your house key.
Secrets
These are sensitive pieces of information, like API keys or passwords, that your app needs to function but should never be visible to users or stored directly in your app's code. Lovable stores them securely outside your main project.
Server function
This is a piece of code that runs on a server, not directly in your user's web browser. It's used for tasks that need to be secure or require access to sensitive information, like handling API keys or processing data before it reaches the user.

Where people get stuck

  • Trying to connect to a service that is not accessible from the internet (e.g., one only available on your private network).
  • Typing sensitive API keys directly into the project chat instead of using the 'Add secret' form, which exposes them in your chat history.
  • Not understanding the difference between a connector and a direct integration, leading to unintended credential management or access control issues.
  • Forgetting to enable 'Cloud' in older React + Vite apps when using direct integrations that require credentials, which prevents them from working.

The short version, steps, decoder and prompt on this page are written automatically from Lovable's own documentation and can lag or misread it. The official page is always the authority.