/lovable-integrations

Lovable and Shutterstock API integration: Step-by-Step Guide 2025

Learn how to integrate Lovable with the Shutterstock API in our easy guide. Unlock seamless image access and boost your project in just a few simple steps.

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 Shutterstock API?

 

Creating the Shutterstock API Integration File

 

In your Lovable project, create a new TypeScript file called shutterstockAPI.ts in the main source folder. This file will contain all the functions needed to communicate with the Shutterstock API.


// Replace 'YOURSHUTTERSTOCKACCESS_TOKEN' with your actual Shutterstock API access token.
export const SHUTTERSTOCKACCESSTOKEN = 'YOURSHUTTERSTOCKACCESS_TOKEN';

// Base URL for the Shutterstock API.
export const SHUTTERSTOCKBASEURL = 'https://api.shutterstock.com/v2';

/**
- Function to search images on Shutterstock using a query string.
- @param query - The search term for images.
- @returns A promise resolving with the JSON result from the API.
 */
export async function searchImages(query: string): Promise {
  const url = ${SHUTTERSTOCK_BASE_URL}/images/search?query=${encodeURIComponent(query)};
  const response = await fetch(url, {
    headers: {
      'Authorization': Bearer ${SHUTTERSTOCK_ACCESS_TOKEN},
      'Content-Type': 'application/json'
    }
  });

  if (!response.ok) {
    throw new Error(Error fetching images: ${response.statusText});
  }
  return await response.json();
}

 

Integrating the Shutterstock API in Your Main Code

 

Now, open your main project file where you want to use the Shutterstock API (for example, main.ts) and import the function from shutterstockAPI.ts. Here’s how to do it:


import { searchImages } from './shutterstockAPI';

// Example function to handle image search triggered from your application.
async function handleImageSearch(query: string) {
  try {
    const results = await searchImages(query);
    console.log('Search Results:', results);
    // Process the results as needed in your application.
  } catch (err) {
    console.error('Error during image search:', err);
  }
}

// Example: Trigger a test search when the app starts.
handleImageSearch('nature');

 

Installing Dependencies Without a Terminal

 

Lovable does not have a terminal for installing dependencies. Since modern browsers and many runtimes already support the fetch API, no external library is needed. If your project requires a polyfill for fetch (for example, if running on an older Node.js version), include the polyfill directly in your project by adding its script tag in your HTML file or by copying the polyfill code into your project as a new file.

For example, if you needed to polyfill fetch using a script, add the following to your main HTML file:



 

Configuring Your Shutterstock API Credentials

 

In the file shutterstockAPI.ts, ensure that you replace 'YOURSHUTTERSTOCKACCESS_TOKEN' with your actual Shutterstock API access token. This token is used to authenticate your API requests.


// Example: Replace with your access token.
export const SHUTTERSTOCKACCESSTOKEN = 'abc123yourRealAccessToken';

 

Testing the Integration

 

Once the above changes are in place, your Lovable project will call the Shutterstock API when handleImageSearch is invoked. Open your project in the browser, and check the console output for the search results or any error messages. Ensure your API token is valid and your network connection is active.

 

Applying Further Enhancements

 

After successfully testing, you can expand the integration by:

 

• Implementing additional functions for other Shutterstock endpoints (for example, image details or downloading images).

• Creating user interface elements to allow dynamic search queries from users.

• Handling errors and loading states for a smoother user experience.

 

By following these steps, you have integrated the Shutterstock API into your Lovable project using TypeScript.

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