Free and Pro workspaces show an upgrade prompt for workspace API keys. OAuth clients are available to workspace owners and admins on all plans, but sensitive scopes require Business or Enterprise.
Why use workspace API keys
Use a key for a script or service that manages your team’s workspace. Give each integration its own key so you can limit its access and revoke it independently. Actions using a key are attributed to the person who created it. To connect your own app to Lovable, register an OAuth client. Each user then reviews and authorizes the requested scopes.Common use cases
Use workspace API keys for management tasks such as these:Prerequisites
Before you create a key, make sure you have:- A Business or Enterprise workspace and the owner or admin role.
- An integration that can send HTTPS requests and store credentials securely.
- Your integration’s public outbound IP addresses or ranges, if the key needs an IP allowlist.
Create an API key
Each key gets its own name, scopes, expiry, optional spending cap, and optional IP allowlist, so give each integration its own key. You can have up to 10 keys that you created in a workspace. Expired keys count toward this limit until you revoke them.1
Open workspace access tokens
Select the workspace your integration will manage. Go to Workspace settings → API keys & OAuth → Workspace access tokens and click New API key.
2
Name the key
Enter a Key name that helps you recognize the key later, for example
CI/CD pipeline or Zapier. The name is visible to workspace admins and owners.3
Set a credit limit (optional)
Set a Credit limit to cap how many AI build credits requests using this key can spend each calendar month. The cap resets at 00:00 UTC on the first day of each month. Leave it blank for no limit.
4
Choose an expiration
Choose an Expiration: 7, 30, 60, 90, or 180 days, 1 year, or Never. “Never” works for long-lived service integrations, but rotating keys regularly is safer.
5
Grant access
Under Access, choose None, Read, or Read & write for each resource. You must grant at least one:
- Projects: read and modify project settings, delete projects, publish projects, and read project security scans in this workspace.
- Workspace: list projects, and read workspace details, members, groups, security insights, and analytics.
6
Restrict the key to approved IP addresses (optional)
Under IP allowlist, click Add, then select one of these:
- IP groups: add a reusable IP group.
- IP addresses: paste entries.
- Upload CSV: import a file.
7
Create and copy the key
Click Create API key, then copy the key value.
Use the key
Send the key in theLovable-API-Key header on every request. This read-only example requires Workspace: Read or Read & write:
Manage existing keys
The Workspace access tokens section lists every key in the workspace with who created it, when it was created and last used, and its credit usage. Open a key’s View details action to see its scopes, expiry, credit limit, and IP allowlist. Keys past their expiration date show an Expired badge. From a key’s menu, you can:- Change the credit limit: open the key’s menu and click Edit credit limit. You can raise, lower, or remove the cap at any time.
- Change the IP allowlist: open the key’s menu and click Edit IP allowlist. Paste or import new entries, add or remove IP groups, or edit and remove existing entries. Removing every entry and every IP group allows any address again, and Lovable asks you to confirm first. When your workspace requires an IP allowlist on every key, you cannot save an empty allowlist.
- Revoke a key: open the key’s menu and click Revoke key, then confirm. Revocation is permanent and normally takes effect immediately, but allow a brief propagation delay. It does not cancel work already accepted. Anything still using the key loses access.
Filter and sort keys
Keys are listed most recently used first, with keys that were never used at the end. To find a key by name, type in Search keys next to View options. To narrow or reorder the list, click View options, then open Filters or Sort. Filters narrow the list to the keys that match. Each filter starts at Any, which shows all keys:- IP allowlist: Restricted shows keys with an IP allowlist. No restriction shows keys with no allowlist. Those keys accept requests from any address, unless your workspace requires an IP allowlist on every key.
- Access: Read only shows keys with no write access. Read & write shows keys with write access to at least one resource. Older keys saved without scopes appear under Read & write.
- Expiration: Expires shows keys with an expiration date that has not passed. Never shows keys that never expire. Expired shows keys that no longer work.
- Created by: keys created by the person you select.
- Most recently used: the default order.
- Newest keys or Oldest keys: by creation date.
- Expiring soonest or Expiring latest: by expiration date. Keys that never expire stay at the end.
- Most credits used this month or Fewest credits used this month: by credit usage in the current calendar month.
Restrict a key to an IP allowlist
An IP allowlist limits a key to requests from approved IP addresses and address ranges, so a key only works from the servers you expect, for example a CI runner or your own backend. Set it when you create the key, or from an existing key’s menu with Edit IP allowlist. An entry is an IPv4 or IPv6 address, or an address range in CIDR notation, such as203.0.113.0/24 or 2001:db8::/48. Lovable rejects ranges wider than /8 for IPv4 or /32 for IPv6.
A key with an allowlist must have at least one IPv4 entry, on its own list or in one of its IP groups. A server with both an IPv4 and an IPv6 address can still send requests over IPv4, so a list with only IPv6 entries can block them.
Paste entries separated by commas or new lines, or upload a CSV file with one entry per row. A list can have up to 3,000 entries, and a CSV can be up to 1 MB. Lovable skips entries that are already on the list. When you import a CSV, Lovable also skips rows that are not valid entries and shows how many it skipped. A key with no allowlist accepts requests from any address, unless your workspace requires an allowlist on every key.
When the list has at least one entry, the ⋯ menu next to the allowlist’s Add button shows these actions:
- Edit direct IPs as text: edit the addresses and ranges on the list as text, one entry per line, to change many entries at once. Click List view to return to the list with your changes.
- Export direct IPs as CSV: download the addresses and ranges on the list as a CSV file, for example to reuse it on another key with Upload CSV.
403 ip_restricted. On Enterprise plans, each refused request is recorded in your workspace audit log as User API key IP rejected, and allowlist changes appear as User API key updated.
The Lovable API connector calls the API from Lovable’s connector gateway, not from your address. To use a restricted key with the connector, include the connector gateway IP ranges in the allowlist.
Reuse addresses with IP groups
An IP group is a named list of IP addresses and ranges that you can add to the allowlist of any workspace API key. Use groups for addresses that several keys share, such as your office network or your CI runners, so you update them in one place. On Business and Enterprise plans, workspace admins and owners create and manage IP groups. To create one:- Open Workspace settings → Security → Privacy & security → Access and find the IP groups section.
- Click Create IP group.
- Enter a Name and, optionally, a Description.
- Click Add, select IP addresses to paste entries or Upload CSV to import a file, then save the group.
- A workspace can have up to 50 IP groups, and each group up to 3,000 entries.
- Group names must be unique in the workspace.
- A key can use up to 10 IP groups.
- A group can include IPv4 entries, IPv6 entries, or both. If a key’s only IPv4 entry is in a group, you cannot remove that entry from the group.
- You cannot delete a group while a key uses it. Remove the group from those keys first.
- IP group created, IP group updated, and IP group deleted: changes to a group.
- User API key IP groups updated: groups added to or removed from an existing key.
Require an IP allowlist on every key
On Business and Enterprise plans, workspace admins and owners can require an IP allowlist on every workspace API key. The requirement makes sure that no key in the workspace works from an address you have not approved. To find the keys that need an allowlist, filter the list by IP allowlist → No restriction in View options before you enable the requirement. To require allowlists, enable IP allowlists required under Public API keys in Workspace settings → Security → Privacy & security → Access. If some active keys have no allowlist, Lovable shows how many and asks you to confirm, because those keys stop working. With the requirement enabled:- Every new key needs an allowlist before you can create it.
- You cannot save an empty allowlist on a key.
- Existing keys without an allowlist stop working. Requests that use them fail with
403 ip_allowlist_required. Lovable does not revoke these keys, so a key works again after you add an allowlist with Edit IP allowlist.
Keep keys safe
Keep the following in mind:- Store keys in a secret manager or environment variable, never in code or version control.
- Grant only the scopes each key needs, and prefer an expiry date over “Never.”
- Give each integration its own key, so you can revoke one without breaking the others.
- Lovable partners with GitHub secret scanning: when GitHub secret scanning detects and reports an exposed supported Lovable API key (keys start with
lov_), Lovable revokes it automatically and sends an email notification. Treat a key exposed anywhere else as compromised and revoke it yourself.
When storing a key as a project secret, do not name it
LOVABLE_API_KEY. Lovable creates and manages a secret with that exact name in each project, and names starting with LOVABLE_ are reserved. Pick a different name, such as LOV_PUBLIC_API_KEY.FAQ
Who can create and see API keys?
Who can create and see API keys?
Workspace owners and admins on Business and Enterprise plans. They see every key in the workspace, including keys created by others, but not a key’s secret value.
Can I see the secret value of a key again?
Can I see the secret value of a key again?
No. The secret is shown once, when the key is created. If you lose it, create a new key and revoke the old one.
What happens when a key expires?
What happens when a key expires?
Requests using the key start failing. Expiry does not delete the key from the list, so you can see what expired, but you need to create a new key to restore access. An expired key still counts toward your limit of 10 keys in the workspace until you revoke it. To list expired keys, use Expiration → Expired in View options.
What does the credit limit do?
What does the credit limit do?
It caps how many AI build credits requests authenticated with that key can spend each calendar month. The cap resets at 00:00 UTC on the first day of each month, independently of your subscription renewal date. The API currently manages and deploys existing projects and does not expose AI project creation or editing, so no current endpoint spends AI build credits. Deployment builds through the publish endpoint do not spend them either. When the cap is reached, requests that would spend credits fail until the next month starts or until you raise the limit. Requests that do not spend credits are not affected by the cap.
Can I restrict a key to specific IP addresses?
Can I restrict a key to specific IP addresses?
Yes. When you create the key, or later with Edit IP allowlist, add IPv4 or IPv6 addresses, CIDR ranges, or IP groups. The key needs at least one IPv4 entry, on its own list or in one of its IP groups. Requests from other addresses fail with
403 ip_restricted. To use a restricted key with the Lovable API connector, include Lovable’s connector gateway IP ranges in the list. See Restrict a key to an IP allowlist.Is revoking a key reversible?
Is revoking a key reversible?
No. Revoking is permanent and normally takes effect immediately, though a brief propagation delay is possible. Create a new key if you need access again.