To integrate Lovable with the Getty Images API, create a Supabase Edge Function that proxies search and embed requests using your API key stored in Cloud → Secrets. Getty offers a free embed-only tier and a paid download tier — the Edge Function handles authentication for both. Use Lovable's chat to build image search UIs, editorial galleries, and content libraries once the proxy is in place.
Add premium licensed stock images to Lovable apps with the Getty Images API
Getty Images is one of the world's largest collections of licensed photography and editorial content, covering news events, entertainment, sports, business, and creative stock. The Getty Images API gives developers programmatic access to this catalog: search by keyword, filter by orientation, image type, or license category, retrieve high-resolution metadata, and either embed watermarked images for free or purchase download rights for clean licensed assets.
The API has two distinct usage tiers. The free embed tier lets you display watermarked Getty images on public websites using Getty's iframe-based embed code — no licensing fee, but images carry a visible Getty watermark and can only be used for editorial and non-commercial purposes. The paid download tier provides API keys that unlock high-resolution, watermark-free image downloads with commercial licensing. For most Lovable apps in the prototype and MVP stage, the embed tier is sufficient to demonstrate the concept. For production apps that need clean images for product imagery, marketing materials, or commercial publishing, the paid tier is required.
Getty stands apart from free stock APIs like Pixabay in content quality and legal coverage: professionally shot editorial images, celebrity photography, news event coverage, and sports imagery simply does not exist in free community repositories. If your app needs images of public figures, breaking news, or premium editorial content, Getty is the right choice.
Integration method
Getty Images API uses an API key for authentication. Because API keys must never appear in browser code, all Getty API calls — search queries, image metadata, and download authorizations — are proxied through a Supabase Edge Function. The free embed-only tier uses a special embed code rather than direct downloads, while the paid tier requires an API key for download link generation.
Prerequisites
- A Lovable account with a project that has Lovable Cloud enabled
- A Getty Images developer account — register at developers.gettyimages.com (requires a Getty Images account)
- A Getty Images API key — available after registering your application in the developer portal
- An understanding of Getty's licensing tiers: embed-only (free, watermarked, non-commercial) vs. download (paid, clean, commercial)
- For paid download tier: a Getty Images subscription or prepaid credits
Step-by-step guide
Register for Getty Images API access and obtain your API key
Register for Getty Images API access and obtain your API key
Navigate to developers.gettyimages.com and click 'Get API Key'. You will be prompted to sign in with a Getty Images account (or create one). Once signed in, click 'Register a new application'. Fill in your application name, description, and the primary use case — select 'Editorial website or app' for editorial use or 'Commercial application' for paid use. Enter your app's URL. After submitting, Getty Images reviews your application. This review can take 24 to 72 hours for new accounts, though existing Getty customers often receive faster approval. You will receive an email with your API key once approved. Important: understand which tier you have access to. Basic API access grants search and embed capabilities — you can search Getty's catalog and display watermarked thumbnails or use Getty's iframe embed code. Download access requires a Getty subscription (starting at $35 per month for smaller plans) or enterprise agreement. The API key is the same format either way, but the /downloads endpoint is only available to accounts with download rights. For testing the integration during development, the search endpoints work without any download rights. You can search, retrieve image metadata, and generate embed codes with a basic API key. Only add download functionality once you have confirmed your Getty account has the appropriate licensing level.
Pro tip: Getty Images also offers a partner API program for platforms that integrate Getty for their end users. If you are building a tool used by many content creators, the partner program may have more favorable pricing than individual licensing.
Expected result: You have a Getty Images API key from the developer portal. The key is a string starting with your account identifier. Your developer dashboard shows which endpoints are available to your account level.
Store your Getty API key in Cloud → Secrets
Store your Getty API key in Cloud → Secrets
Open your Lovable project and click the '+' icon at the top of the editor next to the Preview label to open the Cloud panel. Click the Secrets tab, then 'Add new secret'. Add the following secret: - Name: GETTY_API_KEY — Value: your Getty Images API key from the developer portal If your Getty API tier also includes a client secret (some API plans require both a key and secret for OAuth2 authentication), add it as well: - Name: GETTY_CLIENT_SECRET — Value: your Getty client secret (if applicable) Getty's standard API tier uses a single API key passed as the Api-Key header on every request. More advanced Getty API plans (enterprise tier) use OAuth2 client credentials. The Edge Function in the next step uses the single API key approach, which covers the vast majority of Getty API use cases. Never paste your Getty API key into Lovable's chat prompt. The Getty API key authorizes download requests that can incur licensing fees — an exposed key could be used to download licensed images on your account without your knowledge. Lovable's security system blocks approximately 1,200 hardcoded API keys per day, but using the Secrets panel is the correct approach regardless.
Expected result: GETTY_API_KEY appears in Cloud → Secrets with a masked value. The secret is ready to be accessed from Edge Functions via Deno.env.get('GETTY_API_KEY').
Create the Getty Images search Edge Function
Create the Getty Images search Edge Function
Create a Supabase Edge Function that proxies search requests to Getty Images API. The function accepts a search query, optional filters, and page parameters from the frontend, forwards the request to Getty's search endpoint with your API key, and returns the results. Getty's primary search endpoint is GET /v3/search/images with parameters including phrase (the search keyword), fields (which metadata to return), orientations, image_type, editorial_use_only, and page and page_size for pagination. The function returns image IDs, titles, captions, thumbnails, and display sizes. Paste the prompt below into Lovable's chat to generate and deploy the function. After creation, test it by calling it with a simple search term and verifying that Getty image metadata appears in the response.
Create a Supabase Edge Function at supabase/functions/getty-api/index.ts. Accept GET requests with query parameters: 'phrase' (search keyword, required), 'image_type' (editorial or creative, default editorial), 'orientations' (horizontal, vertical, or square), 'page' (default 1), 'page_size' (default 20). Call https://api.gettyimages.com/v3/search/images with these parameters and the header Api-Key from Deno.env.get('GETTY_API_KEY'). Return the images array from the Getty response as JSON. Include CORS headers.
Paste this in Lovable chat
1// supabase/functions/getty-api/index.ts2const GETTY_BASE_URL = 'https://api.gettyimages.com/v3';34Deno.serve(async (req) => {5 if (req.method === 'OPTIONS') {6 return new Response(null, {7 headers: {8 'Access-Control-Allow-Origin': '*',9 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',10 'Access-Control-Allow-Headers': 'Content-Type, Authorization',11 },12 });13 }1415 const apiKey = Deno.env.get('GETTY_API_KEY');16 if (!apiKey) {17 return new Response(JSON.stringify({ error: 'Getty API key not configured' }), {18 status: 500,19 headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' },20 });21 }2223 const url = new URL(req.url);24 const phrase = url.searchParams.get('phrase');25 if (!phrase) {26 return new Response(JSON.stringify({ error: 'phrase parameter is required' }), {27 status: 400,28 headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' },29 });30 }3132 const imageType = url.searchParams.get('image_type') || 'editorial';33 const orientations = url.searchParams.get('orientations') || '';34 const page = url.searchParams.get('page') || '1';35 const pageSize = url.searchParams.get('page_size') || '20';3637 const gettyParams = new URLSearchParams({38 phrase,39 image_type: imageType,40 page,41 page_size: pageSize,42 fields: 'id,title,caption,date_created,artist,display_sizes,keywords',43 });44 if (orientations) gettyParams.set('orientations', orientations);4546 const gettyResponse = await fetch(47 `${GETTY_BASE_URL}/search/images?${gettyParams.toString()}`,48 {49 headers: {50 'Api-Key': apiKey,51 'Accept': 'application/json',52 },53 }54 );5556 const data = await gettyResponse.json();5758 return new Response(JSON.stringify(data), {59 status: gettyResponse.status,60 headers: {61 'Content-Type': 'application/json',62 'Access-Control-Allow-Origin': '*',63 },64 });65});Pro tip: Getty's display_sizes field returns multiple thumbnail sizes. The 'thumb' size is 170px wide (good for grid previews), 'comp' is a watermarked comp image at larger resolution (good for lightbox views), and 'preview' is a medium-size watermarked preview.
Expected result: The getty-api Edge Function is deployed. Calling it with a phrase parameter returns a JSON array of Getty image objects including IDs, titles, artist names, and thumbnail URLs.
Build the image search and gallery UI
Build the image search and gallery UI
With the Edge Function deployed, use Lovable's chat to generate the frontend components. Describe the image search interface, gallery layout, and any filtering controls you want. Lovable will create React components that call your Edge Function and display results with proper attribution. Getty requires attribution in all displays of their images: the photographer's name and 'Getty Images' must appear with each image. Make this a requirement in your Lovable prompt so the generated components include proper credit. For the embed tier, also include the Getty Images logo or watermark — Getty's embed code handles this automatically if you use the iframe approach, but custom displays need explicit attribution. For the free embed tier, prompt Lovable to use Getty's official iframe embed code rather than displaying thumbnail images directly. This is both legally required and provides Getty-hosted watermarking automatically. For the paid download tier, you can display clean images directly from Supabase Storage after downloading them via the API. Add pagination to the gallery — Getty returns results in pages of up to 100 images per request. Implement infinite scroll or numbered pagination using the result_count and page fields in Getty's response.
Create an image search page that calls the getty-api Edge Function with a search keyword from a text input. Display results in a responsive masonry grid. Each image card must show the watermarked thumbnail, photographer credit (artist field), title, and date. Add a loading skeleton while images are fetching. Include pagination controls using the result_count from the Edge Function response. Add a filter dropdown for editorial vs. creative images.
Paste this in Lovable chat
Expected result: A search page displays Getty image results in a grid with proper photographer attribution. The search input triggers new API calls via the Edge Function. Pagination controls let users browse through large result sets.
Common use cases
Editorial image search tool for content creators
Build a search interface where journalists, bloggers, or content teams can search Getty's editorial library, preview watermarked images, and generate Getty embed codes for insertion into articles. The tool saves approved images to Supabase with their Getty IDs and usage metadata for license tracking.
Create an image search page that calls the getty-search Edge Function with a keyword query. Display results in a masonry grid showing watermarked preview thumbnails with caption, photographer credit, and date. Add filters for editorial vs. creative, orientation, and image type. Each result should show a 'Copy Embed Code' button that copies the Getty iframe embed code to clipboard.
Copy this prompt to try it in Lovable
Licensed stock image library for a design team
Create an internal tool where a design team can search Getty, download licensed images using API credits, track which images have been licensed, and organize downloads into project folders stored in Supabase. The paid API tier is required for this use case.
Build a stock image library that calls the getty-api Edge Function to search Getty's creative collection. Show a 'Download' button on each result that calls the Edge Function to get the download URI, then downloads the full-resolution licensed image to Supabase Storage. Store the download record including Getty image ID, license type, and download date in a Supabase table called 'licensed_images'.
Copy this prompt to try it in Lovable
News article image discovery widget
Add an image discovery sidebar to a publishing platform that suggests relevant Getty editorial images based on the article's headline or tags. Editors can preview images in context and insert the Getty embed code directly into their article. The sidebar calls the Edge Function to search Getty's editorial collection using the article metadata.
Add an image suggestion panel to the article editor that reads the article title and calls the getty-search Edge Function to fetch 6 relevant editorial images. Display them as thumbnails with captions. When an editor clicks an image, insert the Getty embed code at the cursor position in the article content editor.
Copy this prompt to try it in Lovable
Troubleshooting
API returns 401 Unauthorized with 'ApiKey not found' or 'Invalid API key'
Cause: The GETTY_API_KEY secret value is incorrect, the secret name does not match the Deno.env.get() call, or the Getty API application has not been approved yet.
Solution: First, verify your API key is correct by checking the Getty developer portal at developers.gettyimages.com. Copy the key value exactly. Then open Cloud → Secrets and confirm the secret name is exactly GETTY_API_KEY (no spaces, exact capitalization). If your Getty application is still under review, you will not receive a valid key until approval is confirmed — check your email for the Getty approval notification.
Search returns empty results for keywords that clearly have Getty images
Cause: The image_type parameter may be filtering too aggressively, or the phrase is using words Getty indexes differently. Getty's editorial and creative collections are searched separately by default.
Solution: Remove the image_type filter to search both editorial and creative simultaneously, or try alternate search terms. Getty uses its own tagging taxonomy which sometimes differs from natural language expectations. Also check that the phrase parameter is URL-encoded correctly — spaces should be encoded as %20 or +. Test with single, common words like 'business' or 'nature' to confirm the API connection is working before troubleshooting search quality.
Download endpoint returns 403 Forbidden when trying to get download links
Cause: Your Getty API account does not have download rights. The /downloads endpoint requires a Getty Images subscription or enterprise agreement — basic API access does not include download capabilities.
Solution: Confirm your account level at developers.gettyimages.com. If you need download access, you must upgrade to a paid Getty Images subscription. In the meantime, use Getty's iframe embed code for the free embed tier, which provides watermarked images without requiring download rights. The embed approach is sufficient for editorial display use cases.
Best practices
- Always display photographer credits (artist field) and 'Getty Images' attribution with every image — this is both a legal requirement and a contractual obligation of API access
- Use the embed tier's iframe approach for editorial publications rather than downloading and re-hosting images without a commercial license
- Cache Getty search results in Supabase with the search phrase as the key and a 24-hour TTL — image catalog changes slowly and caching significantly reduces API call volume
- Store the Getty image ID alongside any images you download or display so you maintain an audit trail for license compliance
- Use the fields parameter to request only the metadata fields your UI needs — requesting all fields increases response size and latency
- Implement pagination from the start using Getty's result_count and page_size fields — result sets can contain thousands of images and infinite loading without pagination creates poor UX
- Test your integration with Getty's editorial image type first before attempting creative downloads — editorial search requires fewer account permissions and lets you verify the API connection is working
Alternatives
Choose Pixabay API if you need free images for non-commercial or commercial use without licensing fees — Pixabay's community-contributed CC0 images cost nothing but lack the editorial depth and legal certainty of Getty.
Choose Shutterstock API if you need premium licensed stock images with a similar pricing model to Getty but prefer Shutterstock's catalog, contributor community, and API design.
Choose Vimeo if your media needs are video-focused rather than photography — Vimeo is the professional video hosting equivalent of what Getty Images is for still photography.
Frequently asked questions
Is the Getty Images API free to use?
Getty Images offers a free embed-only tier that lets you display watermarked Getty images on public websites via iframe embed codes, with no charge for editorial and non-commercial use. Downloading high-resolution, watermark-free images for commercial use requires a paid Getty Images subscription starting around $35 per month or prepaid credits. The API key itself is free — the cost is in the licensing for downloaded images.
Can I use Getty images in my Lovable app without a commercial license?
Yes, for editorial and non-commercial display only. The free embed tier allows you to show watermarked Getty images via the iframe embed code on public-facing sites for editorial purposes like news, commentary, or education. You cannot use these images for commercial purposes such as product advertising, promotional materials, or any use where the image drives a commercial transaction. For commercial use, you need a paid Getty subscription with download rights.
How do Getty's embed codes work compared to direct API image URLs?
Getty's iframe embed code is an HTML snippet that loads a Getty-hosted iframe containing the image, caption, and required attribution. It is free to use for editorial purposes and automatically handles watermarking. Direct API image URLs point to Getty's CDN and require either a signed download URL (paid tier) or are watermarked comp images. For the free tier, the iframe embed code is the legally compliant approach — avoid displaying raw Getty thumbnail URLs without the proper embed code or licensing.
How long does Getty API application approval take?
Getty's API application review typically takes 24 to 72 hours for new applicants. Existing Getty Images customers with active subscriptions often receive faster approval. During the waiting period, you can build your Lovable app and Edge Function using placeholder data — the API calls will return 401 errors until your key is approved, but you can verify the integration is wired correctly once the key activates.
What is the difference between Getty editorial and creative image types?
Editorial images document real-world events, people, and news — they cannot be used for advertising or commercial promotion but can be used in news articles, blogs, and educational content. Creative images are stylized stock photography cleared for commercial use — they can appear in ads, product packaging, and marketing materials. The API lets you filter by image_type: pass 'editorial' for news and editorial apps, 'creative' for commercial design tools. Some accounts only have access to one type based on their subscription level.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation