/lovable-integrations

Lovable and Getty Images API integration: Step-by-Step Guide 2025

Learn to integrate Lovable with the Getty Images API and access millions of high-quality visuals. Follow our step-by-step guide to get started!

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to integrate Lovable with Getty Images API?

 

Setting Up Getty API Configuration

 
  • Create a new file named gettyConfig.ts in your project’s source folder (for example, alongside your other TypeScript files).
  • Paste the following code into gettyConfig.ts. This file will store your Getty Images API key. Replace YOURGETTYAPIKEYHERE with your actual Getty Images API key.

export const GETTYAPIKEY = "YOURGETTYAPIKEYHERE";

 

Creating the Getty API Client

 
  • Create a new file named gettyApiClient.ts in the same folder as gettyConfig.ts.
  • Paste the following TypeScript code into gettyApiClient.ts. This code defines a function to search for images using the Getty Images API.

import { GETTYAPIKEY } from './gettyConfig';

const BASE_URL = 'https://api.gettyimages.com/v3';

export async function searchGettyImages(query: string, page: number = 1, pageSize: number = 10): Promise {
  const url = ${BASE_URL}/search/images?phrase=${encodeURIComponent(query)}&page=${page}&page_size=${pageSize};
  const response = await fetch(url, {
    headers: {
      'Api-Key': GETTYAPIKEY
    }
  });
  if (!response.ok) {
    throw new Error(Getty API error: ${response.statusText});
  }
  return await response.json();
}

 

Integrating the Getty API Client Into Your Project

 
  • Open the main file where you want to use Getty image functionalities (for instance, your app.ts or a component file).
  • Import the searchGettyImages function at the top of the file.
  • Add the following code snippet into your file to call the function when needed (for example, after a user search input). This example demonstrates how to call the function and log the results.

import { searchGettyImages } from './gettyApiClient';

// Example function to handle image search
async function handleImageSearch(query: string) {
  try {
    const data = await searchGettyImages(query);
    console.log('Getty Images data:', data);
    // Insert additional code here to update your project UI with the image data
  } catch (error) {
    console.error('Error fetching Getty Images:', error);
  }
}

// Example trigger for the search function (e.g., call this function on a button click event)
handleImageSearch("nature");

 

Setting Up API Key Without a Terminal

 
  • Since Lovable projects do not have a terminal, you cannot run install commands. Instead, make sure all code files (like gettyConfig.ts and gettyApiClient.ts) are saved in your project’s file explorer.
  • If your project management interface allows you to define global configurations or environment files, ensure that your Getty API key is stored securely there and update gettyConfig.ts accordingly.

 

Testing the Integration

 
  • Save all changes in your Lovable project.
  • Trigger the search functionality (for example, by using the demo call in handleImageSearch).
  • Check your project’s console output to verify that Getty Images data is returned without errors.
  • If the data is retrieved successfully, update your UI code to display the images as needed in your project.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022